Python
GUI foundation: machine-aware api, routes, type scale, text size, card payloads
Devika Verma42bf9da2d79e
diff --git a/surfaces/gui/index.html b/surfaces/gui/index.htmlindex 7f86a134..55c59902 100644--- a/surfaces/gui/index.html+++ b/surfaces/gui/index.html@@ -11,6 +11,9 @@var t = localStorage.getItem("openwork-theme");var dark = t === "dark" || (t !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);document.documentElement.dataset.theme = dark ? "dark" : "light";+ // Text size (src/textSize.ts, key "openwork-text-size"): small | large; absent = default.+ var ts = localStorage.getItem("openwork-text-size");+ if (ts === "small" || ts === "large") document.documentElement.dataset.textSize = ts;} catch (e) {}</script></head>diff --git a/surfaces/gui/package-lock.json b/surfaces/gui/package-lock.jsonindex d4eb573b..3fc037e9 100644--- a/surfaces/gui/package-lock.json+++ b/surfaces/gui/package-lock.json@@ -8,6 +8,10 @@"name": "openworker-gui","version": "0.0.0","dependencies": {+ "@auth0/auth0-spa-js": "^2.24.1",+ "@noble/ciphers": "^2.4.0",+ "@noble/curves": "^2.4.0",+ "@noble/hashes": "^2.4.0","i18next": "^26.3.6","pdfjs-dist": "^4.10.38","react": "^18.3.1",@@ -69,6 +73,28 @@"dev": true,"license": "ISC"},+ "node_modules/@auth0/auth0-auth-js": {+ "version": "1.12.1",+ "resolved": "https://registry.npmjs.org/@auth0/auth0-auth-js/-/auth0-auth-js-1.12.1.tgz",+ "integrity": "sha512-YgYOAGmfwO40YOYkYSW7XvE6b+qkdlXdpzBshvOjCioygesUxIw2qRerilW1/8XQV41mnFvQIPnsTdEOHN9BeA==",+ "license": "MIT",+ "dependencies": {+ "jose": "^6.0.8",+ "openid-client": "^6.8.0"+ }+ },+ "node_modules/@auth0/auth0-spa-js": {+ "version": "2.24.1",+ "resolved": "https://registry.npmjs.org/@auth0/auth0-spa-js/-/auth0-spa-js-2.24.1.tgz",+ "integrity": "sha512-iS18fBlWWxQ/FPtWgWzYYEImsNRumJG2cZ08xV0HsEmWtTBv+54A+fnyFx9eiNBP7cLp0emwDDjgeG+hQEbVBA==",+ "license": "MIT",+ "dependencies": {+ "@auth0/auth0-auth-js": "^1.10.0",+ "browser-tabs-lock": "^1.3.0",+ "dpop": "^2.1.1",+ "es-cookie": "~1.3.2"+ }+ },"node_modules/@babel/code-frame": {"version": "7.29.7","resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",@@ -100,7 +126,6 @@"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@babel/code-frame": "^7.29.7","@babel/generator": "^7.29.7",@@ -449,7 +474,6 @@}],"license": "MIT",- "peer": true,"engines": {"node": ">=18"},@@ -473,7 +497,6 @@}],"license": "MIT",- "peer": true,"engines": {"node": ">=18"}@@ -1169,6 +1192,45 @@"url": "https://github.com/sponsors/Brooooooklyn"}},+ "node_modules/@noble/ciphers": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.4.0.tgz",+ "integrity": "sha512-AnjFn0Jv92laAkvMrghlFZq4qQCIN/4DxFV/eooqtC2YTjB7kBeLMS2T9KJX4Dn+ZVXLOwK0lSgqDtx9gvxtiw==",+ "license": "MIT",+ "engines": {+ "node": ">= 20.19.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/@noble/curves": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-2.4.0.tgz",+ "integrity": "sha512-P4/62zrgfH33CneE3Dn4WhJVA22YUU0eR51wKIan4NVRvwsA0YnPTwWGpNbpuacSujmSFLvyzpyuR30+fbq2Ew==",+ "license": "MIT",+ "dependencies": {+ "@noble/hashes": "2.4.0"+ },+ "engines": {+ "node": ">= 20.19.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/@noble/hashes": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-2.4.0.tgz",+ "integrity": "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA==",+ "license": "MIT",+ "engines": {+ "node": ">= 20.19.0"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },"node_modules/@nodelib/fs.scandir": {"version": "2.1.5","resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",@@ -1803,7 +1865,6 @@"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@babel/code-frame": "^7.10.4","@babel/runtime": "^7.12.5",@@ -1957,7 +2018,6 @@"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.30.tgz","integrity": "sha512-3ek6mwJL5/VBewBcY4S66cqlCtK3qi4WIq37Z0m/NHw1hjhI7274Mx1qz/+ggSzyBCOEf7eHjBN6INjPAWYfYw==","license": "MIT",- "peer": true,"dependencies": {"@types/prop-types": "*","csstype": "^3.2.2"@@ -1969,7 +2029,6 @@"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==","dev": true,"license": "MIT",- "peer": true,"peerDependencies": {"@types/react": "^18.0.0"}@@ -2303,6 +2362,16 @@"node": ">=8"}},+ "node_modules/browser-tabs-lock": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/browser-tabs-lock/-/browser-tabs-lock-1.3.0.tgz",+ "integrity": "sha512-g6nHaobTiT0eMZ7jh16YpD2kcjAp+PInbiVq3M1x6KKaEIVhT4v9oURNIpZLOZ3LQbQ3XYfNhMAb/9hzNLIWrw==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "lodash": ">=4.17.21"+ }+ },"node_modules/browserslist": {"version": "4.28.4","resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.4.tgz",@@ -2323,7 +2392,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"baseline-browser-mapping": "^2.10.38","caniuse-lite": "^1.0.30001799",@@ -2736,6 +2804,15 @@"dev": true,"license": "MIT"},+ "node_modules/dpop": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/dpop/-/dpop-2.1.2.tgz",+ "integrity": "sha512-hN3XjjCcgYWmNL8DFAV1Z3alXIvLolvjis189NI/U4k4Iu/m4rBeUYObbIjnRzQYDQv4zMaXXskjVDqSkmyh7Q==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },"node_modules/dunder-proto": {"version": "1.0.1","resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",@@ -2771,6 +2848,12 @@"url": "https://github.com/fb55/entities?sponsor=1"}},+ "node_modules/es-cookie": {+ "version": "1.3.2",+ "resolved": "https://registry.npmjs.org/es-cookie/-/es-cookie-1.3.2.tgz",+ "integrity": "sha512-UTlYYhXGLOy05P/vKVT2Ui7WtC7NiRzGtJyAKKn32g5Gvcjn7KAClLPWlipCtxIus934dFg9o9jXiBL0nP+t9Q==",+ "license": "MIT"+ },"node_modules/es-define-property": {"version": "1.0.1","resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",@@ -3260,9 +3343,9 @@}},"node_modules/i18next": {- "version": "26.3.6",- "resolved": "https://registry.npmjs.org/i18next/-/i18next-26.3.6.tgz",- "integrity": "sha512-Bu5Z2nAXgfVyM8xvW3jk9EKRIuX37PudsrBViThNFx7CR7aaYTpP01cxNB/E4c4UUzTDiAZRstEhsRfPOL/8xA==",+ "version": "26.4.2",+ "resolved": "https://registry.npmjs.org/i18next/-/i18next-26.4.2.tgz",+ "integrity": "sha512-RX+R0VLg13IbvRuJSxnqykUFS9vQZTl8wYpWPCIUDWVrSGjsQywB5Y+pjzrkboxGAuYfJZVH1InFTdgBdxq6ug==","funding": [{"type": "individual",@@ -3278,7 +3361,6 @@}],"license": "MIT",- "peer": true,"peerDependencies": {"typescript": "^5 || ^6 || ^7"},@@ -3438,11 +3520,19 @@"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==","dev": true,"license": "MIT",- "peer": true,"bin": {"jiti": "bin/jiti.js"}},+ "node_modules/jose": {+ "version": "6.2.10",+ "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.10.tgz",+ "integrity": "sha512-iiW7J9qRFlGxvCOIBDBDxFePQSn7ZMAnrYGhrrOo6siO/MIqwfyilLR27pkfDgUk+raLuzADS8A3S/KLBisc0g==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },"node_modules/js-tokens": {"version": "4.0.0","resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",@@ -3455,7 +3545,6 @@"integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"cssstyle": "^4.1.0","data-urls": "^5.0.0",@@ -3537,6 +3626,12 @@"dev": true,"license": "MIT"},+ "node_modules/lodash": {+ "version": "4.18.1",+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",+ "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==",+ "license": "MIT"+ },"node_modules/longest-streak": {"version": "3.1.0","resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",@@ -4560,6 +4655,15 @@"dev": true,"license": "MIT"},+ "node_modules/oauth4webapi": {+ "version": "3.8.7",+ "resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-3.8.7.tgz",+ "integrity": "sha512-4RxcKxXjuItDFZ20RRPf4YTw3kpeXJyCgJFxVzJ068A7PNJ18st2Dg90tlC1LkSDS0GecroagCLHYEIVUhCAkw==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },"node_modules/object-assign": {"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",@@ -4580,6 +4684,19 @@"node": ">= 6"}},+ "node_modules/openid-client": {+ "version": "6.8.7",+ "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-6.8.7.tgz",+ "integrity": "sha512-gtKthNu7evSBvTdrrlHb4F3Fi9dcwlb5QaITlCs+9mfpvuOi0Q3qtBf5+iY4sEP8hy1qCoAdxBNPDcmZeVSDzQ==",+ "license": "MIT",+ "dependencies": {+ "jose": "^6.2.8",+ "oauth4webapi": "^3.8.7"+ },+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },"node_modules/parse-entities": {"version": "4.0.2","resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz",@@ -4761,7 +4878,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"nanoid": "^3.3.12","picocolors": "^1.1.1",@@ -4966,7 +5082,6 @@"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz","integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==","license": "MIT",- "peer": true,"dependencies": {"loose-envify": "^1.1.0"},@@ -4979,7 +5094,6 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz","integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==","license": "MIT",- "peer": true,"dependencies": {"loose-envify": "^1.1.0","scheduler": "^0.23.2"@@ -4989,12 +5103,12 @@}},"node_modules/react-i18next": {- "version": "17.0.11",- "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-17.0.11.tgz",- "integrity": "sha512-cDtkXgxjuFTWUH6V+aQn1Ve5vDiUztCNPWW5GtSHDccsgRXO1nE6QFWCEmc1KAutrb3OUv87wFShJL5RhUwPXg==",+ "version": "17.0.14",+ "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-17.0.14.tgz",+ "integrity": "sha512-ZpMBfJL3BiXPuYHj5QMY1GwvKJNhE1vCxOJQ8BoMBdHP5XONTfi/Qss1nuRlnFdIl72PKo2jPmw+fxuLjRFgaQ==","license": "MIT","dependencies": {- "@babel/runtime": "^7.29.2",+ "@babel/runtime": "^7.29.7","html-parse-stringify": "^4.0.1","use-sync-external-store": "^1.6.0"},@@ -5559,7 +5673,6 @@"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==","dev": true,"license": "MIT",- "peer": true,"engines": {"node": ">=12"},@@ -5689,7 +5802,6 @@"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==","devOptional": true,"license": "Apache-2.0",- "peer": true,"bin": {"tsc": "bin/tsc","tsserver": "bin/tsserver"@@ -5817,9 +5929,9 @@}},"node_modules/use-sync-external-store": {- "version": "1.6.0",- "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",- "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",+ "version": "1.7.0",+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz",+ "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==","license": "MIT","peerDependencies": {"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"@@ -5866,7 +5978,6 @@"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "^0.21.3","postcss": "^8.4.43",diff --git a/surfaces/gui/package.json b/surfaces/gui/package.jsonindex aeceff89..d9e6a9f6 100644--- a/surfaces/gui/package.json+++ b/surfaces/gui/package.json@@ -9,11 +9,16 @@"preview": "vite preview","test": "vitest run","e2e": "playwright test",+ "gallery:contract": "UPDATE_CONTRACT=1 vitest run --config vitest.contract.config.ts","e2e:ui": "playwright test --ui","e2e:live": "playwright test -c playwright.live.config.ts","tauri": "tauri"},"dependencies": {+ "@auth0/auth0-spa-js": "^2.24.1",+ "@noble/ciphers": "^2.4.0",+ "@noble/curves": "^2.4.0",+ "@noble/hashes": "^2.4.0","i18next": "^26.3.6","pdfjs-dist": "^4.10.38","react": "^18.3.1",diff --git a/surfaces/gui/src-tauri/tauri.conf.json b/surfaces/gui/src-tauri/tauri.conf.jsonindex b16419f9..1983997d 100644--- a/surfaces/gui/src-tauri/tauri.conf.json+++ b/surfaces/gui/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "https://schema.tauri.app/config/2","productName": "OpenWorker",- "version": "0.2.1",+ "version": "0.2.3","identifier": "com.openworker.desktop","build": {"frontendDist": "../dist",diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsxindex 8a9d58b8..73a959c0 100644--- a/surfaces/gui/src/App.tsx+++ b/surfaces/gui/src/App.tsx@@ -26,19 +26,33 @@ import {getUnattended,PERSONAS_CHANGED,resolveInboxItem,+ routeInboxItemLike,deleteSession,+ getAllSessions,+ getCapabilities,+ getCloudMachines,+ getMachines,+ isCloudMode,+ getMachineSettings,+ setAppMode,+ setWalletAvailable,+ machineOfSession,+ registerSessionMachine,renameSession,runAutomation,- saveSessionAsProject,setSessionFlags,setUnattended,Session,type InboxItem,type MessageSource,+ type Machine,+ type ModelSettings,type Persona,type RecentWorkspace,type SurfaceVisibility,type WorkspaceCommandTrust,+ type TeamMemberDecision,+ API_UNAUTHORIZED,} from "./api";import type {ApprovalDecision,@@ -49,13 +63,19 @@ import type {TodoItem,WsEvent,} from "./types";+import {+ hasPendingApproval,+ initialSessionId,+ initialSettingsTab,+ reflectSession,+} from "./routes";import { fullPersonaName, isProjectScoped } from "./personaScope";import { baseName } from "./paths";import { itemsFromMessages } from "./itemsFromMessages";-import { addTurnUsage, emptyUsage, usageFromMessages } from "./usage";+import { addTurnUsage, emptyUsage, teamUsage, usageFromMessages } from "./usage";import { streamMode } from "./streamGate";import { InboxItemCard, approvalItemFromParked } from "./components/InboxItemCard";-import { chooseFolder, isTauri, platformOS, startWindowDrag } from "./tauri";+import { isTauri, platformOS, startWindowDrag } from "./tauri";import { Icon } from "./components/Icon";import { Sidebar } from "./components/Sidebar";import { ThinkingBlock, Transcript } from "./components/Transcript";@@ -70,13 +90,24 @@ import { Onboarding } from "./components/Onboarding";import { UpdateBanner } from "./components/UpdateBanner";import { ScheduledView } from "./components/ScheduledView";import { RightRail } from "./components/RightRail";-import { IntegrationsView } from "./components/IntegrationsView";-import { SettingsView } from "./components/SettingsView";+import { SettingsView, type SetTab } from "./components/SettingsView";import { PersonaView } from "./components/PersonaView";import { AuditView } from "./components/AuditView";import { InboxView } from "./components/InboxView";+import {+ approvalItemFromPayload,+ connectorItemFromPayload,+ directoryItemFromPayload,+ liveQuestionInboxItem,+ planItemFromPayload,+ questionItemFromPayload,+ teamItemFromPayload,+ toolItemFromPayload,+ workItemsItemFromPayload,+} from "./cardPayloads";import { ApprovalCard } from "./components/ApprovalCard";import { ToolRequestCard } from "./components/ToolRequestCard";+import { ConnectorRequestCard } from "./components/ConnectorRequestCard";import { DirectoryRequestCard } from "./components/DirectoryRequestCard";import { PlanCard } from "./components/PlanCard";import { BoardOverlay } from "./components/BoardPanel";@@ -249,6 +280,58 @@ export function App() {const [sessions, setSessions] = useState<SessionInfo[]>([]);const [projects, setProjects] = useState<RecentWorkspace[]>([]);const [sessionId, setSessionId] = useState<string>(newId());+ // Remote homes (UX-045): which joined machine the CURRENT session runs on+ // (null = This Mac). Fixed at creation via the setup row's runs-on chip;+ // restored from the session row on select/resume. Routes the session socket+ // over the bridged path and REST through the proxy prefix.+ const [machine, setMachine] = useState<string | null>(null);+ const [machines, setMachines] = useState<Machine[]>([]);+ // mode:"cloud" — this SPA is running against the acceptor-only service: no+ // local home, so local-only surfaces (folder pickers, This-Mac options)+ // don't exist and every session needs a machine.+ const [cloudMode, setCloudMode] = useState(false);+ // Remote homes: while viewing an offline machine's cached transcript, watch+ // for its return — reload the live transcript and reconnect the bridged+ // socket the moment the sessions refresh marks it back online.+ const currentRowOffline =+ sessions.find((s) => s.session_id === sessionId)?.machine_offline ?? false;+ const wasOfflineRef = useRef(false);+ useEffect(() => {+ if (wasOfflineRef.current && !currentRowOffline && machine) {+ getSessionMessages(sessionId)+ .then((m) => {+ setItems(itemsFromMessages(m));+ setUsage(usageFromMessages(m));+ })+ .catch(() => {});+ setConnectNonce((n) => n + 1);+ }+ wasOfflineRef.current = currentRowOffline;+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [currentRowOffline, machine, sessionId]);+ // Machine-scoped model picker (§Keys wallet W3): a draft on a machine offers+ // THAT machine's models — its keys, its config — loaded through the proxy.+ const [machineSettings, setMachineSettings] = useState<ModelSettings | null>(null);+ useEffect(() => {+ if (!machine) {+ setMachineSettings(null);+ return;+ }+ let stale = false;+ getMachineSettings(machine)+ .then((s) => {+ if (stale) return;+ setMachineSettings(s);+ // A fresh draft adopts the machine's default model; a resumed session's+ // `ready` event overrides with its own recorded model right after.+ if (s.model) setModel(s.model);+ })+ .catch(() => setMachineSettings(null));+ return () => {+ stale = true;+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [machine]);// Automation-run context (§ owner ask 2026-07-04): which task an open __run__ session belongs// to, driving the banner + "Back to runs". Best-effort — a run session without context still// shows a generic banner (detected by its __run__ id).@@ -260,12 +343,8 @@ export function App() {const [scheduledOpenId, setScheduledOpenId] = useState<string | null>(null);const [gateCreate, setGateCreate] = useState(false);// Which Settings section the full-page Settings surface opens on (§ Settings-as-page).- const [settingsTab, setSettingsTab] = useState<- "appearance" | "models" | "skills" | "voice" | "memory" | "personas"- >("appearance");- const openSettings = (- tab: "appearance" | "models" | "skills" | "voice" | "memory" | "personas" = "appearance",- ) => {+ const [settingsTab, setSettingsTab] = useState<SetTab>("appearance");+ const openSettings = (tab: SetTab = "appearance") => {setSettingsTab(tab);setSurface("settings");};@@ -274,23 +353,38 @@ export function App() {// load; corrected by loadSettings.const [modelReady, setModelReady] = useState(true);const [surface, setSurface] = useState<- "session" | "scheduled" | "integrations" | "audit" | "inbox" | "persona" | "settings"+ "session" | "scheduled" | "audit" | "inbox" | "persona" | "settings">("session");+ // The active session rides the URL (#/s/{id}) so refresh and bookmarks+ // come back here. Deep-link intent (approve) wins until consumed, and the+ // Settings surface reflects its own routes — leaving it hands the URL back.+ useEffect(() => {+ if (surface === "session") reflectSession(sessionId);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [sessionId, surface]);// A remembered Scheduled-detail target must not outlive the surface (see the// scheduledOpenId comment above): nav re-entry lands on the list, never a// possibly-deleted automation's dead detail.useEffect(() => {if (surface !== "scheduled") setScheduledOpenId(null);}, [surface]);+ // Machine scope the persona page was opened under (UX-046): its reads and+ // writes ride the proxy to that machine; null = the local engine.+ const [personaViewMachine, setPersonaViewMachine] = useState<string | null>(null);// The persona whose detail page is showing (surface === "persona"); empty falls back to the// active session's persona. Phase 5 wires the grouped-nav gear + "Manage personas…" entry points.const [personaViewId, setPersonaViewId] = useState<string>("");// Where the persona page returns on "back": the active session, or Settings ▸ Personas when it// was opened from there (persona config now lives in Settings).const [personaViewReturn, setPersonaViewReturn] = useState<"session" | "settings">("session");- const openPersona = (id: string, from: "session" | "settings" = "session") => {+ const openPersona = (+ id: string,+ from: "session" | "settings" = "session",+ machineId?: string | null,+ ) => {setPersonaViewReturn(from);setPersonaViewId(id);+ setPersonaViewMachine(machineId ?? null);setSurface("persona");};const [browserRefreshKey, setBrowserRefreshKey] = useState(0);@@ -481,8 +575,22 @@ export function App() {// Fetch ALL sessions + known projects so the sidebar can group them.const refreshSessions = useCallback(() => {- getSessions().then(setSessions).catch(() => setSessions([]));+ // Machine-aware: local sessions + every connected machine's, tagged ⌂.+ getAllSessions().then(setSessions).catch(() => setSessions([]));getRecentWorkspaces().then(setProjects).catch(() => setProjects([]));+ // Union view: local registry + (on a signed-in desktop) the cloud's rows,+ // origin-tagged. A cloud-session problem yields zero cloud rows — the+ // local list is never blocked by it.+ Promise.all([+ getMachines().catch(() => ({ machines: [] as Machine[] })),+ isCloudMode()+ ? Promise.resolve({ machines: [] as Machine[] })+ : getCloudMachines().catch(() => ({ machines: [] as Machine[] })),+ ])+ .then(([local, cloud]) =>+ setMachines([...(local.machines ?? []), ...(cloud.machines ?? [])]),+ )+ .catch(() => {});}, []);// initial: adopt the server's seed workspace if any, else force the gate.@@ -495,6 +603,14 @@ export function App() {// Latched: keep the boot splash up until the restored session is actually CONNECTED (not just// until `booting` clears), so an early click can't land on a session that's still settling.const [uiReady, setUiReady] = useState(false);+ // Our own backend rejected this window's launch token (see api.ts API_UNAUTHORIZED):+ // render a plain signed-out state — never the error body as if it were data.+ const [unauthorized, setUnauthorized] = useState(false);+ useEffect(() => {+ const on = () => setUnauthorized(true);+ window.addEventListener(API_UNAUTHORIZED, on);+ return () => window.removeEventListener(API_UNAUTHORIZED, on);+ }, []);// On boot with no seeded workspace, reopen the last thing the user had — most recent// conversation (restores its folder + agent + transcript), else the most recent project@@ -502,13 +618,19 @@ export function App() {const resumeLastOrGate = async () => {let loadedSessions: SessionInfo[] = [];try {- loadedSessions = (await getSessions()).filter((s) => s.session_id && !s.session_id.startsWith("__"));+ loadedSessions = (await getAllSessions()).filter((s) => s.session_id && !s.session_id.startsWith("__"));setSessions(loadedSessions);const sess = loadedSessions;const ts = (s: SessionInfo) => Date.parse(s.updated_at || "") || Number(s.updated_at) || 0;- const last = [...sess].sort((a, b) => ts(b) - ts(a))[0];+ // Deep link: #/s/{id} names the session to land on (bookmark/refresh);+ // fall back to the latest when it is gone.+ const wanted = initialSessionId;+ const last =+ (wanted && sess.find((s) => s.session_id === wanted)) ||+ [...sess].sort((a, b) => ts(b) - ts(a))[0];if (last) {setResumedExisting(true);+ setMachine(last.machine ?? null);if (last.agent) setAgent(last.agent);if (last.workspace) {setWorkspace(last.workspace);@@ -553,6 +675,18 @@ export function App() {getHealth().then(async (h) => {if (cancelled) return;+ // Deployment mode before anything renders post-boot: the same bundle+ // serves desktop and cloud; the backend says which one this is.+ const caps = await getCapabilities();+ if (cancelled) return;+ setAppMode(caps.mode);+ setWalletAvailable(caps.wallet);+ setCloudMode(caps.mode === "cloud");+ // #/approve/CODE deep link (the joiner prints it): land on the+ // approval surface before anything else grabs attention. Otherwise+ // a #/settings/{page} link opens Settings on that page.+ if (hasPendingApproval()) openSettings("machines");+ else if (initialSettingsTab) openSettings(initialSettingsTab as SetTab);setModel(h.model);// First-run setup wizard (desktop): show until the user completes/dismisses it.if (isTauri()) {@@ -660,6 +794,24 @@ export function App() {// eslint-disable-next-line react-hooks/exhaustive-deps}, [agent, personas]);+ // Models per coworker (connectors-across-machines §4): a `models:` list restricts the+ // composer picker to the list — unrunnable entries stay visible with a note — and a+ // fresh draft binds to the first entry this machine can run. Availability = the+ // machine's own selectable list (its keys, its Ollama); a draft on a remote machine+ // asks that machine's list, like the picker already does.+ const personaModels = personaOf(agent)?.models ?? [];+ const selectableModels = machine ? machineSettings?.models || [] : models;+ const pickerModels = personaModels.length ? personaModels : selectableModels;+ const unavailableModels = personaModels.filter((m) => !selectableModels.includes(m));+ const selectableKey = selectableModels.join("|");+ useEffect(() => {+ if (!personaModels.length || items.length > 0 || running) return;+ if (personaModels.includes(model)) return;+ const first = personaModels.find((m) => selectableModels.includes(m)) ?? personaModels[0];+ if (first) changeModel(first);+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [agent, personas, items.length, running, selectableKey]);+useEffect(() => {if (surface === "session") rememberLastSession(agent, sessionId, workspace);}, [surface, agent, sessionId, workspace]);@@ -668,6 +820,11 @@ export function App() {useEffect(() => {if (booting) return; // wait until boot/resume settles the session before connectingif (gatesWorkspace(agent) && !workspace) return; // Code needs a folder (gate handles it)+ // Hosted dashboard: the controller has no engine of its own, so a draft+ // with no machine chosen has nothing to connect to — opening the socket+ // would only loop on a refusal and show a "reconnecting" strip on a+ // brand-new session (owner-hit 2026-09-02). The runs-on chip is the gate.+ if (isCloudMode() && !machine) return;const handleEvent = (ev: WsEvent) => {const d = ev.data || {};// An interrupted/errored turn never emits assistant_message, so its streamed partial@@ -776,89 +933,38 @@ export function App() {case "permission_required":// Unattended → the backend parked it in the Inbox; don't also surface a live card.if (unattendedRef.current) break;- setItems((p) => [- ...p,- {- kind: "approval",- name: d.name,- args: d.arguments,- reason: d.reason,- category: d.category,- standingTarget: d.standing_target || undefined,- searchProvider: d.search_provider || undefined,- provenance: d.provenance || undefined,- reviewerUnsure: d.reviewer_unsure || undefined,- readonlyOk: !!d.readonly_ok,- mcpDestination: d.mcp_destination || undefined,- },- ]);+ setItems((p) => [...p, approvalItemFromPayload(d)]);break;case "directory_requested":if (unattendedRef.current) break;- setItems((p) => [- ...p,- { kind: "dirreq", reason: d.reason || "", path: d.path || "", writable: !!d.writable, primary: !!d.primary },- ]);+ setItems((p) => [...p, directoryItemFromPayload(d)]);break;case "tool_requested":if (unattendedRef.current) break;- setItems((p) => [- ...p,- {- kind: "toolreq",- tool: d.name || "",- reason: d.reason || "",- // Fail CLOSED: only offer Install when the event says a pinned build exists.- installable: d.installable === true,- version: d.version || "",- summary: d.summary || "",- source: d.source || "",- },- ]);+ setItems((p) => [...p, toolItemFromPayload(d)]);break;case "plan_proposed":if (unattendedRef.current) break;- setItems((p) => [...p, { kind: "planreq", plan: d.plan || "" }]);+ setItems((p) => [...p, planItemFromPayload(d)]);break;case "team_proposed":// The staffing gate (agent teams) — approval pre-spawns the worker sessions.if (unattendedRef.current) break;- setItems((p) => [- ...p,- {- kind: "teamreq",- members: Array.isArray(d.members) ? d.members : [],- enable_chat: !!d.enable_chat,- note: d.note || "",- },- ]);+ setItems((p) => [...p, teamItemFromPayload(d)]);+ break;+ case "connector_requested":+ // Spec §11.6: connect a service / grant a worker a connector — a human decision.+ if (unattendedRef.current) break;+ setItems((p) => [...p, connectorItemFromPayload(d)]);break;case "items_proposed":// The decomposition gate — approval creates the items on the board.if (unattendedRef.current) break;- setItems((p) => [- ...p,- {- kind: "itemsreq",- items: Array.isArray(d.items) ? d.items : [],- note: d.note || "",- },- ]);+ setItems((p) => [...p, workItemsItemFromPayload(d)]);break;case "question_requested":// ask_user in an attended session — answered inline (not routed to the Inbox).- setItems((p) => [- ...p,- {- kind: "question",- question: d.question || "",- options: d.options || [],- allow_text: d.allow_text !== false,- multi: !!d.multi,- header: d.header || "",- questions: d.questions || [],- },- ]);+ setItems((p) => [...p, questionItemFromPayload(d)]);break;case "tool_finished":setItems((p) =>@@ -978,10 +1084,29 @@ export function App() {}};+ // Remote homes: register the draft's machine binding before connecting, so the+ // session-scoped REST helpers (messages on reopen, bindings, skills) route+ // through the proxy prefix from the very first turn. For remote sessions the+ // workspace state only ever holds paths ON that machine (typed/validated,+ // box recents, or a box-provisioned temp — the local picker is hidden).+ registerSessionMachine(sessionId, machine);const session = new Session(sessionId, workspace || "", agent, {onEvent: handleEvent,- onOpen: () => {+ onOpen: (reconnected) => {setConnected(true);+ if (reconnected) {+ // The socket came back after a drop: anything the engine did meanwhile+ // (turn tail, a prompt it parked and we promoted to the Inbox) is on the+ // server, not in this view — reload rather than trust the stream.+ getSessionMessages(sessionId)+ .then((m) => {+ setItems(itemsFromMessages(m));+ setUsage(usageFromMessages(m));+ })+ .catch(() => {});+ getInbox(sessionId, "pending").then(setSessionInbox).catch(() => {});+ return;+ }// Auto-send the pending message once the session connects ("Run now" prompts and// UX-029's deferred first send).const p = pendingPromptRef.current;@@ -999,7 +1124,7 @@ export function App() {}},onClose: () => setConnected(false),- });+ }, machine);sessionRef.current = session;return () => session.close();// NOTE: `workspace` is intentionally NOT a dependency. Every real workspace change@@ -1010,7 +1135,7 @@ export function App() {// first connect, dropping the user's first message (the "send twice" bug). The scratch// dir is deterministic from `sessionId` server-side, so skipping that reconnect is safe.// eslint-disable-next-line react-hooks/exhaustive-deps- }, [booting, sessionId, agent, refreshSessions, connectNonce]);+ }, [booting, sessionId, agent, machine, refreshSessions, connectNonce]);// Stream-following (FB-004): auto-scroll only while the user is AT the bottom, so scrolling// up to read during a streaming turn sticks. `atBottomRef` is the live truth (per scroll@@ -1168,10 +1293,20 @@ export function App() {sessionRef.current?.respondPlan(approved, mode, feedback);if (approved && mode) setMode(mode); // the server flips the live engine to this mode};- const respondTeam = (approved: boolean, feedback?: string, enableChat?: boolean) => {+ const respondTeam = (+ approved: boolean,+ feedback?: string,+ enableChat?: boolean,+ members?: TeamMemberDecision[],+ ) => {setItems((p) => resolveLastTeam(p, approved ? "approved" : "rejected"));dropSessionInbox("plan"); // the gate parks as a plan-kind Inbox item- sessionRef.current?.respondTeam(approved, feedback, enableChat);+ sessionRef.current?.respondTeam(approved, feedback, enableChat, members);+ };+ const respondConnector = (approved: boolean) => {+ setItems((p) => resolveLastConnReq(p, approved ? "approved" : "declined"));+ dropSessionInbox("connector");+ sessionRef.current?.respondConnector(approved);};const respondItemsReq = (approved: boolean, feedback?: string) => {setItems((p) => resolveLastItemsReq(p, approved ? "approved" : "rejected"));@@ -1216,6 +1351,7 @@ export function App() {const startNewSession = (forAgent?: string) => {const target = forAgent || agent;setSurface("session"); // return to the conversation view if we were on a sub-view+ setMachine(null); // a fresh draft starts on This Mac; the runs-on chip re-targets itsetItems([]);setUsage(emptyUsage());setStreaming("");@@ -1291,7 +1427,7 @@ export function App() {const gate = sendGate;if (!gate) return;const sid = newId();- const res = await createTempWorkspace(sid, true);+ const res = await createTempWorkspace(sid, true, machine);if (!res.ok || !res.path) {setSendGate(null);setItems((p) => [@@ -1320,29 +1456,6 @@ export function App() {};// UX-029 "Save as project…": move the temporary folder somewhere real, then reconnect// so the engine rebinds to the new path (same session id — the transcript stays).- const saveAsProject = async () => {- if (running) return;- const dest = await chooseFolder();- if (!dest) return;- const res = await saveSessionAsProject(sessionId, dest);- if (!res.ok || !res.path) {- setItems((p) => [- ...p,- { kind: "notice", tone: "warn", text: res.error || t("app.save_project_failed") },- ]);- return;- }- const newPath = res.path;- setWorkspace(newPath);- setBranch(null);- setTempWorkspace(false);- setItems((p) => [- ...p,- { kind: "notice", tone: "info", text: t("app.saved_as_project", { name: baseName(newPath) }) },- ]);- setConnectNonce((n) => n + 1);- refreshSessions();- };// Inbox → session: the item carries its session's workspace/agent, so open it directly.// UX-026: 5s top-right toast when a SCHEDULED automation run starts (never for// manual Run-now — the user is already watching). Rides the app-wide /ws/events@@ -1398,7 +1511,40 @@ export function App() {setWorkspace(ws); // switch project to the session's foldersetBranch(null);}+ // Remote homes: adopt the session's machine BEFORE the socket effect fires, so+ // the reconnect rides the bridged path (row tag first, routing map as fallback).+ const row = sessions.find((s) => s.session_id === id);+ setMachine(row?.machine ?? machineOfSession(id));setSessionId(id);+ if (row?.machine_offline) {+ // Offline box: show the last synced transcript READ-ONLY (desktop+ // cache-on-view, owner amendment 2026-08-25). The composer stays inert+ // because the bridged socket can't connect. No cached copy yet → explain.+ const offlineNotice: Item = {+ kind: "notice",+ tone: "info",+ text: t("misc.app.offline_readonly", { name: row.machine_name || t("misc.app.this_machine") }),+ };+ try {+ const messages = await getSessionMessages(id);+ if (messages.length) {+ setItems([...itemsFromMessages(messages), offlineNotice]);+ setUsage(usageFromMessages(messages));+ return;+ }+ } catch {+ /* fall through to the explainer */+ }+ setItems([+ {+ kind: "notice",+ tone: "info",+ text: t("misc.app.offline_explainer", { name: row.machine_name || t("misc.app.this_machine") }),+ },+ ]);+ setUsage(emptyUsage());+ return;+ }try {const messages = await getSessionMessages(id);setItems(itemsFromMessages(messages));@@ -1562,6 +1708,7 @@ export function App() {const pendingApproval = [...items].reverse().find((i) => i.kind === "approval" && !i.resolved);const pendingDirReq = [...items].reverse().find((i) => i.kind === "dirreq" && !i.resolved);const pendingToolReq = [...items].reverse().find((i) => i.kind === "toolreq" && !i.resolved);+ const pendingConnReq = [...items].reverse().find((i) => i.kind === "connreq" && !i.resolved);const pendingPlan = [...items].reverse().find((i) => i.kind === "planreq" && !i.resolved);const pendingTeam = [...items].reverse().find((i) => i.kind === "teamreq" && !i.resolved);const pendingItemsReq = [...items].reverse().find((i) => i.kind === "itemsreq" && !i.resolved);@@ -1574,14 +1721,13 @@ export function App() {// noise in a facts line. Fall back to the raw id without its provider prefix.const modelDisplay =modelLabels[model]?.split(" · ")[0] ||- (model.includes(":") ? model.split(":").slice(1).join(":") : model);+ ((model || "").includes(":") ? model.split(":").slice(1).join(":") : model || "");// UX-029: with the coworker picker shipping, the coworker's name is a fixed fact again// (it was dropped 2026-07-22 while personas were hidden). For temporary folders the raw// path never shows — "Temporary folder" + the Save as project… affordance instead.const subtitleParts = [fullPersonaName(personaOf(agent)?.name, agent), modelDisplay];if (isProjectScoped(personaOf(agent)) && workspace)subtitleParts.push(tempWorkspace ? t("root.temporary_space") : baseName(workspace));- const showSaveAsProject = hasHistory && tempWorkspace && isProjectScoped(personaOf(agent));const activeInfo = sessions.find((s) => s.session_id === sessionId);const activeTitle = activeInfo?.title || t("sidebar.new_session");@@ -1599,6 +1745,25 @@ export function App() {startWindowDrag();};+ if (unauthorized) {+ return (+ <div className="app boot-splash" data-testid="unauthorized-gate">+ <div className="boot-mark">+ <Icon name="logo" size={28} className="mark" />+ </div>+ <div className="unauthorized-card">+ <div className="unauthorized-title">{t("misc.app.unauthorized_title")}</div>+ <div className="unauthorized-body">+ {t("misc.app.unauthorized_body")}+ </div>+ <button className="btn" onClick={() => window.location.reload()}>+ {t("misc.app.reload")}+ </button>+ </div>+ </div>+ );+ }+if (booting || !uiReady) {return (<div className={"app boot-splash" + (overlay ? " tauri-overlay" : "")}>@@ -1607,7 +1772,7 @@ export function App() {{overlay && (<div className="titlebar-drag" data-tauri-drag-region><span className="titlebar-brand brand-wordmark">- <Icon name="logo" size={13} className="mark" /> OpenWorker<span className="beta-tag">BETA</span>+ <Icon name="logo" size={13} className="mark" /> OpenWorker<span className="beta-tag">beta</span></span></div>)}@@ -1623,7 +1788,7 @@ export function App() {</div><div className="boot-text">{resumedExisting ? t("boot.restoring") : t("boot.starting")}- <span className="beta-tag">BETA</span>+ <span className="beta-tag">beta</span></div></div>);@@ -1653,16 +1818,16 @@ export function App() {className="fixed top-3 right-3 z-[45] w-[290px] bg-panel border border-line rounded-xl shadow-lg px-3.5 pt-3 pb-2.5"data-testid="automation-toast">- <div className="flex items-center gap-2 text-[13px] font-semibold">+ <div className="flex items-center gap-2 text-ui font-semibold"><span className="w-[7px] h-[7px] rounded-full bg-faint toast-pulse" />{t("toast.automation_started")}</div>- <div className="text-[13px] text-muted mt-0.5 ml-[15px] truncate">+ <div className="text-ui text-muted mt-0.5 ml-[15px] truncate">{runToast.title} · {runToast.time} {t("toast.run_count")}</div><div className="flex items-center justify-between ml-[15px] mt-1.5"><button- className="text-[13px] text-accent font-medium"+ className="text-ui text-accent font-medium"data-testid="toast-view-run"onClick={() => {selectSession(runToast.sessionId, runToast.workspace, runToast.agent);@@ -1672,7 +1837,7 @@ export function App() {{t("toast.view_run")} ›</button><button- className="text-[12px] text-faint px-0.5"+ className="text-meta text-faint px-0.5"data-testid="toast-dismiss"title={t("common.dismiss")}onClick={() => setRunToast(null)}@@ -1729,6 +1894,8 @@ export function App() {/>)}<Sidebar+ settingsRail={surface === "settings"}+ machines={machines}agent={agent}workspace={workspace || ""}surfaces={surfaces}@@ -1736,6 +1903,7 @@ export function App() {projects={projects}activeSession={sessionId}onSwitchAgent={switchAgent}+ hasMachines={machines.length > 0}onNewSession={startNewSession}onSelectSession={selectSession}onNewProject={newProject}@@ -1752,11 +1920,11 @@ export function App() {setScheduledOpenId(id);setSurface("scheduled");}}- onOpenIntegrations={() => setSurface("integrations")}+ onOpenIntegrations={() => openSettings("connectors")}onOpenAudit={() => setSurface("audit")}onOpenInbox={() => setSurface("inbox")}scheduledActive={surface === "scheduled"}- integrationsActive={surface === "integrations"}+ integrationsActive={surface === "settings" && settingsTab === "connectors"}auditActive={surface === "audit"}inboxActive={surface === "inbox"}collapsed={navCollapsed}@@ -1769,18 +1937,27 @@ export function App() {onRunNow={runTaskNow}initialOpenId={scheduledOpenId}/>- ) : surface === "integrations" ? (- <IntegrationsView />) : surface === "settings" ? (<SettingsViewkey={settingsTab}initialTab={settingsTab}- onOpenPersona={(id) => openPersona(id, "settings")}- onCreateSkill={(description) => {+ onBack={() => setSurface("session")}+ onOpenPersona={(id, machineId) => openPersona(id, "settings", machineId)}+ onAskWorker={(machineId) => {+ // Memory's remote CTA: the conversation IS the edit surface — a+ // fresh draft on that machine, prompt started.+ startNewSession();+ setMachine(machineId);+ prefillComposer(t("misc.app.memory_prefill"));+ }}+ onCreateSkill={(description, machineId) => {// The Skills doorway (SKILLS-SPEC §5.2): creation is a conversation. Fresh// session, description in the composer — the user reads and hits send. With// no description, the prefill invites them to finish the sentence there.+ // A machine scope makes the conversation run ON that machine, so the+ // skill materializes where it was being managed.startNewSession();+ if (machineId) setMachine(machineId);prefillComposer(description? t("app.build_skill_prefill", { description })@@ -1794,11 +1971,12 @@ export function App() {<InboxView onOpenSession={openSessionFromInbox} />) : surface === "persona" ? (<PersonaView+ machine={machines.find((m) => m.id === personaViewMachine) ?? null}personaId={personaViewId || agent}onBack={() =>personaViewReturn === "settings" ? openSettings("personas") : setSurface("session")}- onOpenIntegrations={() => setSurface("integrations")}+ onOpenIntegrations={() => openSettings("connectors")}/>) : (<div className={"main" + (surface === "session" && agent !== "chat" && !railHidden ? " rail-open" : "")}>@@ -1847,32 +2025,17 @@ export function App() {hover cluster owns pin/rename/archive/delete). The title stays: with the sidebarcollapsed it is the only session identifier, and it anchors the subtitle. */}<div className="main-title" onPointerDown={beginWindowDrag}>+ {/* UX-048: title only. The facts (coworker · model · folder) moved into the+ title's tooltip once the session has history; the model is always visible in+ the composer pill. "Save as project…" was dropped with the subtitle (owner+ 2026-09-03) — promotion stays available through the directory-request tool. */}<spanclassName={"main-title-text" + (activeInfo ? "" : " title-ghost")}- title={activeTitle}+ title={hasHistory ? `${activeTitle}\n${subtitleParts.join(" · ")}` : activeTitle}+ data-testid="session-title">{activeTitle}</span>- {/* Plain facts, no affordance: the persona page it used to open is hidden for- this release (owner ask 2026-07-22). */}- {hasHistory && (- <span className="title-sub" data-testid="session-subtitle">- {subtitleParts.join(" · ")}- {showSaveAsProject && (- <>- {" · "}- <button- className="text-accent hover:underline"- data-testid="save-as-project"- onMouseDown={(e) => e.stopPropagation()}- onClick={() => void saveAsProject()}- >- {t("app.save_as_project")}- </button>- </>- )}- </span>- )}</div>{/* Right: session-settings icon (§23) + panel toggle. Model/mode/persona chrome isgone — the facts live in the subtitle, the controls in the composer (§22). */}@@ -1907,7 +2070,7 @@ export function App() {{/* # team chat replaces the session view in place (owner ask 2026-08-16 —not a modal): the sidebar stays live, Esc/back returns to the session. */}{chatTeam && surface === "session" && (- <TeamChatView teamId={chatTeam} onClose={() => setChatTeam(null)} />+ <TeamChatView teamId={chatTeam} sessionId={sessionId} onClose={() => setChatTeam(null)} />)}<div className={"main-workspace" + (railHidden ? " rail-hidden" : "")}><div className="main-chat">@@ -1917,7 +2080,7 @@ export function App() {it underneath the topbar; owner-reported CSS bug). */}{sessionId.startsWith("__run__") && (<div- className="flex items-center gap-2 px-4 py-2 mb-1 rounded-lg text-[13px] border border-line bg-accentSoft/40"+ className="flex items-center gap-2 px-4 py-2 mb-1 rounded-lg text-ui border border-line bg-accentSoft/40"data-testid="run-banner"><Icon name="clock" size={14} className="text-accent shrink-0" />@@ -1976,7 +2139,7 @@ export function App() {onApprove={approve}running={running}onRetry={retry}- onOpenConnectors={() => setSurface("integrations")}+ onOpenConnectors={() => openSettings("connectors")}onAllowAnyway={allowAnyway}onUndoMemory={(id, previous) => void undoMemorySave(id, previous)}// §33 ref #3: sub-threshold streamed text renders INSIDE the live turn@@ -2019,7 +2182,7 @@ export function App() {{!following && (running || !!streaming) && (<div className="relative h-0 z-10"><button- className="absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1.5 rounded-full border border-line bg-panel shadow-md text-[12px] text-muted hover:text-ink cursor-pointer whitespace-nowrap"+ className="absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1.5 rounded-full border border-line bg-panel shadow-md text-meta text-muted hover:text-ink cursor-pointer whitespace-nowrap"data-testid="jump-to-latest"onClick={followLatest}>@@ -2037,8 +2200,21 @@ export function App() {<SessionSetupRowpersonas={personas}agent={agent}- showFolder+ showFolder={!machine && !cloudMode}folderName={workspace && !tempWorkspace ? baseName(workspace) : null}+ machines={machines}+ machine={machine}+ cloud={cloudMode}+ onPickMachine={(id) => {+ setMachine(id);+ // A remote draft never carries a LOCAL folder — the box provisions+ // its own scratch (remote folder browsing is a follow-up).+ if (id) {+ setWorkspace(null);+ setBranch(null);+ setShowGate(false);+ }+ }}onPickCoworker={pickCoworker}onPickFolder={pickDraftFolder}onManage={() => openSettings("personas")}@@ -2078,15 +2254,42 @@ export function App() {</button></div>)}+ {!connected && !booting && !currentRowOffline && !(isCloudMode() && !machine) && (+ <div className="reconnecting-strip" data-testid="session-reconnecting" role="status">+ {machine ? t("misc.app.machine_reconnecting") : t("misc.app.reconnecting")}+ <span className="reconnecting-sub">+ {machine+ ? t("misc.app.machine_reconnecting_sub")+ : t("misc.app.reconnecting_sub")}+ </span>+ </div>+ )}<Composermode={mode}+ // §11.6: a worker's approvals follow its lead — the picker is read-only for it.+ followsLead={curSession?.team?.role === "worker"}model={model}- models={models}- modelLabels={modelLabels}+ models={pickerModels}+ unavailableModels={unavailableModels}+ wantedModels={personaModels}+ modelLabels={machine ? machineSettings?.model_labels || {} : modelLabels}running={running}gateOpen={!unattended && (!!pendingTeam || !!pendingItemsReq)}- connected={connected}- modelReady={modelReady}+ // An offline machine's cached transcript is read-only: the send+ // path is dead by construction, so say so explicitly rather than+ // letting a hopeful socket state enable the button.+ connected={connected && !currentRowOffline}+ // A draft on a machine asks THAT machine's readiness (its keys,+ // its config), like the models/labels above; the controller's+ // own flag is desktop-only (the cloud shim always says false).+ // While machine settings load, stay true — same no-flash default+ // as the desktop boot.+ modelReady={+ (machine ? (machineSettings ? machineSettings.model_ready : true) : modelReady) &&+ // A coworker bound to a model this machine cannot run shows the honest+ // "No model" state, whatever the machine default says.+ !(personaModels.length > 0 && unavailableModels.includes(model))+ }onConnectModel={openModelSetup}onOpenMemory={() => openSettings("memory")}onConfigureVoiceInput={() => openSettings("voice")}@@ -2119,9 +2322,20 @@ export function App() {) : !unattended && pendingItemsReq?.kind === "itemsreq" ? (<WorkItemsCard item={pendingItemsReq} onRespond={respondItemsReq} />) : !unattended && pendingTeam?.kind === "teamreq" ? (- <TeamRequestCard item={pendingTeam} onRespond={respondTeam} />+ <TeamRequestCard+ item={pendingTeam}+ leadMode={mode}+ modelLabels={machine ? machineSettings?.model_labels || {} : modelLabels}+ onRespond={respondTeam}+ />) : !unattended && pendingToolReq?.kind === "toolreq" ? (<ToolRequestCard item={pendingToolReq} onRespond={respondTool} />+ ) : !unattended && pendingConnReq?.kind === "connreq" ? (+ <ConnectorRequestCard+ item={pendingConnReq}+ onRespond={respondConnector}+ onOpenConnectors={() => openSettings("connectors")}+ />) : !unattended && pendingDirReq?.kind === "dirreq" ? (<DirectoryRequestCard item={pendingDirReq} onRespond={respondDirectory} />) : !unattended && pendingApproval?.kind === "approval" ? (@@ -2130,28 +2344,17 @@ export function App() {onApprove={approve}runTask={runContext}autoApprove={mode === "auto-approve"}+ onAnswerWorkerCall={(callId, resolution) => {+ // The human overrides the lead: answer the worker's waiting call itself.+ routeInboxItemLike(callId, { sessionId });+ resolveInboxItem(callId, resolution).catch(() => {});+ }}compact/>) : !unattended && pendingQuestion?.kind === "question" ? (// Live ask_user in an attended session — answer inline (reuses the Inbox card UI).<InboxItemCard- item={{- id: "live-question",- session_id: sessionId,- kind: "question",- title: pendingQuestion.question,- body: "",- state: "pending",- resolution: null,- inbox: "default",- created_at: "",- resolved_at: null,- options: pendingQuestion.options,- allow_text: pendingQuestion.allow_text,- multi: pendingQuestion.multi,- header: pendingQuestion.header,- questions: pendingQuestion.questions,- }}+ item={liveQuestionInboxItem(pendingQuestion, sessionId)}onResolve={(_id, answer) => answerQuestion(answer)}compact/>@@ -2160,10 +2363,12 @@ export function App() {// APPROVAL with tool data renders through the REAL ApprovalCard (OPE-136:// one renderer, no second dress to drift out of evidence or buttons); its// decisions resolve through the same server-validated vocabulary as the- // live path. Everything else keeps the Inbox card.+ // live path. A lead's decision on a worker's call, and everything else,+ // keeps the Inbox card (it answers the worker's item on an override).(() => {- const parked = approvalItemFromParked(sessionInbox[0]);const d = sessionInbox[0].data;+ const parked =+ d?.tool === "decide_worker_call" ? null : approvalItemFromParked(sessionInbox[0]);return parked ? (<ApprovalCarditem={parked}@@ -2179,7 +2384,12 @@ export function App() {compact/>) : (- <InboxItemCard item={sessionInbox[0]} onResolve={resolveSessionInbox} compact />+ <InboxItemCard+ item={sessionInbox[0]}+ onResolve={resolveSessionInbox}+ modelLabels={machine ? machineSettings?.model_labels || {} : modelLabels}+ compact+ />);})()) : undefined@@ -2203,7 +2413,7 @@ export function App() {branch={branch}scratchPrimary={tempWorkspace || !isProjectScoped(personaOf(agent))}openAccessKey={accessKey}- onOpenIntegrations={() => setSurface("integrations")}+ onOpenIntegrations={() => openSettings("connectors")}board={board}onExpandBoard={() => setBoardOpen(true)}onOpenBoardItem={(id) => {@@ -2220,6 +2430,7 @@ export function App() {teamMembers={teamMembers}teamChatEnabled={!!curSession?.team?.chat_enabled}teamChatUnread={curSession?.team?.chat_unread || 0}+ teamUsage={teamMembers.length ? teamUsage(usage, teamMembers) : undefined}onOpenTeamChat={() => setChatTeam(curSession?.team?.team_id || "")}onOpenWorker={(w) => void selectSession(w.session_id, w.workspace, w.agent)}openBoardKey={boardRailKey}@@ -2279,6 +2490,7 @@ export function App() {{sendGate && surface === "session" && (<SendFolderDialogcoworkerName={fullPersonaName(personaOf(agent)?.name, agent)}+ machine={machine ? machines.find((m) => m.id === machine) ?? null : null}onPick={resolveSendFolder}onTemp={() => void startTempAndSend()}onCancel={cancelSendGate}@@ -2422,6 +2634,18 @@ function resolveLastTeam(items: Item[], resolved: "approved" | "rejected"): Itemreturn copy;}+function resolveLastConnReq(items: Item[], resolved: "approved" | "declined"): Item[] {+ const copy = [...items];+ for (let i = copy.length - 1; i >= 0; i--) {+ const it = copy[i];+ if (it.kind === "connreq" && !it.resolved) {+ copy[i] = { ...it, resolved };+ break;+ }+ }+ return copy;+}+function resolveLastItemsReq(items: Item[], resolved: "approved" | "rejected"): Item[] {const copy = [...items];for (let i = copy.length - 1; i >= 0; i--) {diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.tsindex a69e0cec..dda3fc10 100644--- a/surfaces/gui/src/api.ts+++ b/surfaces/gui/src/api.ts@@ -1,25 +1,65 @@+import i18n from "i18next";+import {+ approvalMessage,+ connectorResponseMessage,+ directoryResponseMessage,+ itemsResponseMessage,+ planResponseMessage,+ questionResponseMessage,+ teamResponseMessage,+ toolResponseMessage,+} from "./cardPayloads";import type { GroupedQuestion, QuestionOption, SessionInfo, WsEvent } from "./types";declare const __COWORKER_DEV_TOKEN__: string;// Endpoint resolution order: runtime-injected globals (Tauri sets `window.__COWORKER_HTTP__`-// for its dynamically-chosen sidecar port) → Vite env → the 127.0.0.1:8765 dev default. This-// keeps a single codebase: browser `npm run dev` hits 8765; the desktop shell hits its sidecar.-const httpBase = (): string =>+// for its dynamically-chosen sidecar port) → Vite env → same-origin when the page itself is+// served over https (the hosted dashboard: the service serves both SPA and API) → the+// 127.0.0.1:8765 dev default. This keeps a single codebase: browser `npm run dev` hits 8765;+// the desktop shell hits its sidecar; machines.openworker.com talks to itself.+const servedOverHttps = (): boolean =>+ typeof location !== "undefined" && location.protocol === "https:";+export const httpBase = (): string =>(globalThis as any).__COWORKER_HTTP__ ||(import.meta as any).env?.VITE_COWORKER_HTTP ||- "http://127.0.0.1:8765";+ (servedOverHttps() ? location.origin : "http://127.0.0.1:8765");const wsBase = (): string =>(globalThis as any).__COWORKER_WS__ ||(import.meta as any).env?.VITE_COWORKER_WS ||- "ws://127.0.0.1:8765";+ (servedOverHttps() ? `wss://${location.host}` : "ws://127.0.0.1:8765");const apiToken = (): string =>(globalThis as any).__COWORKER_API_TOKEN__ ||(import.meta as any).env?.VITE_COWORKER_API_TOKEN ||(typeof __COWORKER_DEV_TOKEN__ === "string" ? __COWORKER_DEV_TOKEN__ : "");+// The org this browser acts in (hosted multi-tenant only; empty elsewhere). Set at cloud+// boot from /v1/me and by the org switcher; rides every request so the backend's resolver+// needs no per-endpoint plumbing. HTTP carries it as a header; a browser WebSocket cannot+// set headers, so there it is a query parameter (org ids are tenant labels, not secrets).+let activeOrg = "";+export function setActiveOrg(orgId: string): void {+ activeOrg = orgId;+}+export function getActiveOrg(): string {+ return activeOrg;+}+// All local REST calls pass through this module, so a module-local wrapper applies launch// authentication without asking every endpoint helper to remember the security header.+/** Fired (once per burst) when OUR OWN backend answers 401: the launch token this+ * window carries no longer matches the running service — a sidecar restarted under a+ * dev GUI that baked the old token, or a stale tab. The App renders a plain signed-out+ * state instead of crashing on the error body (ledger 2026-09-01: `undefined.includes`). */+export const API_UNAUTHORIZED = "openworker:api-unauthorized";+let unauthorizedAnnounced = 0;+const announceUnauthorized = () => {+ const now = Date.now();+ if (now - unauthorizedAnnounced < 2000) return;+ unauthorizedAnnounced = now;+ window.dispatchEvent(new CustomEvent(API_UNAUTHORIZED));+};+const fetch = (input: RequestInfo | URL,init: RequestInit = {},@@ -27,14 +67,83 @@ const fetch = (const headers = new Headers(init.headers);const token = apiToken();if (token) headers.set("X-OpenWorker-Token", token);- return globalThis.fetch(input, { ...init, headers });+ if (activeOrg) headers.set("X-OCW-Org", activeOrg);+ return globalThis.fetch(input, { ...init, headers }).then((res) => {+ // Only the local sidecar's own 401 means "this window is signed out". A machine or+ // cloud call (/m/… proxies, cloud routes) returning 401 is that machine's problem+ // and is handled where the call is made.+ const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;+ if (res.status === 401 && url.startsWith(httpBase()) && !url.includes("/v1/machines/") && !url.includes("/v1/cloud/")) {+ announceUnauthorized();+ }+ return res;+ });};+// A Sec-WebSocket-Protocol entry must be an RFC 6455 token — no '@', '=', etc.+// Desktop tokens (hex) and Auth0 JWTs (base64url + dots) qualify; anything else+// (dev/test tokens) rides a base64url envelope the backend unwraps. Passing an+// invalid subprotocol would THROW from the constructor and blank the render.+const WS_TOKEN_SAFE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;+const wsSafeToken = (token: string): string =>+ WS_TOKEN_SAFE.test(token)+ ? token+ : "ow.b64." ++ btoa(token).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");+const openWebSocket = (url: string): WebSocket => {const token = apiToken();+ const target = activeOrg+ ? `${url}${url.includes("?") ? "&" : "?"}org=${encodeURIComponent(activeOrg)}`+ : url;return token- ? new WebSocket(url, ["openworker", token])- : new WebSocket(url);+ ? new WebSocket(target, ["openworker", wsSafeToken(token)])+ : new WebSocket(target);+};++// -- remote homes: machine-aware session routing (remote-home-design.md P1c) ---+// A session that lives on a joined machine is reached through the controller's+// proxy prefix — "a machine is just a different base URL". This module-local map+// (fed by getAllSessions and session creation) lets every session-scoped helper+// below route transparently; unknown sessions resolve to the local sidecar.+const sessionMachines = new Map<string, string>();++export function registerSessionMachine(sessionId: string, machineId: string | null | undefined): void {+ if (machineId) sessionMachines.set(sessionId, machineId);+ else sessionMachines.delete(sessionId);+}++export function machineOfSession(sessionId: string): string | null {+ return sessionMachines.get(sessionId) ?? null;+}++/** Union view (spec §"Union view on the signed-in desktop"): machines from+ * the hosted cloud registry ride the sidecar's cloud proxy. In the GUI their+ * ids wear a `cloud:` prefix, so ONE mapping — here — decides which base a+ * machine id resolves to, and every consumer keeps passing opaque ids. */+export const CLOUD_ID_PREFIX = "cloud:";+export const isCloudMachineId = (mid: string): boolean => mid.startsWith(CLOUD_ID_PREFIX);++/** Admin base for one machine (rename/remove/sessions/secrets live under it). */+export const machineApi = (mid: string): string =>+ isCloudMachineId(mid)+ ? `${httpBase()}/v1/cloud/machines/${mid.slice(CLOUD_ID_PREFIX.length)}`+ : `${httpBase()}/v1/machines/${mid}`;++const machineWsPath = (mid: string): string =>+ isCloudMachineId(mid)+ ? `/ws/cloud/machines/${mid.slice(CLOUD_ID_PREFIX.length)}/p`+ : `/ws/machines/${mid}/p`;++/** Base URL of an ENGINE: the local sidecar, or a joined machine through the+ * controller's proxy — "a machine is just a different base URL". Pages scoped+ * by the Settings machine picker pass the picked machine id through. */+export const engineBase = (machineId?: string | null): string =>+ machineId ? `${machineApi(machineId)}/p` : httpBase();++const sessionApiBase = (sessionId: string): string => {+ const mid = sessionMachines.get(sessionId);+ return mid ? `${machineApi(mid)}/p` : httpBase();};export interface Health {@@ -62,8 +171,10 @@ export async function getHealth(): Promise<Health> {return res.json();}-export async function getRecentWorkspaces(): Promise<RecentWorkspace[]> {- const res = await fetch(`${httpBase()}/v1/workspaces/recent`);+export async function getRecentWorkspaces(machineId?: string | null): Promise<RecentWorkspace[]> {+ // Remote homes: a machine's recents are ITS recents (paths on that machine).+ const base = engineBase(machineId);+ const res = await fetch(`${base}/v1/workspaces/recent`);return (await res.json()).workspaces ?? [];}@@ -82,6 +193,7 @@ export async function pickFolderViaServer(): Promise<string | null> {export async function openWorkspace(path: string,create = false,+ machineId?: string | null,): Promise<{path: string;ok: boolean;@@ -89,7 +201,10 @@ export async function openWorkspace(git_branch?: string | null;command_trust?: WorkspaceCommandTrust;}> {- const res = await fetch(`${httpBase()}/v1/workspaces/open`, {+ // Validation happens on the machine the path lives on — the box answers+ // exists/not-a-dir/git-branch for ITS filesystem.+ const base = engineBase(machineId);+ const res = await fetch(`${base}/v1/workspaces/open`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ path, create }),@@ -102,8 +217,12 @@ export async function openWorkspace(export async function createTempWorkspace(sessionId: string,git = true,+ machineId?: string | null,): Promise<{ ok: boolean; path?: string; git?: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/workspaces/temp`, {+ // Remote homes: the temp dir must exist on the machine the session RUNS on+ // (explicit id — the session may be too new for the routing map).+ const base = engineBase(machineId);+ const res = await fetch(`${base}/v1/workspaces/temp`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ session_id: sessionId, git }),@@ -118,7 +237,7 @@ export async function saveSessionAsProject(path: string,): Promise<{ ok: boolean; path?: string; error?: string }> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/save-as-project`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/save-as-project`,{method: "POST",headers: { "Content-Type": "application/json" },@@ -151,6 +270,51 @@ export async function getSessions(workspace?: string): Promise<SessionInfo[]> {return (await res.json()).sessions ?? [];}+/** Sessions of one machine's list, tagged and registered for machine-aware+ * routing. Works for joined and `cloud:` machines alike — machineApi is the+ * routing seam. */+async function machineSessions(m: Machine): Promise<SessionInfo[]> {+ try {+ const res = await fetch(`${machineApi(m.id)}/sessions`);+ const data = await res.json();+ const rows: SessionInfo[] = data.sessions ?? [];+ for (const s of rows) {+ s.machine = m.id;+ s.machine_name = m.name;+ if (!data.live) s.machine_offline = true;+ registerSessionMachine(s.session_id, m.id);+ }+ return rows;+ } catch {+ return [];+ }+}++/** Local sessions + every machine's sessions — joined AND cloud (union v1.5)+ * — tagged with machine id/name and registered for machine-aware routing.+ * The controller answers from the live box while it's connected and from its+ * stored snapshot while it's offline (`machine_offline` marks those rows) —+ * greyed, never vanished. A signed-out/expired cloud session only hides the+ * cloud rows, never the rest. */+export async function getAllSessions(): Promise<SessionInfo[]> {+ const local = await getSessions();+ for (const s of local) registerSessionMachine(s.session_id, null);+ let remote: SessionInfo[] = [];+ try {+ const joined = getMachines()+ .then(({ machines }) => machines)+ .catch(() => [] as Machine[]);+ const cloud = getCloudMachines()+ .then((info) => (info.session === "ok" ? info.machines : []))+ .catch(() => [] as Machine[]);+ const machines = (await Promise.all([joined, cloud])).flat();+ remote = (await Promise.all(machines.map(machineSessions))).flat();+ } catch {+ /* machines API unavailable — local list is still the truth for This Mac */+ }+ return [...local, ...remote];+}+// A structured connector-delivered inbound message (§3.1). Attached to the user message it framed,// for display only — the model still sees the framed `content`; this drives the ConnectorMessageCard.export interface MessageSource {@@ -170,12 +334,15 @@ export interface MessageSource {// One digest event on a board wake. `note` is a UI-clamped excerpt of a hand-off// comment (the full text lives on the board).export interface BoardWakeRow {- kind: "assigned" | "claimed" | "moved" | "filed" | "comment" | "chat" | string;+ kind: "assigned" | "claimed" | "moved" | "filed" | "comment" | "chat" | "waiting" | string;item?: number | null;title?: string;actor?: string;to?: string;note?: string;+ // `waiting` only: a worker is waiting on the lead's decision for this tool call.+ tool?: string;+ prompt_id?: string;}// A transcript message from GET /v1/sessions/{id}/messages. Kept permissive (open shape) because@@ -193,12 +360,21 @@ export interface ConversationMessage {}export async function getSessionMessages(sessionId: string): Promise<ConversationMessage[]> {- const res = await fetch(`${httpBase()}/v1/sessions/${sessionId}/messages`);+ const mid = sessionMachines.get(sessionId);+ if (mid) {+ // Controller-view endpoint: live (and re-cached) while the box is+ // connected, the last synced copy — read-only — while it's offline.+ const res = await fetch(+ `${machineApi(mid)}/sessions/${encodeURIComponent(sessionId)}/messages`,+ );+ return (await res.json()).messages ?? [];+ }+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${sessionId}/messages`);return (await res.json()).messages ?? [];}export async function renameSession(sessionId: string, title: string): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}`, {method: "PATCH",headers: { "Content-Type": "application/json" },body: JSON.stringify({ title }),@@ -210,7 +386,7 @@ export async function setSessionFlags(sessionId: string,flags: { pinned?: boolean; archived?: boolean },): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}`, {method: "PATCH",headers: { "Content-Type": "application/json" },body: JSON.stringify(flags),@@ -219,7 +395,7 @@ export async function setSessionFlags(}export async function deleteSession(sessionId: string): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}`, { method: "DELETE" });+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}`, { method: "DELETE" });return res.json();}@@ -251,7 +427,7 @@ export interface JournalCase {}export async function getBoard(sessionId: string): Promise<Board> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/board`);+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/board`);return res.json();}@@ -275,7 +451,7 @@ export async function getBoardItem(id: number,): Promise<BoardItemDetail | { error: string }> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/board/item?id=${id}`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/board/item?id=${id}`,);return res.json();}@@ -287,7 +463,7 @@ export async function fetchBoardAttachment(stored: string,): Promise<string | null> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/board/attachment?name=${encodeURIComponent(stored)}`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/board/attachment?name=${encodeURIComponent(stored)}`,);if (!res.ok) return null;return URL.createObjectURL(await res.blob());@@ -300,7 +476,7 @@ export async function boardComment(body: string,): Promise<{ ok?: boolean; error?: string }> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/board/comment`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/board/comment`,{method: "POST",headers: { "Content-Type": "application/json" },@@ -316,7 +492,7 @@ export async function boardTransition(to: string,comment = "",): Promise<BoardItem | { error: string }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/board/transition`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/board/transition`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ item, to, comment }),@@ -340,13 +516,23 @@ export interface TeamChat {messages: ChatMessage[];}-export async function getTeamChat(teamId: string): Promise<TeamChat> {- const res = await fetch(`${httpBase()}/v1/teams/${encodeURIComponent(teamId)}/chat`);+// Team calls ride the machine of the session they belong to (connectors-across-machines+// spec §6): a team lives where its lead session lives, so its chat and the box's journal+// resolve through the same seam sessions use. No session id = the local sidecar.+const teamApiBase = (sessionId?: string): string =>+ sessionId ? sessionApiBase(sessionId) : httpBase();++export async function getTeamChat(teamId: string, sessionId?: string): Promise<TeamChat> {+ const res = await fetch(`${teamApiBase(sessionId)}/v1/teams/${encodeURIComponent(teamId)}/chat`);return res.json();}-export async function postTeamChat(teamId: string, text: string): Promise<ChatMessage | { error: string }> {- const res = await fetch(`${httpBase()}/v1/teams/${encodeURIComponent(teamId)}/chat`, {+export async function postTeamChat(+ teamId: string,+ text: string,+ sessionId?: string,+): Promise<ChatMessage | { error: string }> {+ const res = await fetch(`${teamApiBase(sessionId)}/v1/teams/${encodeURIComponent(teamId)}/chat`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ text }),@@ -354,8 +540,8 @@ export async function postTeamChat(teamId: string, text: string): Promise<ChatMereturn res.json();}-export async function getJournalCases(): Promise<JournalCase[]> {- const res = await fetch(`${httpBase()}/v1/teams/journal`);+export async function getJournalCases(sessionId?: string): Promise<JournalCase[]> {+ const res = await fetch(`${teamApiBase(sessionId)}/v1/teams/journal`);return (await res.json()).cases ?? [];}@@ -384,13 +570,13 @@ export interface ArtifactContent {}export async function getArtifacts(sessionId: string): Promise<ArtifactInfo[]> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/artifacts`);+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/artifacts`);return (await res.json()).artifacts ?? [];}export async function readArtifact(sessionId: string, path: string): Promise<ArtifactContent> {const q = new URLSearchParams({ path });- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/artifacts/read?${q.toString()}`);+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/artifacts/read?${q.toString()}`);return res.json();}@@ -400,7 +586,7 @@ export async function revealArtifact(path: string,mode: "reveal" | "open" = "reveal",): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/artifacts/reveal`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/artifacts/reveal`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ path, mode }),@@ -418,7 +604,7 @@ export interface RootInfo {}export async function getRoots(sessionId: string): Promise<RootInfo[]> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/roots`);+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/roots`);return (await res.json()).roots ?? [];}@@ -427,7 +613,7 @@ export async function addRoot(path: string,writable: boolean,): Promise<{ ok: boolean; error?: string; roots?: RootInfo[] }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/roots`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/roots`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ path, writable }),@@ -441,7 +627,7 @@ export async function removeRoot(): Promise<{ ok: boolean; error?: string; roots?: RootInfo[] }> {const q = new URLSearchParams({ path });const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/roots?${q.toString()}`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/roots?${q.toString()}`,{ method: "DELETE" },);return res.json();@@ -796,8 +982,8 @@ export interface ConnectorTool {requires_approval: boolean;}-export async function getConnectors(): Promise<Connector[]> {- const res = await fetch(`${httpBase()}/v1/connectors`);+export async function getConnectors(machineId?: string | null): Promise<Connector[]> {+ const res = await fetch(`${engineBase(machineId)}/v1/connectors`);return (await res.json()).connectors ?? [];}@@ -813,22 +999,60 @@ export async function connectConnector(return res.json();}-export async function disconnectConnector(name: string): Promise<{ ok: boolean }> {- const res = await fetch(`${httpBase()}/v1/connectors/${encodeURIComponent(name)}/disconnect`, {- method: "POST",- });+/** Machine-scope connector list, STRICT: a non-ok answer throws so the+ * remote panel renders "unreachable" — never an empty list that reads as+ * "no connectors exist". Lives here so the module's auth wrapper applies+ * (a component-level fetch bypasses the sidecar token — learned live). */+export async function getMachineConnectorsStrict(machineId: string): Promise<Connector[]> {+ const res = await fetch(`${engineBase(machineId)}/v1/connectors`);+ if (!res.ok) throw new Error("machine unreachable");+ return (await res.json()).connectors ?? [];+}++export async function disconnectConnector(+ name: string,+ machineId?: string | null,+): Promise<{ ok: boolean }> {+ const res = await fetch(+ `${engineBase(machineId)}/v1/connectors/${encodeURIComponent(name)}/disconnect`,+ { method: "POST" },+ );+ return res.json();+}++/** Remote manual connect (union view): the connector FIELDS are sealed in+ * this tab to the machine's pinned key — every relay in between (the+ * desktop's acceptor, or our cloud) carries ciphertext only. The box unseals+ * and runs its own connect, validation included. */+export async function connectConnectorSealed(+ machineId: string,+ name: string,+ sealedB64: string,+): Promise<{ ok: boolean; account?: string; error?: string }> {+ const res = await fetch(+ `${machineApi(machineId)}/connectors/${encodeURIComponent(name)}/connect-sealed`,+ {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ sealed_b64: sealedB64 }),+ },+ );return res.json();}export async function updateConnectorTools(name: string,enabled: Record<string, boolean>,+ machineId?: string | null,): Promise<{ ok: boolean; error?: string; tools?: Record<string, boolean> }> {- const res = await fetch(`${httpBase()}/v1/connectors/${encodeURIComponent(name)}/tools`, {- method: "PATCH",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ enabled }),- });+ const res = await fetch(+ `${engineBase(machineId)}/v1/connectors/${encodeURIComponent(name)}/tools`,+ {+ method: "PATCH",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ enabled }),+ },+ );return res.json();}@@ -899,10 +1123,22 @@ export interface SurfaceVisibility {code: boolean;}+/** Visible governance (remote-home-design.md §Audit export): what this machine+ * exports, where, and how far along. Off everywhere unless an org policy turned it on. */+export interface AuditExportStatus {+ enabled: boolean;+ sink: "" | "cloud" | "http";+ url?: string;+ exported: number;+ pending: number;+ last_error?: string;+}+export interface ModelSettings {provider: string;model: string;models: string[];+ audit_export?: AuditExportStatus;has_key: boolean;model_ready: boolean; // can the default model's provider actually run (any provider)?source: "env" | "store" | null;@@ -913,7 +1149,7 @@ export interface ModelSettings {// Sidebar layout preference (§7): "flat" = the persona accordions / today's list; "grouped" =// bounded per-persona cards. Defaults to "flat" (absent → flat) so the GUI is robust to an older// backend that hasn't shipped the field yet.- nav_layout?: "flat" | "grouped";+ nav_layout?: "flat" | "grouped" | "machine";// Sidebar: sessions shown per group before "Show more" (default 5, 1–50).sessions_peek?: number;// Composer: show the context-window fill bar (default FALSE; absent → the chip shows@@ -951,8 +1187,9 @@ export interface PdfSettings {/** Persist the Token-savings PDF settings (fallback mode + attach thresholds). */export async function setPdfSettings(patch: Partial<PdfSettings>,+ machineId?: string | null,): Promise<{ ok: boolean; error?: string } & Partial<PdfSettings>> {- const res = await fetch(`${httpBase()}/v1/settings/pdf`, {+ const res = await fetch(`${engineBase(machineId)}/v1/settings/pdf`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify(patch),@@ -969,8 +1206,9 @@ export interface CompactionSettings {/** Persist the auto-compaction overrides (threshold %, token cap, summarizer model). */export async function setCompactionSettings(patch: Partial<CompactionSettings>,+ machineId?: string | null,): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/settings/compaction`, {+ const res = await fetch(`${engineBase(machineId)}/v1/settings/compaction`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify(patch),@@ -1065,8 +1303,8 @@ export async function setSurfaces(/** Persist the sidebar layout preference (flat ↔ grouped-by-persona); read back from getSettings. */export async function setNavLayout(- layout: "flat" | "grouped",-): Promise<{ ok: boolean; nav_layout?: "flat" | "grouped"; error?: string }> {+ layout: "flat" | "grouped" | "machine",+): Promise<{ ok: boolean; nav_layout?: "flat" | "grouped" | "machine"; error?: string }> {const res = await fetch(`${httpBase()}/v1/settings/nav-layout`, {method: "POST",headers: { "Content-Type": "application/json" },@@ -1098,6 +1336,15 @@ function announcePersonasChanged() {window.dispatchEvent(new CustomEvent(PERSONAS_CHANGED));}+export interface TeamMemberDecision {+ persona: string;+ name?: string;+ connectors: string[];+ // The human's FINAL model choice for this worker — sent only when the gate offered+ // a model picker (the server supplied `runnable_models`).+ model?: string;+}+export interface Persona {id: string;name: string;@@ -1114,6 +1361,10 @@ export interface Persona {group?: string; // "general" | "security"version?: string;installed_at?: string;+ // Ordered allowed models (spec §4). Empty/absent = any model. `models_available` =+ // the entries THIS machine can run (its keys, its Ollama), annotated by the server.+ models?: string[];+ models_available?: string[];}export interface PersonaConsent {@@ -1127,7 +1378,8 @@ export interface PersonaConsent {mcp: string[];messaging: boolean;recommended_mode: string;- recommended_models: string[];+ models?: string[];+ recommended_models: string[]; // old name of `models`, one releaserecommends?: { kind: string; ref: string; reason: string; tier: string }[];version?: string;replaces?: { version: string; installed_at: string; capabilities_grew: boolean } | null;@@ -1141,8 +1393,15 @@ export async function getPersonas(): Promise<Persona[]> {}/** Personas plus the build flag: `internal` builds may show unshipped coworkers + the Gallery. */-export async function getPersonasIndex(): Promise<{ personas: Persona[]; internal: boolean }> {- const res = await fetch(`${httpBase()}/v1/personas`);+/** Session list of ONE machine (controller view): live rows when connected,+ * the stored snapshot otherwise. */+export async function getMachineSessionsList(machineId: string): Promise<SessionInfo[]> {+ const res = await fetch(`${machineApi(machineId)}/sessions`);+ return (await res.json()).sessions ?? [];+}++export async function getPersonasIndex(machineId?: string | null): Promise<{ personas: Persona[]; internal: boolean }> {+ const res = await fetch(`${engineBase(machineId)}/v1/personas`);const body = await res.json();return { personas: body.personas ?? [], internal: !!body.internal };}@@ -1150,8 +1409,9 @@ export async function getPersonasIndex(): Promise<{ personas: Persona[]; internaexport async function updatePersona(id: string,body: { enabled?: boolean; surfaced?: boolean; default?: boolean },+ machineId?: string | null,): Promise<{ ok: boolean; personas?: Persona[]; error?: string }> {- const res = await fetch(`${httpBase()}/v1/personas/${encodeURIComponent(id)}`, {+ const res = await fetch(`${engineBase(machineId)}/v1/personas/${encodeURIComponent(id)}`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify(body),@@ -1164,8 +1424,9 @@ export async function updatePersona(/** Uninstall a non-builtin persona (its snapshot + state). Local; works signed out. */export async function deletePersona(id: string,+ machineId?: string | null,): Promise<{ ok: boolean; personas?: Persona[]; error?: string }> {- const res = await fetch(`${httpBase()}/v1/personas/${encodeURIComponent(id)}`, {+ const res = await fetch(`${engineBase(machineId)}/v1/personas/${encodeURIComponent(id)}`, {method: "DELETE",});const out = await res.json();@@ -1238,8 +1499,9 @@ export async function exportPersona(export async function installPersona(body: { dir?: string; git_url?: string; gallery_slug?: string; zip_b64?: string; filename?: string },+ machineId?: string | null,): Promise<{ ok: boolean; consent?: PersonaConsent[]; personas?: Persona[]; error?: string }> {- const res = await fetch(`${httpBase()}/v1/personas/install`, {+ const res = await fetch(`${engineBase(machineId)}/v1/personas/install`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify(body),@@ -1282,7 +1544,9 @@ export interface PersonaDetail {surfaced: boolean;default: boolean;tools: string[];- recommended_models: string[];+ models?: string[]; // ordered allowed models (spec §4); [] = any+ models_available?: string[]; // the ones this machine can run+ recommended_models: string[]; // old name of `models`, one releasedefault_permission_mode: string;requires_folder: boolean; // folder gate (workspace-scratch-design.md)recommends: PersonaRecommendation[];@@ -1290,16 +1554,16 @@ export interface PersonaDetail {}/** Fetch one bundle screenshot with launch auth and hand back an object URL. */-export async function getPersonaMediaUrl(id: string, name: string): Promise<string> {+export async function getPersonaMediaUrl(id: string, name: string, machineId?: string | null): Promise<string> {const res = await fetch(- `${httpBase()}/v1/personas/${encodeURIComponent(id)}/media/${encodeURIComponent(name)}`,+ `${engineBase(machineId)}/v1/personas/${encodeURIComponent(id)}/media/${encodeURIComponent(name)}`,);if (!res.ok) throw new Error(`media ${name}: ${res.status}`);return URL.createObjectURL(await res.blob());}-export async function getPersonaDetail(id: string): Promise<PersonaDetail> {- const res = await fetch(`${httpBase()}/v1/personas/${encodeURIComponent(id)}`);+export async function getPersonaDetail(id: string, machineId?: string | null): Promise<PersonaDetail> {+ const res = await fetch(`${engineBase(machineId)}/v1/personas/${encodeURIComponent(id)}`);return res.json();}@@ -1308,8 +1572,9 @@ export async function setPersonaConnection(id: string,connector: string,enabled: boolean,+ machineId?: string | null,): Promise<{ ok: boolean; default_connections?: PersonaDefaultConnection[]; error?: string }> {- const res = await fetch(`${httpBase()}/v1/personas/${encodeURIComponent(id)}/connections`, {+ const res = await fetch(`${engineBase(machineId)}/v1/personas/${encodeURIComponent(id)}/connections`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ connector, enabled }),@@ -1321,8 +1586,9 @@ export async function setPersonaConnection(export async function setPersonaEnabled(id: string,enabled: boolean,+ machineId?: string | null,): Promise<{ ok: boolean; personas?: Persona[]; error?: string }> {- const res = await fetch(`${httpBase()}/v1/personas/${encodeURIComponent(id)}/enable`, {+ const res = await fetch(`${engineBase(machineId)}/v1/personas/${encodeURIComponent(id)}/enable`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ enabled }),@@ -1363,7 +1629,7 @@ export async function getSessionConnections(): Promise<SessionConnections> {const q = persona ? `?persona=${encodeURIComponent(persona)}` : "";const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/connections${q}`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/connections${q}`,);return res.json();}@@ -1378,7 +1644,7 @@ export async function setSessionConnection(enabled: boolean,clear = false,): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(`${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/connections`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/connections`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ connector, enabled, ...(clear ? { clear: true } : {}) }),@@ -1418,16 +1684,17 @@ export interface SkillUploadPreview {files?: string[];}-const skillUrl = (path = "") => `${httpBase()}/v1/skills${path}`;+const skillUrl = (path = "", machineId?: string | null) =>+ `${engineBase(machineId)}/v1/skills${path}`;const jsonPost = (body: unknown, method = "POST") => ({method,headers: { "Content-Type": "application/json" },body: JSON.stringify(body),});-export async function listSkills(workspace?: string): Promise<SkillRow[]> {+export async function listSkills(workspace?: string, machineId?: string | null): Promise<SkillRow[]> {const qs = workspace ? `?workspace=${encodeURIComponent(workspace)}` : "";- const res = await fetch(skillUrl(qs));+ const res = await fetch(skillUrl(qs, machineId));return (await res.json()).skills ?? [];}@@ -1437,16 +1704,17 @@ export async function createSkill(body: {instructions: string;scope?: "global" | "project";workspace?: string;-}): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(skillUrl(), jsonPost(body));+}, machineId?: string | null): Promise<{ ok: boolean; error?: string }> {+ const res = await fetch(skillUrl("", machineId), jsonPost(body));return res.json();}export async function updateSkill(name: string,patch: { description?: string; instructions?: string; enabled?: boolean; workspace?: string },+ machineId?: string | null,): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(skillUrl(`/${encodeURIComponent(name)}`), jsonPost(patch, "PATCH"));+ const res = await fetch(skillUrl(`/${encodeURIComponent(name)}`, machineId), jsonPost(patch, "PATCH"));return res.json();}@@ -1459,9 +1727,10 @@ export async function revealSkill(name: string): Promise<{ ok: boolean; error?:export async function deleteSkill(name: string,workspace?: string,+ machineId?: string | null,): Promise<{ ok: boolean; error?: string }> {const qs = workspace ? `?workspace=${encodeURIComponent(workspace)}` : "";- const res = await fetch(skillUrl(`/${encodeURIComponent(name)}${qs}`), { method: "DELETE" });+ const res = await fetch(skillUrl(`/${encodeURIComponent(name)}${qs}`, machineId), { method: "DELETE" });return res.json();}@@ -1477,8 +1746,9 @@ export async function moveSkill(export async function stageSkillUpload(dataB64: string,filename = "",+ machineId?: string | null,): Promise<SkillUploadPreview> {- const res = await fetch(skillUrl("/upload"), jsonPost({ data_b64: dataB64, filename }));+ const res = await fetch(skillUrl("/upload", machineId), jsonPost({ data_b64: dataB64, filename }));return res.json();}@@ -1486,8 +1756,9 @@ export async function confirmSkillUpload(token: string,scope: "global" | "project" = "global",workspace?: string,+ machineId?: string | null,): Promise<{ ok: boolean; error?: string }> {- const res = await fetch(skillUrl("/upload/confirm"), jsonPost({ token, scope, workspace }));+ const res = await fetch(skillUrl("/upload/confirm", machineId), jsonPost({ token, scope, workspace }));return res.json();}@@ -1498,7 +1769,7 @@ export async function sessionSkills(): Promise<SessionSkillRow[]> {const qs = workspace ? `?workspace=${encodeURIComponent(workspace)}` : "";const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/skills${qs}`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/skills${qs}`,);return (await res.json()).skills ?? [];}@@ -1510,7 +1781,7 @@ export async function setSessionSkill(opts: { clear?: boolean; workspace?: string } = {},): Promise<{ skills?: SessionSkillRow[]; ok?: boolean; error?: string }> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/skills`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/skills`,jsonPost({skill,enabled,@@ -1525,7 +1796,7 @@ export async function setSessionSkill(export interface InboxItem {id: string;session_id: string;- kind: "approval" | "question" | "notification" | "directory" | "plan";+ kind: "approval" | "question" | "notification" | "directory" | "plan" | "tool" | "connector";title: string;body: string;state: "pending" | "resolved";@@ -1549,21 +1820,86 @@ export interface InboxItem {session_agent?: string | null;session_workspace?: string | null;session_exists?: boolean;+ // Remote homes: set when the item came from a joined machine's inbox — the+ // Inbox aggregates every connected machine (⌂ tag; resolve routes back).+ machine?: string;+ machine_name?: string;+}++// Which machine each aggregated inbox item came from, so resolve routes back+// to the box that parked it. Fed by getInbox; ids are uuids, so cross-machine+// collisions are not a practical concern.+const inboxItemMachines = new Map<string, string>();++/** A worker's waiting call lives on the same machine as the lead's item that names it, but+ * was never fetched here. Route it like that item (or like that session) before resolving. */+export function routeInboxItemLike(id: string, like: { itemId?: string; sessionId?: string }): void {+ const mid =+ (like.itemId && inboxItemMachines.get(like.itemId)) || (like.sessionId && machineOfSession(like.sessionId)) || "";+ if (id && mid) inboxItemMachines.set(id, mid);}export async function getInbox(sessionId?: string, state?: string): Promise<InboxItem[]> {const q = new URLSearchParams();if (sessionId) q.set("session_id", sessionId);if (state) q.set("state", state);- const res = await fetch(`${httpBase()}/v1/inbox?${q.toString()}`);- return (await res.json()).items;+ // Per-session view: query the session's OWN home (local or its machine).+ if (sessionId) {+ const base = sessionApiBase(sessionId);+ const res = await fetch(`${base}/v1/inbox?${q.toString()}`);+ const items: InboxItem[] = (await res.json()).items ?? [];+ const mid = machineOfSession(sessionId);+ if (mid) for (const it of items) inboxItemMachines.set(it.id, mid);+ return items;+ }+ // Cross-session Inbox: aggregate this Mac + every CONNECTED machine —+ // joined AND cloud (union v1.5: a cloud box's parked approval was invisible+ // before this, a silent stall the machine-events drill hit live). An+ // offline box's parked items are unreachable AND unanswerable — listing them+ // would only offer dead buttons; they return with the machine.+ const local = fetch(`${httpBase()}/v1/inbox?${q.toString()}`)+ .then(async (r) => ((await r.json()).items ?? []) as InboxItem[])+ .catch(() => [] as InboxItem[]);+ const machineInbox = async (m: Machine): Promise<InboxItem[]> => {+ try {+ const r = await fetch(`${engineBase(m.id)}/v1/inbox?${q.toString()}`);+ const items: InboxItem[] = (await r.json()).items ?? [];+ for (const it of items) {+ it.machine = m.id;+ it.machine_name = m.name;+ inboxItemMachines.set(it.id, m.id);+ }+ return items;+ } catch {+ return [] as InboxItem[];+ }+ };+ const joined = getMachines()+ .then(({ machines }) => machines)+ .catch(() => [] as Machine[]);+ const cloud = getCloudMachines()+ .then((info) => (info.session === "ok" ? info.machines : []))+ .catch(() => [] as Machine[]);+ const remote = Promise.all([joined, cloud])+ .then((lists) =>+ Promise.all(lists.flat().filter((m) => m.connected).map(machineInbox)),+ )+ .then((lists) => lists.flat())+ .catch(() => [] as InboxItem[]);+ const [mine, theirs] = await Promise.all([local, remote]);+ // Oldest-first within the merge, matching the server's ordering instinct.+ return [...mine, ...theirs].sort((a, b) =>+ (a.created_at || "").localeCompare(b.created_at || ""),+ );}export async function resolveInboxItem(id: string,resolution: string,): Promise<{ ok: boolean }> {- const res = await fetch(`${httpBase()}/v1/inbox/${encodeURIComponent(id)}/resolve`, {+ const mid = inboxItemMachines.get(id);+ const base = engineBase(mid);+ const res = await fetch(`${base}/v1/inbox/${encodeURIComponent(id)}/resolve`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ resolution }),@@ -1589,8 +1925,11 @@ export interface RecentChannel {last_text: string | null;}-export async function getSubscriptions(): Promise<Subscription[]> {- const res = await fetch(`${httpBase()}/v1/subscriptions`);+/** A machine's channel subscriptions (session → channel). Session-scoped+ * callers pass the session's machine: the list lives on the engine that owns+ * the session, and the dashboard's own origin answers with something else. */+export async function getSubscriptions(machineId?: string | null): Promise<Subscription[]> {+ const res = await fetch(`${engineBase(machineId)}/v1/subscriptions`);return (await res.json()).subscriptions ?? [];}@@ -1601,17 +1940,20 @@ export interface InboxBinding {target: string; // chat_id, e.g. "C0BEJNCQQ8Y"}-export async function getInboxRouting(): Promise<InboxBinding[]> {- const res = await fetch(`${httpBase()}/v1/inbox/routing`);+export async function getInboxRouting(machineId?: string | null): Promise<InboxBinding[]> {+ const res = await fetch(`${engineBase(machineId)}/v1/inbox/routing`);return (await res.json()).bindings ?? [];}+/** Approvals routing is per machine (UX-049): pass the machine whose+ * sessions' approvals this binding governs; default = the local engine. */export async function setInboxBinding(name: string,channel: string | null,target: string,+ machineId?: string | null,): Promise<{ ok: boolean; bindings?: InboxBinding[]; error?: string }> {- const res = await fetch(`${httpBase()}/v1/inbox/routing/binding`, {+ const res = await fetch(`${engineBase(machineId)}/v1/inbox/routing/binding`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ name, channel, target }),@@ -1632,19 +1974,41 @@ export async function getUnrouted(): Promise<UnroutedItem[]> {return (await res.json()).items ?? [];}-export async function getRecentChannels(): Promise<RecentChannel[]> {- const res = await fetch(`${httpBase()}/v1/channels/recent`);+export async function getRecentChannels(machineId?: string | null): Promise<RecentChannel[]> {+ const res = await fetch(`${engineBase(machineId)}/v1/channels/recent`);return (await res.json()).channels ?? [];}+/** The session already answering a source, as the cloud reports it (one+ * session across all of the user's machines answers a channel or repo). */+export interface SubscriptionHolder {+ session_id: string;+ title: string;+ machine_id: string; // "desktop" = This Mac+ source: string;+}++export interface SubscribeResult {+ ok: boolean;+ channel?: string;+ error?: string; // "held" when another session answers it — see held_by+ held_by?: SubscriptionHolder;+ also?: SubscriptionHolder[];+ move_allowed?: boolean;+ registered?: boolean; // false = local-only (nothing managed to register)+}++/** Subscribe goes to the machine that owns the session (its box registers the+ * claim at the cloud before writing locally); `move` takes over a held source. */export async function subscribeChannel(sessionId: string,channel: string,-): Promise<{ ok: boolean; channel?: string; error?: string }> {- const res = await fetch(`${httpBase()}/v1/subscriptions`, {+ opts: { move?: boolean } = {},+): Promise<SubscribeResult> {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/subscriptions`, {method: "POST",headers: { "Content-Type": "application/json" },- body: JSON.stringify({ session_id: sessionId, channel }),+ body: JSON.stringify({ session_id: sessionId, channel, move: !!opts.move }),});return res.json();}@@ -1653,7 +2017,7 @@ export async function unsubscribeChannel(sessionId: string,channel: string,): Promise<{ ok: boolean; removed?: boolean }> {- const res = await fetch(`${httpBase()}/v1/subscriptions/remove`, {+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/subscriptions/remove`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ session_id: sessionId, channel }),@@ -1663,7 +2027,7 @@ export async function unsubscribeChannel(export async function getUnattended(sessionId: string): Promise<boolean> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/unattended`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/unattended`,);return (await res.json()).unattended;}@@ -1673,7 +2037,7 @@ export async function setUnattended(unattended: boolean,): Promise<{ ok: boolean; unattended: boolean }> {const res = await fetch(- `${httpBase()}/v1/sessions/${encodeURIComponent(sessionId)}/unattended`,+ `${sessionApiBase(sessionId)}/v1/sessions/${encodeURIComponent(sessionId)}/unattended`,{method: "POST",headers: { "Content-Type": "application/json" },@@ -1702,12 +2066,12 @@ export interface ReviewerStats {}export async function getReviewerStats(sessionId: string): Promise<ReviewerStats> {- const res = await fetch(`${httpBase()}/v1/sessions/${sessionId}/reviewer-stats`);+ const res = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${sessionId}/reviewer-stats`);return res.json();}-export async function getSettings(): Promise<ModelSettings> {- const res = await fetch(`${httpBase()}/v1/settings`);+export async function getSettings(machineId?: string | null): Promise<ModelSettings> {+ const res = await fetch(`${engineBase(machineId)}/v1/settings`);return res.json();}@@ -1784,8 +2148,8 @@ export function announceMemoryChanged() {window.dispatchEvent(new CustomEvent(MEMORY_CHANGED));}-export async function getMemory(): Promise<MemoryEntry[]> {- const res = await fetch(`${httpBase()}/v1/memory`);+export async function getMemory(machineId?: string | null): Promise<MemoryEntry[]> {+ const res = await fetch(`${engineBase(machineId)}/v1/memory`);return (await res.json()).memory ?? [];}@@ -1811,8 +2175,8 @@ export async function deleteAllMemory(): Promise<{ ok: boolean; deleted: numberreturn res.json();}-export async function getMemorySettings(): Promise<MemorySettings> {- const res = await fetch(`${httpBase()}/v1/memory/settings`);+export async function getMemorySettings(machineId?: string | null): Promise<MemorySettings> {+ const res = await fetch(`${engineBase(machineId)}/v1/memory/settings`);return res.json();}@@ -1888,7 +2252,11 @@ export async function codexSignout(): Promise<{ ok: boolean }> {export async function getProviders(): Promise<ProviderInfo[]> {const res = await fetch(`${httpBase()}/v1/providers`);- return res.json();+ const data = await res.json();+ // A backend without providers (the hosted control plane — models live on+ // each machine) answers 404 JSON; an object where an array belongs must+ // not reach render code (it crashed the whole app, owner-hit 2026-08-30).+ return Array.isArray(data) ? data : [];}export async function setProvider(@@ -2162,9 +2530,10 @@ export async function getSlackDirectory(export async function getSlackChannels(teamId: string,q = "",+ machineId?: string | null,): Promise<{ ok: boolean; error?: string; channels?: SlackChannelEntry[] }> {const res = await fetch(- `${httpBase()}/v1/connectors/slack/workspaces/${encodeURIComponent(teamId)}/channels?q=${encodeURIComponent(q)}`,+ `${engineBase(machineId)}/v1/connectors/slack/workspaces/${encodeURIComponent(teamId)}/channels?q=${encodeURIComponent(q)}`,);return res.json();}@@ -2364,31 +2733,72 @@ export async function getSlackStatus(): Promise<SlackStatus> {export type Handlers = {onEvent: (event: WsEvent) => void;- onOpen?: () => void;+ /** `reconnected` is true when this open follows an unexpected drop — the caller+ * should reload what it may have missed (transcript tail, parked prompts). */+ onOpen?: (reconnected: boolean) => void;onClose?: () => void;};+/** Reconnect backoff for a dropped session socket: 1s, 2s, 4s, 8s, then 15s. */+export const SESSION_RECONNECT_MS = [1000, 2000, 4000, 8000, 15000];+export class Session {- private ws: WebSocket;+ private ws!: WebSocket;// Payloads sent before the socket finished opening, replayed on `onopen`. Belt-and-suspenders// against the first message being dropped if the user sends in the connect window.private outbox: object[] = [];-- constructor(sessionId: string, workspace: string, agent: string, handlers: Handlers) {+ private readonly url: string;+ private readonly handlers: Handlers;+ private closed = false;+ private attempts = 0;+ private timer: number | null = null;++ constructor(+ sessionId: string,+ workspace: string,+ agent: string,+ handlers: Handlers,+ machine?: string | null,+ ) {const q = `?workspace=${encodeURIComponent(workspace)}&agent=${encodeURIComponent(agent)}`;- this.ws = openWebSocket(`${wsBase()}/ws/session/${sessionId}${q}`);- this.ws.onmessage = (e) => {+ // Remote homes: a session on a joined machine rides the bridged socket —+ // same protocol, different base path (the controller splices it to the box).+ const path = machine+ ? `${machineWsPath(machine)}/ws/session/${sessionId}`+ : `/ws/session/${sessionId}`;+ this.url = `${wsBase()}${path}${q}`;+ this.handlers = handlers;+ this.connect();+ }++ /** Open (or re-open) the socket. A drop the caller did not ask for schedules a retry+ * with capped backoff — a bridged machine session rides two hops (controller + box),+ * and either one restarting used to leave the view dead until the user navigated+ * away (ledger 2026-09-01: the v14 rollover blanked the bridged view). */+ private connect() {+ if (this.closed) return;+ const reconnected = this.attempts > 0;+ const ws = openWebSocket(this.url);+ this.ws = ws;+ ws.onmessage = (e) => {try {- handlers.onEvent(JSON.parse(e.data));+ this.handlers.onEvent(JSON.parse(e.data));} catch {/* malformed frame — ignore */}};- this.ws.onopen = () => {+ ws.onopen = () => {+ this.attempts = 0;this.flush();- handlers.onOpen?.();+ this.handlers.onOpen?.(reconnected);+ };+ ws.onclose = () => {+ this.handlers.onClose?.();+ if (this.closed) return;+ const delay = SESSION_RECONNECT_MS[Math.min(this.attempts, SESSION_RECONNECT_MS.length - 1)];+ this.attempts += 1;+ this.timer = window.setTimeout(() => this.connect(), delay);};- this.ws.onclose = () => handlers.onClose?.();}private flush() {@@ -2421,7 +2831,7 @@ export class Session {}approve(decision: string) {- this.send({ type: "approval", decision });+ this.send(approvalMessage(decision));}/** §8.4 "Allow anyway": register a ONE-SHOT exact-action approval for a reviewer-denied@@ -2432,44 +2842,37 @@ export class Session {// Reply to a `request_directory` prompt: grant a folder (with access level) or decline.respondDirectory(granted: boolean, path?: string, writable?: boolean) {- this.send({ type: "directory_response", granted, ...(path ? { path } : {}), writable: !!writable });+ this.send(directoryResponseMessage(granted, path, writable));}// Reply to a `request_tool` prompt: install the pinned build, or skip the check.respondTool(approved: boolean) {- this.send({ type: "tool_response", approved });+ this.send(toolResponseMessage(approved));}// Reply to a `propose_plan` prompt: approve (choosing the execution mode) or reject with feedback.respondPlan(approved: boolean, mode?: string, feedback?: string) {- this.send({- type: "plan_response",- approved,- ...(mode ? { mode } : {}),- ...(feedback ? { feedback } : {}),- });+ this.send(planResponseMessage(approved, mode, feedback));}- respondTeam(approved: boolean, feedback?: string, enableChat?: boolean) {- this.send({- type: "team_response",- approved,- ...(feedback ? { feedback } : {}),- ...(enableChat !== undefined ? { enable_chat: enableChat } : {}),- });+ // Spec §11.6: the human's per-worker decisions ride the response — connectors ticked+ // on the card (within the offered ceiling) and the approval mode; by roster index.+ respondTeam(approved: boolean, feedback?: string, enableChat?: boolean, members?: TeamMemberDecision[]) {+ this.send(teamResponseMessage(approved, feedback, enableChat, members));+ }++ // Reply to a `request_connector` / `grant_connector` prompt.+ respondConnector(approved: boolean) {+ this.send(connectorResponseMessage(approved));}respondItems(approved: boolean, feedback?: string) {- this.send({- type: "items_response",- approved,- ...(feedback ? { feedback } : {}),- });+ this.send(itemsResponseMessage(approved, feedback));}// Answer a live `ask_user` prompt (attended sessions; unattended ones answer via the Inbox).respondQuestion(answer: string) {- this.send({ type: "question_response", answer });+ this.send(questionResponseMessage(answer));}interrupt() {@@ -2494,6 +2897,8 @@ export class Session {// Detach before closing: this socket's async `close` event may land AFTER the// successor session's `open` (observed when switching into an automation-run// session), and a torn-down socket must not clobber the new one's connected state.+ this.closed = true;+ if (this.timer !== null) window.clearTimeout(this.timer);this.ws.onopen = null;this.ws.onmessage = null;this.ws.onclose = null;@@ -2511,7 +2916,7 @@ export interface ProjectMenu {}export async function getProjectMenu(sessionId: string, kind: "memory" | "board"): Promise<ProjectMenu> {- const r = await fetch(`${httpBase()}/v1/sessions/${sessionId}/project-menu?kind=${kind}`);+ const r = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${sessionId}/project-menu?kind=${kind}`);return r.json();}@@ -2520,7 +2925,7 @@ export async function setProjectBinding(kind: "memory" | "board",name: string | null,): Promise<{ ok: boolean; error?: string }> {- const r = await fetch(`${httpBase()}/v1/sessions/${sessionId}/bindings`, {+ const r = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${sessionId}/bindings`, {method: "PUT",headers: { "Content-Type": "application/json" },body: JSON.stringify({ kind, name }),@@ -2533,10 +2938,797 @@ export async function nameCurrentProject(kind: "memory" | "board",name: string,): Promise<{ ok: boolean; error?: string }> {- const r = await fetch(`${httpBase()}/v1/sessions/${sessionId}/project-name`, {+ const r = await fetch(`${sessionApiBase(sessionId)}/v1/sessions/${sessionId}/project-name`, {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ kind, name }),});return r.json();}++// -- remote homes: machines (remote-home-design.md P1b) ------------------------++export interface Machine {+ id: string;+ name: string;+ fingerprint: string;+ app_version: string;+ created_at: number;+ last_seen: number | null;+ connected: boolean;+ // Public halves only (older backends omit them): what a browser seals key+ // deploys to, and the fingerprint the user checks with `openworker status`.+ seal_pubkey?: string;+ seal_fingerprint?: string;+ // Union view: where this row lives. Absent = the local registry; "cloud"+ // rows carry the `cloud:` id prefix and ride the sidecar's cloud proxy.+ origin?: "local" | "cloud";+ // Where the machine came from: "" (absent) = the user brought it, "fly" =+ // one of our managed sandboxes (provenance_ref = its sandbox id).+ provenance?: string;+ provenance_ref?: string;+}++// -- managed sandboxes (spec §Fly sandboxes) -----------------------------------++export type SandboxPhase =+ | "provisioning"+ | "joining"+ | "online"+ | "offline"+ | "stuck"+ | "asleep"+ | "failed";++export interface Sandbox {+ id: string;+ name: string;+ owner: string;+ mine: boolean;+ state: string;+ phase: SandboxPhase;+ error: string;+ machine_id: string;+ connected: boolean;+ created_at: number;+ updated_at: number;+}++export interface SandboxesInfo {+ sandboxes: Sandbox[];+ // The caller's effective per-user cap (0 = the feature is off for them)+ // and how many of theirs count against it.+ cap: number;+ used: number;+}++/** Hosted only. A backend without the route (desktop, older service) answers+ * cap 0 — the page then shows nothing about sandboxes. */+export async function getSandboxes(): Promise<SandboxesInfo> {+ try {+ const r = await fetch(`${httpBase()}/v1/sandboxes`);+ if (!r.ok) return { sandboxes: [], cap: 0, used: 0 };+ const d = await r.json();+ return { sandboxes: d.sandboxes ?? [], cap: Number(d.cap ?? 0), used: Number(d.used ?? 0) };+ } catch {+ return { sandboxes: [], cap: 0, used: 0 };+ }+}++export async function createSandbox(+ name?: string,+): Promise<{ sandbox?: Sandbox; error?: string }> {+ const r = await fetch(`${httpBase()}/v1/sandboxes`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(name ? { name } : {}),+ });+ const d = await r.json().catch(() => ({}));+ if (!r.ok) {+ const detail = d?.detail;+ return { error: typeof detail === "string" ? detail : detail?.message || `HTTP ${r.status}` };+ }+ return { sandbox: d.sandbox };+}++export async function deleteSandbox(id: string): Promise<{ removed?: string; error?: string }> {+ const r = await fetch(`${httpBase()}/v1/sandboxes/${encodeURIComponent(id)}`, { method: "DELETE" });+ const d = await r.json().catch(() => ({}));+ if (!r.ok) {+ const detail = d?.detail;+ return { error: typeof detail === "string" ? detail : detail?.message || `HTTP ${r.status}` };+ }+ return d;+}++export interface CloudMachinesInfo {+ // "signed_out" hides the cloud section entirely; "expired" shows a+ // sign-in-again row; "unreachable" = network trouble, shown like offline.+ session: "ok" | "signed_out" | "expired" | "unreachable";+ org?: { id: string; name: string } | null;+ machines: Machine[];+}++/** The hosted cloud registry, through the sidecar's proxy (desktop only —+ * the hosted service itself has no such route). Ids come back prefixed so+ * every existing consumer routes them through the proxy automatically. */+export async function getCloudMachines(): Promise<CloudMachinesInfo> {+ // Only an explicit session state from the proxy counts. A backend without+ // the route (older sidecar, hosted service) answers something else — that+ // is "no cloud attachment here", i.e. signed_out, never an error state.+ try {+ const r = await fetch(`${httpBase()}/v1/cloud/machines`);+ if (!r.ok) return { session: "signed_out", machines: [] };+ const data = await r.json();+ const session = ["ok", "signed_out", "expired", "unreachable"].includes(data.session)+ ? (data.session as CloudMachinesInfo["session"])+ : "signed_out";+ const machines: Machine[] = (data.machines ?? []).map((m: Machine) => ({+ ...m,+ id: CLOUD_ID_PREFIX + m.id,+ origin: "cloud" as const,+ }));+ return { session, org: data.org, machines };+ } catch {+ return { session: "signed_out", machines: [] };+ }+}++/** Fired on `window` by whoever learns the fleet changed (a machine joined,+ * was removed, a sandbox came up) so pickers elsewhere reload their list. */+export const MACHINES_CHANGED = "openworker:machines-changed";++export async function getMachines(): Promise<{ machines: Machine[]; armed: boolean }> {+ const r = await fetch(`${httpBase()}/v1/machines`);+ return r.json();+}++/** Opening the "Add a machine" card arms enrollment: mints ONE single-use+ * token with a 10-minute window and returns the join URL to show the user. */+export async function armEnrollment(): Promise<{ join_url: string; expires_at: number }> {+ const r = await fetch(`${httpBase()}/v1/remote/arm`, { method: "POST" });+ return r.json();+}++export async function disarmEnrollment(): Promise<void> {+ await fetch(`${httpBase()}/v1/remote/arm`, { method: "DELETE" });+}++export async function renameMachine(+ id: string,+ name: string,+): Promise<{ machine?: { id: string; name: string }; error?: string }> {+ const r = await fetch(machineApi(id), {+ method: "PATCH",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ name }),+ });+ return r.json();+}++export async function removeMachine(id: string): Promise<{ removed?: string; error?: string }> {+ const r = await fetch(machineApi(id), { method: "DELETE" });+ return r.json();+}++/** The MACHINE's own settings (models it offers, its default) via the proxy —+ * what the composer's picker shows when a draft runs on that machine. */+export async function getMachineSettings(machineId: string): Promise<ModelSettings> {+ const r = await fetch(`${engineBase(machineId)}/v1/settings`);+ return r.json();+}++// -- deployment mode (remote-home-design.md §Cloud dashboard) ------------------+// The SAME bundle serves the desktop sidecar and the acceptor-only cloud+// service; the backend's capabilities flag — fetched once at boot — decides+// which surfaces exist. Module-level so leaf components can read it without+// prop-drilling; App sets it before the first post-boot render.+export type AppMode = "desktop" | "cloud";+let appMode: AppMode = "desktop";++export function setAppMode(mode: AppMode): void {+ appMode = mode;+}++export function isCloudMode(): boolean {+ return appMode === "cloud";+}++// Capability flags (spec §"Deployments and the UI"): features gate on NAMED+// flags, not on the mode — a new deployment is a different capabilities+// response, zero UI changes. `wallet` is the first flag migrated; the rest+// follow in the Settings rehaul.+let walletAvailable = true;+export function setWalletAvailable(available: boolean): void {+ walletAvailable = available;+}+/** Does this backend hold a key wallet? false → key deploys are sealed in+ * the BROWSER and relayed (OPE-149). */+export function hasWallet(): boolean {+ return walletAvailable;+}++/** Login config a hosted deployment advertises (server-driven, like the mode+ * flag itself — the bundle carries no deployment-specific identifiers). */+export interface CloudAuthConfig {+ kind: string; // "auth0"+ domain: string;+ client_id: string;+ audience: string;+}++// The broker (OpenWorker Cloud API) a hosted deployment pairs with — set from+// /v1/capabilities so the dashboard can start a managed OAuth connect for a+// machine from the browser (spec §Cloud-dashboard connect-direct).+let cloudBase = "";+export function getCloudBase(): string {+ return cloudBase;+}+export function setCloudBase(base: string): void {+ cloudBase = (base || "").replace(/\/$/, "");+}++export async function getCapabilities(): Promise<{+ mode: AppMode;+ wallet: boolean;+ auth?: CloudAuthConfig;+ cloud?: { base: string };+}> {+ try {+ const r = await fetch(`${httpBase()}/v1/capabilities`);+ const d = await r.json();+ if (d.cloud?.base) setCloudBase(String(d.cloud.base));+ return {+ mode: d.mode === "cloud" ? "cloud" : "desktop",+ wallet: d.wallet !== false, // absent (desktop sidecar) → has a wallet+ ...(d.auth ? { auth: d.auth as CloudAuthConfig } : {}),+ ...(d.cloud?.base ? { cloud: { base: String(d.cloud.base) } } : {}),+ };+ } catch {+ return { mode: "desktop", wallet: true }; // older sidecars have no endpoint+ }+}++/** How the hosted backend resolves this browser's token: identity + org+ * memberships (the switcher's data). Desktop has no such endpoint. */+export interface MeInfo {+ actor: string;+ email: string;+ org_id: string;+ admin: boolean;+ orgs: { id: string; name: string; role: string }[];+ // Per-tenant policy flags for the resolved org (deployment-wide flags ride+ // /v1/capabilities). Absent on older backends → everything allowed.+ policies?: { key_push?: boolean; sandbox_cap?: number };+}++export async function getMe(): Promise<MeInfo> {+ const r = await fetch(`${httpBase()}/v1/me`);+ if (!r.ok) throw new Error(`me: ${r.status}`);+ return r.json();+}++// -- device-flow approval (`openworker auth join` — typed-code, GitHub-style) --++export interface DeviceRequestDetail {+ user_code: string;+ name: string;+ fingerprint: string;+ expires_at: number;+}++/** Look up a pending join request by its typed code. 404 → null (unknown,+ * expired, or already decided). */+export async function getDeviceRequest(code: string): Promise<DeviceRequestDetail | null> {+ const r = await fetch(`${httpBase()}/v1/remote/device/${encodeURIComponent(code)}`);+ if (!r.ok) return null;+ return r.json();+}++export async function approveDeviceRequest(code: string): Promise<boolean> {+ const r = await fetch(+ `${httpBase()}/v1/remote/device/${encodeURIComponent(code)}/approve`,+ { method: "POST" },+ );+ return r.ok;+}++export async function denyDeviceRequest(code: string): Promise<boolean> {+ const r = await fetch(+ `${httpBase()}/v1/remote/device/${encodeURIComponent(code)}/deny`,+ { method: "POST" },+ );+ return r.ok;+}++export interface WalletProfile {+ profile: string;+ type?: string | null;+ account?: string | null;+ expired?: boolean;+}++/** Wallet contents by name/type only — values never reach the browser. */+export async function getWalletProfiles(): Promise<WalletProfile[]> {+ const r = await fetch(`${httpBase()}/v1/wallet`);+ return (await r.json()).profiles ?? [];+}++export interface MachineSecretRow {+ profile: string;+ deployed_at: number;+ stale: boolean;+ missing_from_wallet: boolean;+}++export async function getMachineSecrets(machineId: string): Promise<MachineSecretRow[]> {+ const r = await fetch(`${machineApi(machineId)}/secrets`);+ return (await r.json()).secrets ?? [];+}++/** Wallet deploy: NAMES only — the sidecar resolves values from its own store,+ * seals them to the machine's pinned key, and pushes. */+/** Grant handoff (spec §Remote OAuth): which profile keys a connector's+ * grant carries, and whether it may move to a machine at all. One grant,+ * one holder — the move deploys these sealed, then This Mac forgets. */+export async function getConnectorHandoffInfo(name: string): Promise<{+ ok: boolean;+ portable?: boolean;+ reason?: string;+ profiles?: string[];+ needs_delegation?: boolean;+}> {+ const res = await fetch(+ `${httpBase()}/v1/connectors/${encodeURIComponent(name)}/handoff-info`,+ );+ return res.json();+}++/** Handoff step for managed grants: mark their broker connections+ * machine-held so the machine can renew by possession. Passing the target+ * machine's seal_pubkey also mints the machine credential (managed events):+ * the broker then routes the connection's events to that machine's sealed+ * queue, and the credential is stamped into the moving profiles. */+export async function delegateConnector(+ name: string,+ sealPubkey?: string,+ // Hosted machines only: the machines service's own id, so the broker can+ // wake a sleeping sandbox when an event arrives for this grant.+ machineId?: string,+): Promise<{ ok: boolean; error?: string }> {+ const res = await fetch(+ `${httpBase()}/v1/connectors/${encodeURIComponent(name)}/delegate`,+ {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({+ ...(sealPubkey ? { seal_pubkey: sealPubkey } : {}),+ ...(machineId ? { machine_id: machineId } : {}),+ }),+ },+ );+ return res.json();+}++/** Connect-direct-to-machine (machines spec §Remote OAuth): OAuth completes+ * in this browser as usual, but the sidecar's callback ships the grant —+ * delegated and sealed — to the named machine and stores nothing locally.+ * Desktop only (the sidecar owns the OAuth loopback); needs cloud sign-in. */+// Which broker provider serves a connector (mirrors the sidecar's map).+const PROVIDER_FOR_CONNECTOR: Record<string, string> = {+ gmail: "google",+ google_calendar: "google",+ google_drive: "google",+ slack: "slack",+ notion: "notion",+ attio: "attio",+ hubspot: "hubspot",+ github: "github",+ outlook: "microsoft",+};++/** Browser connect-direct (hosted dashboard): ask the broker for the+ * consent URL in browser mode — the result comes back to THIS tab by+ * postMessage, delegated to the machine, and the tab seals it to the+ * machine's pinned key. Returns the authorize URL to open in a popup. */+export async function beginBrowserManagedConnect(+ name: string,+ machineId: string,+ sealPubkey: string,+ opts: { access?: string; flow?: string } = {},+): Promise<{ ok: boolean; authorize_url?: string; error?: string }> {+ const provider = PROVIDER_FOR_CONNECTOR[name];+ const base = getCloudBase();+ if (!provider) return { ok: false, error: i18n.t("misc.api.no_managed_oauth", { name }) };+ if (!base) return { ok: false, error: i18n.t("misc.api.no_cloud_api") };+ const token = apiToken();+ if (!token) return { ok: false, error: "not signed in" };+ const r = await globalThis.fetch(`${base}/v1/oauth/${encodeURIComponent(provider)}/start`, {+ method: "POST",+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },+ body: JSON.stringify({+ connector: name,+ mode: "browser",+ redirect: window.location.origin,+ machine_id: machineId.replace(/^cloud:/, ""),+ seal_pubkey: sealPubkey,+ ...(opts.access ? { access: opts.access } : {}),+ ...(opts.flow ? { flow: opts.flow } : {}),+ }),+ });+ if (!r.ok) {+ let detail = `HTTP ${r.status}`;+ try {+ const d = await r.json();+ detail = typeof d.detail === "string" ? d.detail : detail;+ } catch {+ /* keep */+ }+ return { ok: false, error: detail };+ }+ const d = await r.json();+ return { ok: true, authorize_url: d.authorize_url };+}++/** Relay a browser-sealed broker grant to the machine (the box stores it+ * through its own routine). Ciphertext only leaves this tab. */+export async function connectManagedGrantSealed(+ machineId: string,+ name: string,+ sealedB64: string,+): Promise<{ ok: boolean; account?: string; error?: string }> {+ const res = await fetch(+ `${machineApi(machineId)}/connectors/${encodeURIComponent(name)}/managed-grant-sealed`,+ {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ sealed_b64: sealedB64 }),+ },+ );+ const d = await res.json().catch(() => ({}));+ if (!res.ok) return { ok: false, error: d.error || d.message || `HTTP ${res.status}` };+ return d;+}++export async function beginManagedConnectOnMachine(+ machineId: string,+ name: string,+ machineName: string,+): Promise<{ ok: boolean; error?: string }> {+ const res = await fetch(+ `${httpBase()}/v1/connectors/${encodeURIComponent(name)}/connect-managed`,+ {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ machine_id: machineId, machine_name: machineName }),+ },+ );+ return res.json();+}++/** Complete a machine-scope disconnect of a MANAGED grant: the box deleted+ * its copy but cannot reach the broker (no session), so the desktop revokes+ * the connector's broker connections — killing the delegation so events stop+ * queueing for a machine that no longer listens. Best-effort, idempotent. */+export async function revokeCloudConnections(+ name: string,+): Promise<{ ok: boolean; revoked?: number }> {+ const res = await fetch(+ `${httpBase()}/v1/cloud/connections/${encodeURIComponent(name)}/revoke`,+ { method: "POST" },+ );+ return res.json();+}++/** The handoff's forget step: local deletion only — never the broker+ * disconnect, which would revoke the delegation the machine now lives on. */+export async function forgetConnectorLocal(name: string): Promise<{ ok: boolean }> {+ const res = await fetch(+ `${httpBase()}/v1/connectors/${encodeURIComponent(name)}/forget-local`,+ { method: "POST" },+ );+ return res.json();+}++export async function deployMachineSecrets(+ machineId: string,+ profiles: string[],+): Promise<{ ok?: boolean; deployed?: string[]; error?: string }> {+ const r = await fetch(`${machineApi(machineId)}/secrets`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ profiles }),+ });+ return r.json();+}++/** Browser-sealed deploy (OPE-149): the payload was sealed IN THIS TAB to+ * the machine's pinned key; the backend is a blind relay. `hashes` feed the+ * staleness ledger only. */+export async function deploySealedSecrets(+ machineId: string,+ sealedB64: string,+ profiles: string[],+ hashes: Record<string, string>,+): Promise<{ ok?: boolean; deployed?: string[]; error?: string }> {+ const r = await fetch(`${machineApi(machineId)}/secrets`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ sealed_b64: sealedB64, profiles, hashes }),+ });+ return r.json();+}++export async function revokeMachineSecrets(+ machineId: string,+ profiles: string[],+): Promise<{ ok?: boolean; revoked?: string[]; error?: string }> {+ const r = await fetch(`${machineApi(machineId)}/secrets`, {+ method: "DELETE",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ profiles }),+ });+ return r.json();+}+++// --- Cloud views for connectors across machines (UX-049) ----------------------+// The dashboard talks to the broker directly with the user's token; the+// desktop goes through the sidecar's explicit /v1/cloud/... routes so the+// token never leaves it. Same shapes either way.++async function brokerFetch(path: string, init: RequestInit = {}): Promise<Response> {+ if (isCloudMode() && getCloudBase()) {+ const token = apiToken();+ return globalThis.fetch(`${getCloudBase()}${path}`, {+ ...init,+ headers: { ...(init.headers || {}), Authorization: `Bearer ${token}` },+ });+ }+ return fetch(`${httpBase()}/v1/cloud${path.replace(/^\/v1/, "")}`, init);+}++const JSON_POST = (body: unknown): RequestInit => ({+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(body),+});++export interface CloudHolder {+ machine_id: string; // "" = the anonymous pre-machine-id delegation+ delegated_at: string;+ events: boolean;+}++export interface CloudConnection {+ connection_id: string;+ connector: string;+ provider: string;+ status: string;+ provider_account?: string | null;+ tenant_metadata?: Record<string, unknown> | null;+ holders: CloudHolder[];+ default_machine_id: string; // "" | "desktop" | machine id+ copyable: boolean; // false = the provider rotates refresh tokens: one holder only+ // Per workspace / installation (UX-049): which machine answers mentions nobody+ // subscribed to, and which coworker (a persona id on that machine) starts the session.+ routing: Record<string, { machine_id: string; persona: string }>;+}++/** Set one half or both of a scope's routing line. machineId "" keeps;+ * persona undefined keeps, "" clears. */+export async function setScopeRouting(+ connectionId: string,+ scope: string,+ machineId = "",+ persona?: string,+): Promise<{ ok: boolean; error?: string }> {+ const res = await brokerFetch(+ `/v1/connections/${encodeURIComponent(connectionId)}/routing`,+ JSON_POST({ scope, machine_id: machineId, ...(persona === undefined ? {} : { persona }) }),+ );+ return res.ok ? { ok: true } : { ok: false, error: `http ${res.status}` };+}++export async function getCloudConnections(): Promise<CloudConnection[]> {+ const res = await brokerFetch("/v1/connections");+ if (!res.ok) return [];+ return (await res.json()).connections ?? [];+}++/** Add a holder for `connectionId` on a machine (Enable): the broker mints+ * that machine's credential, returned once. */+export async function delegateConnection(+ connectionId: string,+ sealPubkey: string,+ machineId: string,+): Promise<{ ok: boolean; user_id?: string; machine_credential?: string; error?: string }> {+ const res = await brokerFetch(+ `/v1/connections/${encodeURIComponent(connectionId)}/delegate`,+ JSON_POST({ seal_pubkey: sealPubkey, machine_id: machineId }),+ );+ const body = await res.json().catch(() => ({}));+ if (!res.ok) return { ok: false, error: body.detail || body.error || `http ${res.status}` };+ return { ok: true, user_id: body.user_id, machine_credential: body.machine_credential };+}++export async function setDefaultMachine(+ connectionId: string,+ machineId: string,+): Promise<{ ok: boolean; error?: string }> {+ const res = await brokerFetch(+ `/v1/connections/${encodeURIComponent(connectionId)}/default-machine`,+ JSON_POST({ machine_id: machineId }),+ );+ return res.ok ? { ok: true } : { ok: false, error: `http ${res.status}` };+}++/** Disconnect on ONE machine at the broker (the machine forgets its own copy). */+export async function forgetHolder(connectionId: string, machineId: string): Promise<boolean> {+ const res = await brokerFetch(+ `/v1/connections/${encodeURIComponent(connectionId)}/holders/${encodeURIComponent(machineId)}`,+ { method: "DELETE" },+ );+ return res.ok;+}++export interface CloudSubscription {+ source: string;+ connector: string;+ machine_id: string; // "desktop" | machine id+ session_id: string;+ connection_id: string;+ team_id: string;+ title: string;+ state: "active" | "orphan";+ created_at: string;+}++export async function getCloudSubscriptions(connector = ""): Promise<CloudSubscription[]> {+ const res = await brokerFetch(`/v1/subscriptions${connector ? `?connector=${encodeURIComponent(connector)}` : ""}`);+ if (!res.ok) return [];+ return (await res.json()).subscriptions ?? [];+}++export async function removeCloudSubscription(source: string): Promise<boolean> {+ const res = await brokerFetch("/v1/subscriptions/remove", JSON_POST({ source }));+ return res.ok;+}++export interface Person {+ source: string;+ connector: string;+ scope: string; // Slack team id | GitHub installation id+ member: string; // Slack user id | GitHub login+ name: string;+ added_at: string;+ pinned?: boolean; // the user themself: always listed, never removable+}++export async function getPeople(connector: string, scope = ""): Promise<Person[]> {+ const q = new URLSearchParams({ connector, ...(scope ? { scope } : {}) }).toString();+ const res = await brokerFetch(`/v1/people?${q}`);+ if (!res.ok) return [];+ return (await res.json()).people ?? [];+}++export async function addPerson(+ connector: string,+ scope: string,+ member: string,+ name = "",+): Promise<{ ok: boolean; error?: string }> {+ const res = await brokerFetch("/v1/people", JSON_POST({ connector, scope, member, name }));+ return res.ok ? { ok: true } : { ok: false, error: `http ${res.status}` };+}++export async function removePerson(connector: string, scope: string, member: string): Promise<boolean> {+ const res = await brokerFetch("/v1/people/remove", JSON_POST({ connector, scope, member }));+ return res.ok;+}++// Configurations (connectors-across-machines spec §10): repositories × event ×+// who × send to. One object per configuration (its rows grouped by the broker).+export type ConfigurationEvent = "mention" | "named_mention" | "pr_open" | "pr_merge" | "issue_open";++export interface ConfigurationTarget {+ kind: "existing" | "new";+ machine_id: string; // "desktop" | broker machine id+ session_id?: string;+ title?: string;+ persona?: string;+ models?: string[];+ base_dir?: string;+ worktree?: boolean;+ skills?: string[];+ instructions?: string;+ board?: string;+ memory?: string;+ // Spec §11.5: the spawned session's approval mode (default "auto-approve") and whether+ // its prompts go to the Inbox (default true) — decided when the configuration is written.+ approval_mode?: "interactive" | "auto-approve" | "bypass-approvals" | string;+ unattended?: boolean;+}++export interface Configuration {+ config_id: string;+ connector: string;+ installation_id: string;+ repos: string[]; // "owner/repo", or "owner" = all repositories+ event: ConfigurationEvent | string;+ name: string;+ who: string[];+ target: ConfigurationTarget;+ state: "active" | "orphan" | string;+ created_at: string;+ updated_at?: string;+}++export async function getConfigurations(connector = "github"): Promise<Configuration[]> {+ const res = await brokerFetch(`/v1/configurations?connector=${encodeURIComponent(connector)}`);+ if (!res.ok) return [];+ return (await res.json()).configurations ?? [];+}++export interface ConfigurationError {+ ok: false;+ error: string; // "held" | "name_taken" | "subscribed" | http message+ held_by?: Record<string, unknown>;+}++export async function addConfiguration(body: {+ connector?: string;+ installation_id?: string;+ repos: string[];+ event: string;+ name?: string;+ who?: string[];+ target: ConfigurationTarget;+}): Promise<{ ok: true; configuration: Configuration } | ConfigurationError> {+ const res = await brokerFetch("/v1/configurations", JSON_POST({ connector: "github", ...body }));+ const data = await res.json().catch(() => ({}));+ if (res.ok) return { ok: true, configuration: data.configuration };+ const detail = data.detail ?? data;+ return { ok: false, error: typeof detail === "string" ? detail : detail?.error || `http ${res.status}`, held_by: detail?.held_by };+}++export async function editConfiguration(+ configId: string,+ body: { who?: string[]; target?: ConfigurationTarget },+): Promise<{ ok: true; configuration: Configuration } | ConfigurationError> {+ const res = await brokerFetch(`/v1/configurations/${encodeURIComponent(configId)}/edit`, JSON_POST(body));+ const data = await res.json().catch(() => ({}));+ if (res.ok) return { ok: true, configuration: data.configuration };+ const detail = data.detail ?? data;+ return { ok: false, error: typeof detail === "string" ? detail : detail?.error || `http ${res.status}` };+}++export async function deleteConfiguration(configId: string): Promise<boolean> {+ const res = await brokerFetch(`/v1/configurations/${encodeURIComponent(configId)}`, { method: "DELETE" });+ return res.ok;+}++/** Box-to-box Enable: the SOURCE machine seals its profiles for `name`,+ * stamped with the target's grant, to the target's pinned key. Ciphertext+ * only; the caller relays it to the target's deploy route. */+export async function handoffSealedFromMachine(+ sourceMachineId: string,+ name: string,+ sealPubkey: string,+ grant: { user_id?: string; machine_credential?: string },+): Promise<{ ok: boolean; sealed_b64?: string; profiles?: string[]; error?: string; reason?: string }> {+ const res = await fetch(+ `${machineApi(sourceMachineId)}/p/v1/connectors/${encodeURIComponent(name)}/handoff-sealed`,+ JSON_POST({ seal_pubkey: sealPubkey, grant }),+ );+ return res.json();+}++/** Move's forget step on a source MACHINE (the desktop has forgetConnectorLocal). */+export async function forgetConnectorOnMachine(sourceMachineId: string, name: string): Promise<{ ok: boolean }> {+ const res = await fetch(+ `${machineApi(sourceMachineId)}/p/v1/connectors/${encodeURIComponent(name)}/forget-local`,+ { method: "POST" },+ );+ return res.json();+}diff --git a/surfaces/gui/src/cardPayloads.ts b/surfaces/gui/src/cardPayloads.tsnew file mode 100644index 00000000..97d1d455--- /dev/null+++ b/surfaces/gui/src/cardPayloads.ts@@ -0,0 +1,190 @@+// One place where a server payload becomes a card's props, and where a card's answer+// becomes the message on the wire. The session view (App), the Inbox card and the dev+// card gallery all go through here, so a payload renders the same wherever it lands+// (the staffing card diverged between the session and the Inbox on 2026-09-16).+import type { InboxItem, TeamMemberDecision } from "./api";+import type { Item } from "./types";++export type ApprovalItem = Extract<Item, { kind: "approval" }>;+export type PlanItem = Extract<Item, { kind: "planreq" }>;+export type TeamRequestItem = Extract<Item, { kind: "teamreq" }>;+export type ConnectorRequestItem = Extract<Item, { kind: "connreq" }>;+export type WorkItemsItem = Extract<Item, { kind: "itemsreq" }>;+export type DirectoryRequestItem = Extract<Item, { kind: "dirreq" }>;+export type ToolRequestItem = Extract<Item, { kind: "toolreq" }>;+export type QuestionItem = Extract<Item, { kind: "question" }>;++// -- server payload → card item -------------------------------------------------+// `d` is the websocket event's `data` for an inline card, or the Inbox item's `data`+// for a parked one: the server sends the same fields in both places.++/** `permission_required`. */+export function approvalItemFromPayload(d: any): ApprovalItem {+ return {+ kind: "approval",+ name: d.name,+ args: d.arguments,+ reason: d.reason,+ category: d.category,+ standingTarget: d.standing_target || undefined,+ searchProvider: d.search_provider || undefined,+ provenance: d.provenance || undefined,+ reviewerUnsure: d.reviewer_unsure || undefined,+ readonlyOk: !!d.readonly_ok,+ mcpDestination: d.mcp_destination || undefined,+ workerCall: d.worker_call && typeof d.worker_call === "object" && d.worker_call.tool ? d.worker_call : undefined,+ };+}++/** `plan_proposed`. */+export function planItemFromPayload(d: any): PlanItem {+ return { kind: "planreq", plan: d.plan || "" };+}++/** `team_proposed`, or a parked `gate: "team"` item. Fields an older server does not+ * send stay undefined, so the card can tell "unknown" from "empty". */+export function teamItemFromPayload(d: any): TeamRequestItem {+ return {+ kind: "teamreq",+ members: Array.isArray(d.members) ? d.members : [],+ enable_chat: !!d.enable_chat,+ note: d.note || "",+ offer: d.offer && typeof d.offer === "object" ? d.offer : {},+ other_connected: Array.isArray(d.other_connected) ? d.other_connected : [],+ lead_mode: typeof d.lead_mode === "string" ? d.lead_mode : undefined,+ model_options: d.model_options && typeof d.model_options === "object" ? d.model_options : undefined,+ runnable_models: Array.isArray(d.runnable_models) ? d.runnable_models : undefined,+ lead_model: typeof d.lead_model === "string" ? d.lead_model : undefined,+ };+}++/** `connector_requested`. */+export function connectorItemFromPayload(d: any): ConnectorRequestItem {+ return {+ kind: "connreq",+ request: d.request === "grant" ? "grant" : "connect",+ connector: d.connector || "",+ worker: d.worker || "",+ reason: d.reason || "",+ };+}++/** `items_proposed`, or a parked `gate: "items"` item. */+export function workItemsItemFromPayload(d: any): WorkItemsItem {+ return { kind: "itemsreq", items: Array.isArray(d.items) ? d.items : [], note: d.note || "" };+}++/** `directory_requested`. */+export function directoryItemFromPayload(d: any): DirectoryRequestItem {+ return { kind: "dirreq", reason: d.reason || "", path: d.path || "", writable: !!d.writable, primary: !!d.primary };+}++/** `tool_requested`. */+export function toolItemFromPayload(d: any): ToolRequestItem {+ return {+ kind: "toolreq",+ tool: d.name || "",+ reason: d.reason || "",+ // Fail CLOSED: only offer Install when the event says a pinned build exists.+ installable: d.installable === true,+ version: d.version || "",+ summary: d.summary || "",+ source: d.source || "",+ };+}++/** `question_requested` (ask_user in an attended session). */+export function questionItemFromPayload(d: any): QuestionItem {+ return {+ kind: "question",+ question: d.question || "",+ options: d.options || [],+ allow_text: d.allow_text !== false,+ multi: !!d.multi,+ header: d.header || "",+ questions: d.questions || [],+ };+}++/** A live question wears the Inbox card (one question UI); this is the item it is given. */+export function liveQuestionInboxItem(q: QuestionItem, sessionId: string): InboxItem {+ return {+ id: "live-question",+ session_id: sessionId,+ kind: "question",+ title: q.question,+ body: "",+ state: "pending",+ resolution: null,+ inbox: "default",+ created_at: "",+ resolved_at: null,+ options: q.options,+ allow_text: q.allow_text,+ multi: q.multi,+ header: q.header,+ questions: q.questions,+ };+}++// -- card answer → websocket message ----------------------------------------------++export function approvalMessage(decision: string) {+ return { type: "approval", decision };+}++export function planResponseMessage(approved: boolean, mode?: string, feedback?: string) {+ return { type: "plan_response", approved, ...(mode ? { mode } : {}), ...(feedback ? { feedback } : {}) };+}++// Spec §11.6: the human's per-worker decisions ride the response — the connectors ticked+// on the card and the chosen model; by roster index.+export function teamResponseMessage(+ approved: boolean,+ feedback?: string,+ enableChat?: boolean,+ members?: TeamMemberDecision[],+) {+ return {+ type: "team_response",+ approved,+ ...(feedback ? { feedback } : {}),+ ...(enableChat !== undefined ? { enable_chat: enableChat } : {}),+ ...(members ? { members } : {}),+ };+}++export function connectorResponseMessage(approved: boolean) {+ return { type: "connector_response", approved };+}++export function itemsResponseMessage(approved: boolean, feedback?: string) {+ return { type: "items_response", approved, ...(feedback ? { feedback } : {}) };+}++export function directoryResponseMessage(granted: boolean, path?: string, writable?: boolean) {+ return { type: "directory_response", granted, ...(path ? { path } : {}), writable: !!writable };+}++export function toolResponseMessage(approved: boolean) {+ return { type: "tool_response", approved };+}++export function questionResponseMessage(answer: string) {+ return { type: "question_response", answer };+}++// -- card answer → Inbox resolution (parked gates) ----------------------------------++export function teamGateResolution(+ approved: boolean,+ feedback?: string,+ enableChat?: boolean,+ members?: TeamMemberDecision[],+): string {+ return JSON.stringify({ approved, feedback: feedback ?? "", enable_chat: !!enableChat, members: members ?? [] });+}++export function itemsGateResolution(approved: boolean, feedback?: string): string {+ return JSON.stringify({ approved, feedback: feedback ?? "" });+}diff --git a/surfaces/gui/src/cloudAuth.ts b/surfaces/gui/src/cloudAuth.tsnew file mode 100644index 00000000..6cafab46--- /dev/null+++ b/surfaces/gui/src/cloudAuth.ts@@ -0,0 +1,127 @@+// Hosted-dashboard sign-in gate (remote-home-design.md §Cloud dashboard).+//+// Runs BEFORE React renders. The backend's /v1/capabilities says whether this+// deployment wants a login (server-driven `auth` block — the bundle itself+// carries no tenant identifiers). When it does, the Auth0 access token becomes+// the app-wide API token: the same global the desktop shell injects, so every+// existing fetch/WebSocket authenticates with zero per-endpoint changes.+//+// Desktop and the OSS acceptor skeleton advertise no `auth` block and skip+// all of this — the gate resolves immediately.++import { getActiveOrg, getMe, httpBase, setActiveOrg, type MeInfo } from "./api";++const ORG_STORAGE_KEY = "ocw.cloud.org";++let me: MeInfo | null = null;+let signOutImpl: (() => Promise<void>) | null = null;++/** Identity + memberships resolved at boot (hosted cloud only). */+export function cloudMe(): MeInfo | null {+ return me;+}++export function canSignOut(): boolean {+ return signOutImpl !== null;+}++/** Org policy (OPE-150): may this browser push keys in the active org? The+ * API refuses regardless — this only decides whether to OFFER the button. */+export function keyPushAllowed(): boolean {+ return me?.policies?.key_push !== false;+}++export async function cloudSignOut(): Promise<void> {+ if (signOutImpl) await signOutImpl();+}++// switchOrg removed 2026-08-31 (spec §"One login, one org"): the org is a+// function of the signed-in identity; the stored-org resolution below stays+// only to honor an already-persisted selection until it ages out.++async function resolveOrg(): Promise<void> {+ try {+ me = await getMe();+ } catch {+ return; // backend without /v1/me (skeleton) — org-less single tenant+ }+ let stored = "";+ try {+ stored = localStorage.getItem(ORG_STORAGE_KEY) || "";+ } catch {+ /* no storage */+ }+ const valid = new Set(me.orgs.map((o) => o.id));+ setActiveOrg(stored && valid.has(stored) ? stored : me.org_id);+ if (getActiveOrg() !== me.org_id) {+ // Re-read under the selected org so `me.org_id` mirrors what every+ // subsequent request will resolve to.+ try {+ me = await getMe();+ } catch {+ /* keep the boot read */+ }+ }+}++/** Whether boot should wait on this gate at all. Hosted dashboards are the+ * only https deployments; desktop (tauri://, http loopback) and dev servers+ * render synchronously, exactly as before the gate existed. */+export function shouldGate(): boolean {+ if ((import.meta as any).env?.VITE_CLOUD_AUTH === "1") return true; // dev opt-in+ return typeof location !== "undefined" && location.protocol === "https:";+}++/** Resolve once the app may render. Never resolves when a login redirect is+ * underway — the navigation replaces the page. */+export async function initCloudAuth(): Promise<void> {+ if ((globalThis as any).__COWORKER_API_TOKEN__) {+ return; // shell-injected token (desktop) wins; nothing to do+ }+ let caps: { mode?: string; auth?: { kind: string; domain: string; client_id: string; audience: string } };+ try {+ caps = await (await globalThis.fetch(`${httpBase()}/v1/capabilities`)).json();+ } catch {+ return; // no backend yet (desktop boot race) — the app has its own retry+ }+ if (caps?.mode !== "cloud" || caps?.auth?.kind !== "auth0") return;++ const { createAuth0Client } = await import("@auth0/auth0-spa-js");+ const auth0 = await createAuth0Client({+ domain: caps.auth.domain,+ clientId: caps.auth.client_id,+ cacheLocation: "localstorage",+ authorizationParams: {+ audience: caps.auth.audience,+ redirect_uri: window.location.origin,+ },+ });++ const params = new URLSearchParams(window.location.search);+ if (params.has("code") && params.has("state")) {+ try {+ await auth0.handleRedirectCallback();+ } catch {+ /* stale state (reload of an old callback URL) — fall through */+ }+ window.history.replaceState({}, "", window.location.pathname);+ }++ try {+ const token = await auth0.getTokenSilently();+ (globalThis as any).__COWORKER_API_TOKEN__ = token;+ } catch {+ await auth0.loginWithRedirect();+ await new Promise<never>(() => {}); // navigating away — never render+ }++ signOutImpl = async () => {+ try {+ localStorage.removeItem(ORG_STORAGE_KEY);+ } catch {+ /* no storage */+ }+ await auth0.logout({ logoutParams: { returnTo: window.location.origin } });+ };+ await resolveOrg();+}diff --git a/surfaces/gui/src/main.tsx b/surfaces/gui/src/main.tsxindex 1b703864..3f16fe8a 100644--- a/surfaces/gui/src/main.tsx+++ b/surfaces/gui/src/main.tsx@@ -1,13 +1,16 @@import React from "react";import ReactDOM from "react-dom/client";import { App } from "./App";+import { initCloudAuth, shouldGate } from "./cloudAuth";import { initTheme } from "./theme";+import { initTextSize } from "./textSize";import { platformOS } from "./tauri";import { initI18n } from "./i18n";import "./tailwind.css";import "./styles.css";initTheme();+initTextSize();// Platform hook for CSS (html[data-platform="windows"] scrollbar styling etc.).document.documentElement.dataset.platform = platformOS();@@ -18,11 +21,50 @@ document.documentElement.dataset.platform = platformOS();window.addEventListener("dragover", (e) => e.preventDefault());window.addEventListener("drop", (e) => e.preventDefault());-// Initialize i18n before the first render so t() resolves everywhere.-initI18n().finally(() => {- ReactDOM.createRoot(document.getElementById("root")!).render(+// The hosted dashboard signs in before first render; desktop and dev render+// straight away. A sign-in redirect never resolves — the navigation replaces this page.+const root = ReactDOM.createRoot(document.getElementById("root")!);+const render = () =>+ root.render(<React.StrictMode><App /></React.StrictMode>,);++// Dev only: /#/gallery renders the card gallery instead of the app (no server needed).+// The DEV guard is a build-time constant, so the gallery and its payload files are+// dropped from the desktop bundle. The app rewrites the hash with replaceState (which+// fires no hashchange), so this listener only sees a hash a person typed.+const onGallery = () => import.meta.env.DEV && window.location.hash.startsWith("#/gallery");+if (import.meta.env.DEV) {+ window.addEventListener("hashchange", (e) => {+ if (new URL(e.oldURL).hash.startsWith("#/gallery") !== onGallery()) window.location.reload();+ });+}++// Dev only: /?scenario=<id>#/s/<session> boots the REAL app on a saved moment of a session,+// answered from memory (gallery/scenarioApi.ts). A query, not a hash, because the app reads+// its session from the hash at start-up.+const scenarioId = import.meta.env.DEV ? new URLSearchParams(window.location.search).get("scenario") : null;++// Initialize i18n before the first render so t() resolves everywhere (the gallery and+// scenario sessions render the same translated components).+initI18n().finally(() => {+ if (scenarioId) {+ import("./gallery/scenarioBoot").then(({ bootScenario }) => {+ if (!bootScenario(scenarioId, root, App)) render();+ });+ } else if (onGallery()) {+ import("./gallery/Gallery").then(({ Gallery }) =>+ root.render(+ <React.StrictMode>+ <Gallery />+ </React.StrictMode>,+ ),+ );+ } else if (shouldGate()) {+ initCloudAuth().then(render, render);+ } else {+ render();+ }});diff --git a/surfaces/gui/src/modelNames.ts b/surfaces/gui/src/modelNames.tsnew file mode 100644index 00000000..8a092aa6--- /dev/null+++ b/surfaces/gui/src/modelNames.ts@@ -0,0 +1,18 @@+// How a model is named on a card (owner-ruled 2026-09-17, same rule as the composer pill,+// UX-048): show the model's NAME; the provider and the raw id live in the hover text.+// Curated labels read "Claude Opus 4.8 · Anthropic"; without one, the id loses its+// "provider:" prefix.++const withoutProvider = (id: string) => (id.includes(":") ? id.split(":").slice(1).join(":") : id);++export function modelName(id: string, labels?: Record<string, string>): string {+ if (!id) return "";+ return (labels?.[id] || "").split(" · ")[0] || withoutProvider(id);+}++/** Hover text: the curated label when there is one, then the exact id the server uses. */+export function modelHover(id: string, labels?: Record<string, string>): string {+ if (!id) return "";+ const label = labels?.[id];+ return label && label !== id ? `${label} (${id})` : id;+}diff --git a/surfaces/gui/src/routes.ts b/surfaces/gui/src/routes.tsnew file mode 100644index 00000000..ba76409b--- /dev/null+++ b/surfaces/gui/src/routes.ts@@ -0,0 +1,118 @@+// Hash deep links, v1 (owner-ruled 2026-08-30: hash-based; the full routing+// scheme lands with the Settings rehaul). The hash is captured ONCE at load —+// the app rewrites it as the session changes, so inbound intent must be read+// before the first rewrite.+//+// #/approve/XXXX-XXXX → open Settings ▸ Machines with the code prefilled+// (what `openworker auth join` prints on hosted)+// #/s/{sessionId} → land on that session (bookmark/refresh)+// #/settings/{page}?m={id} → open that Settings page; ?m= is the machine+// scope for machine-scoped pages (UX-046)++const initialHash = typeof window !== "undefined" ? window.location.hash : "";++export const initialSessionId =+ initialHash.match(/^#\/s\/([\w-]+)/)?.[1] ?? "";++// URL slugs are the pages' NAMES (general, coworkers…), decoupled from the+// internal tab keys ("appearance" predates the General rename; "personas"+// predates Coworkers) — renaming a label must never break a bookmark.+const TAB_BY_SLUG: Record<string, string> = {+ general: "appearance",+ voice: "voice",+ account: "account",+ models: "models",+ context: "context",+ skills: "skills",+ memory: "memory",+ coworkers: "personas",+ machines: "machines",+ connectors: "connectors",+ // UX-049: per-connector glance pages.+ slack: "slack",+ github: "github",+};+const SLUG_BY_TAB: Record<string, string> = Object.fromEntries(+ Object.entries(TAB_BY_SLUG).map(([slug, tab]) => [tab, slug]),+);++/** The Settings page a #/settings deep link asks for ("" = none). Unknown+ * slugs open Settings on its first page rather than dead-ending the link. */+export const initialSettingsTab = (() => {+ const m = initialHash.match(/^#\/settings(?:\/([\w-]+))?/);+ if (!m) return "";+ return TAB_BY_SLUG[m[1] ?? "general"] ?? "appearance";+})();++// A settings deep link owns the URL until the Settings page reflects itself —+// the app-level session reflection fires first (surface still defaults to+// "session" at mount) and would overwrite the link before it is read.+let settingsLinkPending = initialSettingsTab !== "";++/** The ?m= machine scope, read LIVE from the current hash (not the boot one):+ * reflectSettings keeps it current, so a Settings remount re-reads the scope+ * it was already showing instead of resetting to the default. */+export function settingsMachineParam(): string {+ // `[\w:-]` covers the union view's `cloud:` id prefix.+ try {+ return window.location.hash.match(/^#\/settings\/[\w-]+\?m=([\w:-]+)/)?.[1] ?? "";+ } catch {+ return "";+ }+}++/** Reflect the open Settings page (and its machine scope, when the page has+ * one) in the URL. replaceState, same as sessions — tab browsing must not+ * pile up history entries. */+export function reflectSettings(tab: string, machineId?: string | null): void {+ if (hasPendingApproval()) return;+ settingsLinkPending = false;+ const slug = SLUG_BY_TAB[tab] ?? "general";+ try {+ window.history.replaceState(+ null,+ "",+ `#/settings/${slug}${machineId ? `?m=${machineId}` : ""}`,+ );+ } catch {+ /* file:// or restricted contexts — the URL is a convenience */+ }+}++let approvalCode = initialHash.match(/^#\/approve\/([A-Za-z0-9-]+)/)?.[1] ?? "";++/** The deep-linked approval code, if any. Reading does NOT consume — React+ * StrictMode runs state initializers twice in dev, so a consuming read here+ * would hand the second run an empty string. Consume from an effect. */+export function peekApprovalCode(): string {+ return approvalCode;+}++/** Mark the deep link handled — reopening the Machines page later must not+ * replay it. Safe to call twice (effects also double-run in strict dev).+ * The hash moves off the spent code so a refresh lands on the Machines page+ * instead of replaying an approval that was already decided. */+export function consumeApprovalCode(): void {+ if (!approvalCode) return;+ approvalCode = "";+ try {+ window.history.replaceState(null, "", "#/settings/machines");+ } catch {+ /* convenience only */+ }+}++export function hasPendingApproval(): boolean {+ return approvalCode !== "";+}++/** Reflect the active session in the URL so refresh and bookmarks return+ * here. replaceState: session switching must not pile up history entries. */+export function reflectSession(sessionId: string): void {+ if (!sessionId || hasPendingApproval() || settingsLinkPending) return;+ try {+ window.history.replaceState(null, "", `#/s/${sessionId}`);+ } catch {+ /* file:// or restricted contexts — the URL is a convenience */+ }+}diff --git a/surfaces/gui/src/seal.ts b/surfaces/gui/src/seal.tsnew file mode 100644index 00000000..617db959--- /dev/null+++ b/surfaces/gui/src/seal.ts@@ -0,0 +1,70 @@+// Browser-side sealing (OPE-149) — byte-for-byte the same format as+// coworker/remote/identity.py::seal_b64, so the box's existing unseal opens+// it unchanged:+//+// ephemeral X25519 keypair → shared = X25519(eph_priv, machine_seal_pub)+// key = HKDF-SHA256(shared, salt=∅, info="openworker-seal-v1"‖eph_pub‖recipient_pub)+// blob = eph_pub(32) ‖ ChaCha20-Poly1305(key, nonce=12×0).encrypt(plaintext)+//+// A fresh ephemeral key per message is what makes the zero nonce safe.+// Plaintext exists only in this tab and on the box — the cloud relays the+// base64 blob and stores names/hashes, never values.++import { chacha20poly1305 } from "@noble/ciphers/chacha.js";+import { x25519 } from "@noble/curves/ed25519.js";+import { hkdf } from "@noble/hashes/hkdf.js";+import { sha256 } from "@noble/hashes/sha2.js";++const SEAL_INFO = new TextEncoder().encode("openworker-seal-v1");++const b64decode = (s: string): Uint8Array =>+ Uint8Array.from(atob(s), (c) => c.charCodeAt(0));++const b64encode = (bytes: Uint8Array): string => {+ let bin = "";+ for (const b of bytes) bin += String.fromCharCode(b);+ return btoa(bin);+};++const concat = (...parts: Uint8Array[]): Uint8Array => {+ const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));+ let at = 0;+ for (const p of parts) {+ out.set(p, at);+ at += p.length;+ }+ return out;+};++/** Seal `plaintext` to a machine's pinned sealing key (its base64 public+ * half, from the machines list). Returns the base64 blob the acceptor+ * relays as a `secret_deploy` frame. */+export function sealTo(recipientPubB64: string, plaintext: Uint8Array): string {+ const recipientPub = b64decode(recipientPubB64);+ if (recipientPub.length !== 32) throw new Error("bad sealing key");+ const ephPriv = x25519.utils.randomSecretKey();+ const ephPub = x25519.getPublicKey(ephPriv);+ const shared = x25519.getSharedSecret(ephPriv, recipientPub);+ const key = hkdf(sha256, shared, undefined, concat(SEAL_INFO, ephPub, recipientPub), 32);+ const ciphertext = chacha20poly1305(key, new Uint8Array(12)).encrypt(plaintext);+ return b64encode(concat(ephPub, ciphertext));+}++/** Seal a profiles payload for deploy: {profiles: {name: data}} — the exact+ * JSON the box-side `handle_secret_deploy` expects to unseal. */+export function sealProfiles(+ recipientPubB64: string,+ profiles: Record<string, Record<string, unknown>>,+): string {+ return sealTo(recipientPubB64, new TextEncoder().encode(JSON.stringify({ profiles })));+}++/** sha256 hex of a value — the deploy ledger's staleness reference. Not a+ * canonical-JSON match for the wallet's hash (different serializers); on a+ * wallet-less deployment nothing ever compares them across sources. */+export async function profileHash(data: Record<string, unknown>): Promise<string> {+ const bytes = new TextEncoder().encode(JSON.stringify(data));+ return Array.from(sha256(bytes))+ .map((b) => b.toString(16).padStart(2, "0"))+ .join("");+}diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.cssindex db0f5fce..636bcbf1 100644--- a/surfaces/gui/src/styles.css+++ b/surfaces/gui/src/styles.css@@ -59,15 +59,16 @@:root {color-scheme: light;- --paper: #f5f6f7; /* cool light gray — washes/chips over panel or canvas */+ --paper: #f3f4f6; /* cool light gray — washes/chips over panel or canvas */--panel: #ffffff;/* UX-039 surface hierarchy: content brightest, chrome tinted. The chat column sits on--canvas; the sidebar + right rail sit on --chrome and recede. Canvas is a whisperoff pure white (owner call 2026-08-21: full #fff read as glare) — still clearlybrighter than the chrome, and panel-white cards still lift off it. */- --canvas: #fafbfc;- --chrome: #f7f8f9;- --chrome-hover: #eef0f2;+ --canvas: #ffffff; /* UX-048: the reading column is pure white */+ --chrome: #fafafa; /* UX-048: neutral 98% white, v0's shell value (owner 2026-09-03); the hairline on the sidebar carries the split */+ --chrome-hover: #e9ebee;+ --placeholder: #a6acb4; /* UX-048: hint text, lighter than faint on purpose *//* The canvas edge: a soft bloom over the chrome (with the hairline) so the contentreads as a sheet, not a tile meeting a tile. Owner call 2026-08-21. */--edge-shadow: -14px 0 28px -18px rgba(15, 18, 22, 0.12);@@ -89,7 +90,7 @@--teal-ink: #0f766e; /* connector approval badges */--teal-line: #cfebea;--teal-soft: #edfafa;- --solid: #e9ebf0; /* user bubble — a soft neutral fill (was near-black; too heavy in light) */+ --solid: #f0f1f4; /* user bubble — a soft neutral fill (lightened 2026-09-03) */--on-solid: #1f2227;--glass: rgba(255, 255, 255, 0.9); /* frosted bars over content */--glass-strong: rgba(255, 255, 255, 0.96);@@ -103,15 +104,32 @@--mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;/* Type scale (OPE-126): six sizes, nothing else ships. The hiw-* Slack miniature isillustration artwork, exempt; glyph-only sizes (✕, marks) aren't text. */+ /* UX-048 (2026-09-03): the whole scale moved one notch up; labels are sentence case,+ weight 500, no tracking. Tailwind exposes these as text-title/heading/body/ui/meta/label. */--fs-title: 20px; /* 600 — page titles */--fs-heading: 16px; /* 600 — section headings, letter-spacing -0.01em */- --fs-body: 14px; /* 400 — transcript/reading, lh ~1.6 */+ --fs-body: 14px; /* 400 — transcript/reading (owner-picked default 2026-09-03) */--fs-ui: 13px; /* 400 — UI default: nav, rows, controls */- --fs-mono: 12px; /* 400 mono — machine content, chips, meta */- --fs-label: 11px; /* 600 — uppercase labels (+0.08em) and captions */- /* The right rail's width while reading an artifact (wider than the 332px inspector). */+ --fs-meta: 12px; /* 400 — secondary text: captions, descriptions, chips */+ --fs-mono: 12px; /* 400 mono — machine content */+ --fs-label: 11px; /* 500 — section labels, sentence case */+ --lh-body: 1.6;+ --lh-ui: 1.45;+ /* The right rail's width while reading an artifact (wider than the 332px inspector).+ Declared here, on the base :root, so it exists at EVERY text size — it once lived only+ under data-text-size="large", which left the rail, the chat margin and the topbar's right+ edge with no value at the default size (owner catch 2026-09-16: chat ran under the+ artifact panel and the topbar shrank until the title sat on the reveal button). */--artifact-rail-w: min(62vw, 960px);}+/* Text size (Settings ▸ General, per device — src/textSize.ts): one notch either side of the+ default. The owner reviewed 14/15/17 in the app (2026-09-03): 14 best, 15 fine, 17 ugly. */+:root[data-text-size="small"] {+ --fs-heading: 15px; --fs-body: 13px; --fs-ui: 12px; --fs-meta: 11px; --fs-mono: 11px; --fs-label: 11px;+}+:root[data-text-size="large"] {+ --fs-heading: 17px; --fs-body: 15px; --fs-ui: 14px; --fs-meta: 13px; --fs-mono: 13px; --fs-label: 12px;+}/* Dark palette. `data-theme` is set on <html> by an inline script in index.html (pre-paint)and kept current by src/theme.ts (Light / Dark / Auto-as-system, stored in localStorage). */@@ -123,6 +141,7 @@ html[data-theme="dark"] {--canvas: #191b1f;--chrome: #16171b;--chrome-hover: #212329;+ --placeholder: #55595f;--edge-shadow: -14px 0 28px -18px rgba(0, 0, 0, 0.55);--ink: #e6e8eb;--muted: #9aa1ab;@@ -175,6 +194,9 @@ body {hook for the overlay hide rule. */.sidebar {min-height: 0;+ /* Hairline edge (owner 2026-09-03): half a CSS pixel = one device pixel on Retina, the+ thinnest line the display draws; 1x screens round it up to a normal 1px line. */+ border-right: 0.5px solid var(--line);}/* ---------- collapsible left nav (⌘B + hover-peek) ---------- */@@ -235,28 +257,28 @@ body {/* Full-page sub-navs (Settings / Connectors) start at the window top; while the main nav iscollapsed, the fixed reveal button (and, in the overlay build, the traffic lights) float overthat corner — push the sub-nav header below the strip so they never overlap. */-.app.nav-collapsed .page-subnav { padding-top: 48px; }-.app.nav-collapsed.tauri-overlay .page-subnav { padding-top: 56px; }+/* Settings nav in the sidebar column (Sidebar.tsx settingsRail): nothing extra — the brand+ row above it already clears the traffic lights under the overlay build. */.tabs { display: flex; gap: 4px; background: var(--paper); padding: 4px; border-radius: 10px; }.tab {flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;padding: 6px 8px; border-radius: 7px;- font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;+ font-size: var(--fs-ui); color: var(--muted); cursor: pointer; user-select: none;}.tab.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }.tab.disabled { opacity: 0.4; cursor: default; }/* -- Channel subscriptions: the per-session composer chip + popover -------- */.sub-chip { display: inline-flex; align-items: center; gap: 4px; }-.chan-input { font: inherit; font-size: 13px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); }+.chan-input { font: inherit; font-size: var(--fs-ui); padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); }.chan-input { min-width: 220px; }.sub-chip-wrap { position: relative; display: inline-flex; }.wschip.sub-chip.active { border-color: var(--accent); color: var(--accent); }.sub-pop { position: absolute; bottom: calc(100% + 8px); right: 0; width: 300px; z-index: 40; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); padding: 12px; }-.sub-pop-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 8px; }-.sub-pop-empty { font-size: 13px; padding: 2px 0 8px; }-.sub-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13px; }+.sub-pop-head { font-size: var(--fs-meta); font-weight: 500; color: var(--muted); margin-bottom: 8px; }+.sub-pop-empty { font-size: var(--fs-ui); padding: 2px 0 8px; }+.sub-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: var(--fs-ui); }.sub-pop-chan { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.sub-pop-x { border: 0; background: none; color: var(--faint); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }.sub-pop-x:hover { color: var(--ink); }@@ -297,7 +319,7 @@ body {position: absolute; left: 50%; top: 0; height: 100%; transform: translateX(-50%);max-width: max(96px, calc(100% - 332px));display: flex; flex-direction: column; align-items: center; justify-content: center;- font-size: 13px; font-weight: 600; color: var(--ink);+ font-size: var(--fs-ui); font-weight: 600; color: var(--ink);}/* The overlay build pads the collapsed cluster past the traffic lights — reserve that too. */.app.nav-collapsed.tauri-overlay .main-title { max-width: max(96px, calc(100% - 416px)); }@@ -306,7 +328,7 @@ body {/* The facts subtitle — fixed facts, not controls (persona · model · folder); click → coworker page. */.title-sub {border: 0; background: none; padding: 0; font: inherit;- font-size: 11px; font-weight: 400; line-height: 1.25; color: var(--faint);+ font-size: var(--fs-label); font-weight: 400; line-height: 1.25; color: var(--faint);max-width: min(460px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;}.title-sub:hover { color: var(--muted); }@@ -341,15 +363,15 @@ body {.greeting { font-family: var(--serif); font-size: 40px; line-height: 1.1; margin: 0 0 18px; }.greeting .mark { color: var(--accent); margin-right: 10px; }.suggestions { margin-top: 40px; display: flex; flex-direction: column; }-.suggest-head { font-size: 13px; color: var(--muted); margin-bottom: 6px; }+.suggest-head { font-size: var(--fs-ui); color: var(--muted); margin-bottom: 6px; }.suggest {display: flex; align-items: center; gap: 11px; padding: 11px 6px;- border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); font-size: 14px;+ border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); font-size: var(--fs-ui);}.suggest:hover { color: var(--accent); }.suggest .ico {width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px;- display: grid; place-items: center; background: var(--panel); font-size: 13px;+ display: grid; place-items: center; background: var(--panel); font-size: var(--fs-ui);color: var(--muted); flex: none;}@@ -358,7 +380,8 @@ body {.main-scroll). The user bubble is restyled inline with Tailwind utilities on the element. */.transcript { max-width: 768px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }.bubble-assistant { font-size: var(--fs-body); line-height: 1.6; white-space: pre-wrap; }-.bubble-assistant .who { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }+.bubble-assistant .who { font-size: var(--fs-label); font-weight: 500; color: var(--faint); margin-bottom: 4px; opacity: 0; transition: opacity .12s; }+.bubble-assistant:hover .who, .bubble-assistant:focus-within .who { opacity: 1; } /* UX-048: metadata on request *//* markdown-rendered assistant content (the bubble's pre-wrap would double-space block output) */.md { white-space: normal; font-size: var(--fs-body); line-height: 1.6; color: var(--ink); }@@ -389,11 +412,11 @@ body {/* code */.md code {font-family: var(--mono); font-size: var(--fs-mono);- background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;+ background: var(--paper); border-radius: 4px; padding: 1px 5px; /* UX-048: no box edge */}.md pre {margin: 4px 0 14px; padding: 12px 14px; overflow-x: auto;- background: var(--paper); border: 1px solid var(--line); border-radius: 12px;+ background: var(--paper); border-radius: 12px; /* UX-048: the fill is the edge */}.md pre code { background: none; border: none; padding: 0; font-size: var(--fs-mono); line-height: 1.55; }@@ -403,9 +426,9 @@ body {/* tables — header tint, zebra rows, roomier cells (kept block-scrollable for wide tables) */.md table { display: block; overflow-x: auto; border-collapse: collapse; margin: 6px 0 14px; font-size: var(--fs-ui); }-.md th, .md td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; vertical-align: top; }-.md th { background: var(--paper); font-weight: 600; color: var(--muted); white-space: nowrap; }-.md tbody tr:nth-child(even) { background: color-mix(in srgb, var(--paper) 45%, transparent); }+/* UX-048: row hairlines only — alignment does the work cell borders used to. */+.md th, .md td { border: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }+.md th { font-weight: 500; color: var(--muted); white-space: nowrap; }.md a { color: var(--accent); text-decoration: none; }.md a:hover { text-decoration: underline; }@@ -416,7 +439,7 @@ body {.waiting-transcript { max-width: 760px; margin: 18px auto 0; display: flex; }.waiting-row {display: inline-flex; align-items: center; gap: 9px; align-self: flex-start;- color: var(--muted); font-size: 13px; line-height: 1;+ color: var(--muted); font-size: var(--fs-ui); line-height: 1;}.waiting-spinner {width: 14px; height: 14px; border-radius: 50%;@@ -427,15 +450,31 @@ body {.tool {border: 1px solid var(--line); border-radius: 9px; background: var(--panel);- padding: 8px 11px; font-size: 13px; color: var(--muted);+ padding: 8px 11px; font-size: var(--fs-ui); color: var(--muted);}-.tool .name { font-family: var(--mono); color: var(--ink); font-size: 13px; }-.tool .args { font-family: var(--mono); font-size: 12px; color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.tool .status { float: right; font-size: 11px; }+.tool .name { font-family: var(--mono); color: var(--ink); font-size: var(--fs-ui); }+.tool .args { font-family: var(--mono); font-size: var(--fs-meta); color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.tool .status { float: right; font-size: var(--fs-label); }.tool .status.ok { color: var(--ok); }.tool .status.denied, .tool .status.error { color: var(--accent); }-.notice { font-size: 13px; color: var(--muted); text-align: center; }+.notice { font-size: var(--fs-ui); color: var(--muted); text-align: center; }+/* Session socket dropped (machine link or local sidecar): a quiet strip above the composer+ while the client retries — the composer itself is disabled, this says why. */+.reconnecting-strip {+ display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px;+ padding: 8px 12px; border-radius: 9px; font-size: var(--fs-ui); color: var(--ink);+ border: 1px dashed var(--line); background: var(--paper);+}+.reconnecting-strip .reconnecting-sub { font-size: var(--fs-meta); color: var(--muted); }+/* Signed-out gate: the sidecar rejected this window's launch token. */+.unauthorized-card {+ max-width: 420px; margin: 18px auto 0; padding: 16px 18px; text-align: left;+ border: 1px solid var(--line); border-radius: 10px; background: var(--paper);+ display: flex; flex-direction: column; gap: 8px;+}+.unauthorized-title { font-weight: 600; color: var(--ink); }+.unauthorized-body { font-size: var(--fs-ui); color: var(--muted); line-height: 1.45; }.notice.warn { color: var(--accent); }/* Mode banner: prose, so it reads left-aligned in a card rather than as a centredstatus line. Same `notice` item, switched on by a title. */@@ -463,19 +502,19 @@ body {background: var(--accent-soft);}/* §35: the humanized headline — same voice as the transcript's step lines */-.approval-title { font-size: 14px; color: var(--ink); min-width: 0; }+.approval-title { font-size: var(--fs-ui); color: var(--ink); min-width: 0; }.approval-title b { font-weight: 600; }.approval-tool {- font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted);+ font-family: var(--mono); font-size: var(--fs-meta); font-weight: 400; color: var(--muted);background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; margin-left: 5px;}/* plain-words scope note replaces the "local action" badge */-.approval-scope { font-size: 11px; color: var(--faint); white-space: nowrap; padding-top: 3px; }+.approval-scope { font-size: var(--fs-label); color: var(--faint); white-space: nowrap; padding-top: 3px; }.approval-scope.out { color: var(--warn-ink); }.approval-external { border-color: var(--warn-ink); }/* the proposal preview — from the tool call's ARGS (the file/action doesn't exist yet) */.approval-prev {- margin-top: 11px; font-family: var(--mono); font-size: 12px; color: var(--muted);+ margin-top: 11px; font-family: var(--mono); font-size: var(--fs-meta); color: var(--muted);background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px;overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.55;/* Long previews (a 170-line skill) must scroll INSIDE the card — expanded content@@ -484,15 +523,17 @@ body {}.approval-prev-more {display: block; margin-top: 4px; font: inherit; font-family: var(--sans);- font-size: 12px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;+ font-size: var(--fs-meta); color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer;}-.approval-with { margin-top: 9px; font-size: 13px; color: var(--muted); }+/* Two-tone (owner-ruled 2026-09-17): in-card links are ink, not blue. */+.approval-prev-more:hover, .approval-peek:hover { color: var(--ink); text-decoration: underline; }+.approval-with { margin-top: 9px; font-size: var(--fs-ui); color: var(--muted); }/* long outbound messages: same box as code previews but reads as text, not code */-.approval-prev.prose { font-family: inherit; font-size: 13px; }+.approval-prev.prose { font-family: inherit; font-size: var(--fs-ui); }.approval-filechip {display: inline-flex; align-items: center; gap: 7px; margin-top: 11px; align-self: flex-start;border: 1px solid var(--line); border-radius: 9px; background: var(--paper);- padding: 5px 11px 5px 7px; font-size: 13px; color: var(--ink);+ padding: 5px 11px 5px 7px; font-size: var(--fs-ui); color: var(--ink);}.approval-filechip .ico {width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft);@@ -502,14 +543,14 @@ body {.approval-row { padding: 9px 12px; }.approval-row-line { display: flex; align-items: center; gap: 10px; min-width: 0; }.approval-row-line .approval-btns { margin-top: 0; flex-wrap: nowrap; }-.approval-peek { font: inherit; font-size: 12px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; flex: none; }+.approval-peek { font: inherit; font-size: var(--fs-meta); color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; flex: none; }/* owner call (UX-018): no solid fills — the primary action is a blue border */.approval .btn.approval-primary { border-color: var(--accent); color: var(--accent); font-weight: 600; }.approval .btn.approval-primary:hover { background: var(--accent-soft); }.approval .btn.quiet-deny { border: 0; background: none; color: var(--faint); }.approval .btn.quiet-deny:hover { color: var(--danger); }.approval-rest {- margin-top: 7px; font-family: var(--mono); font-size: 12px; color: var(--faint);+ margin-top: 7px; font-family: var(--mono); font-size: var(--fs-meta); color: var(--faint);display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}.approval-reason { margin-top: 8px; font-size: var(--fs-ui); color: var(--muted); }@@ -525,15 +566,28 @@ body {margin-top: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper);padding: 7px 10px; display: flex; flex-direction: column; gap: 5px;}-.approval-grant { display: flex; align-items: baseline; gap: 7px; font-size: 13px; color: var(--muted); }+.approval-grant { display: flex; align-items: baseline; gap: 7px; font-size: var(--fs-ui); color: var(--muted); }.approval-grant .grant-mark { color: var(--faint); width: 12px; text-align: center; flex: none; }.approval-grant .grant-mark.write { color: var(--teal-ink); font-weight: 600; }.approval-grant[data-access="write"] { color: var(--ink); }-.approval-grant .grant-note { color: var(--faint); font-size: 12px; }+.approval-grant .grant-note { color: var(--faint); font-size: var(--fs-meta); }+/* A lead's decision on a worker's waiting call (WorkerDecisionCard). Two-tone like the+ approval card: labels in faint ink, the worker's call and the lead's note as the content. */+.workerdec-title { font-size: var(--fs-body); color: var(--ink); }+.workerdec .approval-ico { background: var(--paper); color: var(--muted); }+.workerdec-label { margin-top: 11px; font-size: var(--fs-label); font-weight: 500; color: var(--faint); }+.workerdec-call { margin-top: 3px; }+.workerdec-note { margin-top: 3px; font-size: var(--fs-ui); color: var(--ink); line-height: 1.5; white-space: pre-wrap; }+.workerdec-missing, .workerdec-answered { margin-top: 4px; font-size: var(--fs-ui); color: var(--muted); }+.workerdec-answered { margin-top: 10px; }+.workerdec .btn.quiet-deny:hover { color: var(--ink); }+.workerdec.bare .approval-btns .btn.quiet-deny, .workerdec .btn.quiet-deny { border: 0; background: none; color: var(--faint); }+.workerdec.bare .btn.approval-primary { border-color: var(--accent); color: var(--accent); font-weight: 600; }+.workerdec.bare .btn.approval-primary:hover { background: var(--accent-soft); }.approval-btns { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; align-items: center; }.approval-btns .spacer { flex: 1; }-.approval .resolved { margin-top: 10px; font-size: 13px; color: var(--muted); }-button.btn { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; }+.approval .resolved { margin-top: 10px; font-size: var(--fs-ui); color: var(--muted); }+button.btn { font: inherit; font-size: var(--fs-ui); padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; }button.btn.icon-only { display: inline-flex; align-items: center; justify-content: center; padding: 7px 9px; flex: none; color: var(--muted); }button.btn.icon-only:hover { color: var(--ink); }button.btn:hover { background: var(--paper); }@@ -543,12 +597,12 @@ button.btn.danger { color: var(--accent); }/* composer — the wrap/card/head/bar layout is supplied by Tailwind utilities on the elements(Composer.tsx); only the textarea reset + drag-ring remain in CSS. */.composer textarea {- width: 100%; border: none; outline: none; resize: none; font: inherit; font-size: 14px; line-height: 1.45;+ width: 100%; border: none; outline: none; resize: none; font: inherit; font-size: var(--fs-ui); line-height: 1.45;background: transparent; color: var(--ink); min-height: 24px; overflow: hidden;/* Height (incl. the cap) is owned by the autogrow effect in Composer.tsx — aCSS max-height here fought it and re-created the OPE-106 clipping. */}-.composer textarea::placeholder { color: var(--faint); }+.composer textarea::placeholder { color: var(--placeholder); }.voice-wave-line { flex: 1; min-width: 28px; border-top: 1px dashed var(--line-strong); }.voice-wave-bars { height: 28px; display: inline-flex; align-items: center; gap: 2px; color: var(--accent); }.voice-wave-bars i {@@ -566,7 +620,7 @@ button.btn.danger { color: var(--accent); }the chevron glued to the label (the old inline pill let it wrap onto its own line). */.pill {display: inline-flex; align-items: center; gap: 3px; max-width: 240px;- font: inherit; font-size: 13px; color: var(--muted);+ font: inherit; font-size: var(--fs-ui); color: var(--faint); /* quiet at rest (owner 2026-09-03), ink on hover */border: none; border-radius: 7px; padding: 5px 8px; background: transparent; cursor: pointer;}.pill:hover { color: var(--ink); background: var(--paper); }@@ -575,15 +629,32 @@ button.btn.danger { color: var(--accent); }just warn-colored text + a small glyph, matching the other composer pills. */.pill.model-warn { color: var(--warn-ink); }.pill.model-warn:hover { color: var(--warn-ink); background: var(--paper); }-.model-warn-ico { color: var(--warn-ink); font-size: 12px; line-height: 1; }+.model-warn-ico { color: var(--warn-ink); font-size: var(--fs-meta); line-height: 1; }.pill .caret { color: var(--faint); flex: none; }.pill:hover .caret { color: var(--muted); }/* Bordered chip variant (composer-head model selector) — mock's `bg-paper border border-line`. */-.pill.chip { background: var(--paper); border: 1px solid var(--line); }-.pill.chip:hover { border-color: var(--line-strong); background: var(--paper); }+/* UX-048: text at rest, the border appears on hover — one visual weight for the whole bar. */+.pill.chip { background: transparent; border: 1px solid transparent; }+.pill.chip:hover { border-color: var(--line); background: var(--paper); }/* dropdown popover */.dd { position: relative; }+/* Hover card above a pill (UX-048): inverse surface, short delay (Dropdown.tsx). */+.dd-tip {+ position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 30; min-width: 220px; max-width: 320px;+ --tip-hole: var(--ink);+ background: var(--ink); color: var(--canvas); border-radius: 10px; padding: 10px 12px;+ font-size: var(--fs-meta); line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);+ pointer-events: none; white-space: nowrap;+}+.dd-tip.right { left: auto; right: 0; }+.dd-tip::after {+ content: ""; position: absolute; top: 100%; right: 14px; border: 6px solid transparent; border-top-color: var(--ink);+}+.dd-tip-title { font-weight: 600; }+.dd-tip-sub { opacity: 0.7; }+.dd-tip-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }+.dd-tip-hint { margin-top: 8px; opacity: 0.6; font-size: var(--fs-label); }.dd-backdrop { position: fixed; inset: 0; z-index: 20; }.dd-menu {position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 21;@@ -594,12 +665,12 @@ button.btn.danger { color: var(--accent); }.dd-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }.dd-item:hover { background: var(--paper); }.dd-item.sel .dd-label { color: var(--accent); }-.dd-label { font-size: 13px; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }+.dd-label { font-size: var(--fs-ui); color: var(--ink); display: flex; justify-content: space-between; align-items: center; }.dd-item .chk { color: var(--accent); }-.dd-desc { font-size: 12px; color: var(--faint); margin-top: 1px; }+.dd-desc { font-size: var(--fs-meta); color: var(--faint); margin-top: 1px; }.send { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer; font-size: 16px; }.send:disabled { opacity: 0.4; cursor: default; }-.statusline { max-width: 760px; margin: 6px auto 0; font-size: 12px; color: var(--faint); display: flex; gap: 12px; }+.statusline { max-width: 760px; margin: 6px auto 0; font-size: var(--fs-meta); color: var(--faint); display: flex; gap: 12px; }.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }.dot.idle { background: var(--faint); }.dot.running { background: var(--ok); }@@ -607,7 +678,7 @@ button.btn.danger { color: var(--accent); }.approval-inline {display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;- color: var(--muted); font-size: 13px; background: var(--panel);+ color: var(--muted); font-size: var(--fs-ui); background: var(--panel);border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;}.approval-inline .status { color: var(--ok); }@@ -641,33 +712,38 @@ button.btn.danger { color: var(--accent); }.artifact-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; }.rail-section { border-bottom: 1px solid var(--line); padding: 11px 0; }.rail-section-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 24px; }-.rail-section-toggle { flex: 1; display: flex; gap: 8px; align-items: center; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); user-select: none; border: 0; background: transparent; padding: 0; text-align: left; }+.rail-section-toggle { flex: 1; display: flex; gap: 8px; align-items: center; cursor: pointer; font: inherit; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); user-select: none; border: 0; background: transparent; padding: 0; text-align: left; }.rail-chev { color: var(--faint); flex: none; }.rail-mini-btn { width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); border: 0; border-radius: 7px; background: transparent; cursor: pointer; }.rail-mini-btn:hover { color: var(--ink); background: var(--chrome-hover); }.rail-section-body { padding-top: 10px; }/* Seventeenth pass: a section header's maximum signal — a small count chip, amber onlywhen it carries attention states (blocked/review). */-.rail-count { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; flex: none; }+.rail-count { margin-left: auto; font-size: var(--fs-label); font-weight: 500; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; flex: none; }.rail-count.attention { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); }/* Journal + Access fold behind this quiet row (three primary sections max). */-.rail-more-row { display: flex; gap: 8px; align-items: center; width: 100%; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; font: inherit; font-size: 12px; color: var(--faint); text-align: left; }+.rail-more-row { display: flex; gap: 8px; align-items: center; width: 100%; padding: 11px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; font: inherit; font-size: var(--fs-meta); color: var(--faint); text-align: left; }.rail-more-row:hover { color: var(--muted); }/* The Team panel — member rows; click = the altitude-3 escape hatch into that worker's session. */.rail-team { display: flex; flex-direction: column; gap: 1px; }.rail-team-row { display: flex; gap: 9px; align-items: center; width: 100%; padding: 6px 6px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font: inherit; text-align: left; }.rail-team-row:hover { background: var(--chrome-hover); }.rail-team-row:hover .rail-team-open { opacity: 1; }-.rail-team-name { font-size: 13px; font-weight: 550; color: var(--ink); flex: none; }-.rail-team-item { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }-.rail-team-open { font-size: 11px; color: var(--accent); opacity: 0; flex: none; }+.rail-team-name { font-size: var(--fs-ui); font-weight: 550; color: var(--ink); flex: none; }+.rail-team-item { font-size: var(--fs-meta); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }+.rail-team-open { font-size: var(--fs-label); color: var(--accent); opacity: 0; flex: none; }.rail-chat-row .rail-team-name { font-weight: 500; color: var(--muted); }-.rail-muted { font-size: 12px; color: var(--faint); line-height: 1.45; overflow-wrap: anywhere; }-.rail-error { font-size: 12px; color: var(--accent); overflow-wrap: anywhere; }+/* Tokens by model for the team (spec §5): a quiet block after the members, counts only. */+.rail-team-usage { margin-top: 4px; padding: 6px 6px 2px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }+.rail-team-usage-head { display: flex; justify-content: space-between; font-size: var(--fs-ui); font-weight: 550; color: var(--ink); }+.rail-team-usage-row { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-meta); color: var(--faint); }+.rail-team-usage-model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }+.rail-muted { font-size: var(--fs-meta); color: var(--faint); line-height: 1.45; overflow-wrap: anywhere; }+.rail-error { font-size: var(--fs-meta); color: var(--accent); overflow-wrap: anywhere; }.rail-todo-list { display: flex; flex-direction: column; gap: 9px; }.rail-todo {display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: flex-start;- font-size: 13px; line-height: 1.35; color: var(--muted);+ font-size: var(--fs-ui); line-height: 1.35; color: var(--muted);}.rail-todo-mark {width: 12px; height: 12px; margin-top: 2px; border: 1.6px solid var(--line-strong);@@ -687,7 +763,7 @@ button.btn.danger { color: var(--accent); }border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(-45deg);}.rail-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }-.rail-actions .btn { padding: 6px 9px; font-size: 12px; border-radius: 8px; }+.rail-actions .btn { padding: 6px 9px; font-size: var(--fs-meta); border-radius: 8px; }.browser-mini { display: flex; flex-direction: column; gap: 8px; }.browser-shot { display: block; width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }.artifact-list { display: flex; flex-direction: column; gap: 7px; }@@ -698,9 +774,9 @@ button.btn.danger { color: var(--accent); }}.artifact-row:hover { border-color: var(--line); background: var(--panel); }.artifact-ico { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }-.artifact-name { display: flex; flex-direction: column; gap: 1px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.artifact-row-meta { font-size: 11px; color: var(--faint); font-weight: 400; }-.artifact-open { font-size: 12px; color: var(--faint); }+.artifact-name { display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.artifact-row-meta { font-size: var(--fs-label); color: var(--faint); font-weight: 400; }+.artifact-open { font-size: var(--fs-meta); color: var(--faint); }.artifact-viewer { display: flex; flex-direction: column; min-height: 0; height: 100%; }.artifact-head {flex: none; min-height: 58px; padding: 10px 18px; border-bottom: 1px solid var(--line);@@ -713,10 +789,10 @@ button.btn.danger { color: var(--accent); }}.artifact-icon-btn:hover { background: var(--paper); color: var(--ink); }.artifact-heading { flex: 1; min-width: 0; }-.artifact-title { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; white-space: nowrap; }+.artifact-title { display: flex; align-items: center; gap: 7px; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); overflow: hidden; white-space: nowrap; }.artifact-title span:last-child { overflow: hidden; text-overflow: ellipsis; }.artifact-sep { color: var(--faint); font-weight: 400; }-.artifact-path { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }+.artifact-path { font-size: var(--fs-meta); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }.artifact-preview { min-height: 0; flex: 1; overflow: auto; background: var(--panel); }.artifact-frame { width: 100%; height: 100%; min-height: calc(100vh - 86px); border: 0; background: #fff; }/* Checkerboard backdrop so white/transparent images still read as an image, not a blank pane. */@@ -725,7 +801,7 @@ button.btn.danger { color: var(--accent); }border: 1px solid var(--line);background: repeating-conic-gradient(var(--check-a) 0% 25%, var(--check-b) 0% 50%) 0 0 / 20px 20px;}-.artifact-code { margin: 0; padding: 22px 26px; font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre-wrap; color: var(--ink); }+.artifact-code { margin: 0; padding: 22px 26px; font-family: var(--mono); font-size: var(--fs-ui); line-height: 1.55; white-space: pre-wrap; color: var(--ink); }/* Non-previewable binaries (Office docs): a centered prompt to open in the default app. */.artifact-open-prompt {height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;@@ -742,7 +818,7 @@ button.btn.danger { color: var(--accent); }/* csv / spreadsheet preview */.artifact-tablewrap { padding: 14px 16px 40px; overflow: auto; }-.artifact-table { border-collapse: collapse; font-size: 13px; white-space: nowrap; }+.artifact-table { border-collapse: collapse; font-size: var(--fs-ui); white-space: nowrap; }.artifact-table th, .artifact-table td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }.artifact-table th { background: var(--paper); font-weight: 600; position: sticky; top: 0; }.artifact-table-note { padding: 10px 16px; }@@ -750,13 +826,13 @@ button.btn.danger { color: var(--accent); }.sheet-viewer .artifact-tablewrap { flex: 1; min-height: 0; }.sheet-tabs { display: flex; gap: 4px; padding: 9px 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex: none; }.sheet-tab {- font: inherit; font-size: 12px; color: var(--muted); cursor: pointer;+ font: inherit; font-size: var(--fs-meta); color: var(--muted); cursor: pointer;border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0;background: transparent; padding: 6px 12px;}.sheet-tab.active { color: var(--ink); background: var(--panel); border-color: var(--line); }/* markdown artifacts reuse the shared .md renderer inside a readable padded column */-.artifact-md { padding: 26px 28px 70px; font-size: 14px; line-height: 1.6; color: var(--ink); }+.artifact-md { padding: 26px 28px 70px; font-size: var(--fs-body); line-height: 1.6; color: var(--ink); }.artifact-md .md h1 { font-size: 24px; }.artifact-md .md h2 { font-size: 20px; margin-top: 22px; }@@ -764,7 +840,7 @@ button.btn.danger { color: var(--accent); }/* Workspace chip lives INSIDE the composer card's head row (top chip row, Tailwind-laid-out). */.wschip {display: inline-flex; align-items: center; gap: 6px;- font: inherit; font-size: 13px; color: var(--ink);+ font: inherit; font-size: var(--fs-ui); color: var(--ink);background: var(--paper); border: 1px solid var(--line); border-radius: 8px;padding: 4px 9px; cursor: pointer; max-width: 60%;}@@ -775,7 +851,7 @@ button.btn.danger { color: var(--accent); }.wschip-icon:hover { background: var(--paper); color: var(--ink); border: none; }.wschip .edit { color: var(--faint); flex: none; }.wschip:hover .edit { color: var(--muted); }-.wsbranch { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--faint); }+.wsbranch { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-meta); color: var(--faint); }/* roots manager (orphan Cowork directories) */.rootsbar { position: relative; display: inline-flex; }@@ -786,51 +862,51 @@ button.btn.danger { color: var(--accent); }background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px;box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);}-.roots-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); padding: 2px 6px 8px; }+.roots-head { font-size: var(--fs-label); color: var(--faint); padding: 2px 6px 8px; }.root-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; }.root-row:hover { background: var(--paper); }.root-row.missing { opacity: 0.6; }.root-ico { color: var(--muted); flex: none; }.root-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }-.root-label { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.root-path { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }-.root-tag { font-size: 11px; color: var(--muted); background: var(--line); border-radius: 5px; padding: 1px 5px; flex: none; }+.root-label { font-size: var(--fs-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.root-path { font-size: var(--fs-label); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }+.root-tag { font-size: var(--fs-label); color: var(--muted); background: var(--line); border-radius: 5px; padding: 1px 5px; flex: none; }.root-tag.warn { color: var(--warn-ink); background: var(--warn-soft); }.root-access {- font: inherit; font-size: 11px; cursor: pointer; flex: none;+ font: inherit; font-size: var(--fs-label); cursor: pointer; flex: none;border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; background: var(--paper); color: var(--muted);}.root-access.rw { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }.root-access:disabled { cursor: default; opacity: 0.7; }-.root-x { font: inherit; font-size: 14px; line-height: 1; color: var(--faint); background: none; border: none; cursor: pointer; padding: 0 4px; flex: none; }+.root-x { font: inherit; font-size: var(--fs-ui); line-height: 1; color: var(--faint); background: none; border: none; cursor: pointer; padding: 0 4px; flex: none; }.root-x:hover { color: var(--ink); }.roots-add { padding: 8px 2px 2px; border-top: 1px solid var(--line); margin-top: 6px; }-.roots-err { color: var(--danger); font-size: 12px; padding: 6px 6px 2px; }+.roots-err { color: var(--danger); font-size: var(--fs-meta); padding: 6px 6px 2px; }/* add-folder form (shared: roots popover + session start panel) */.addfolder-trigger {display: inline-flex; align-items: center; gap: 7px; width: 100%; justify-content: center;- font: inherit; font-size: 13px; cursor: pointer; color: var(--ink);+ font: inherit; font-size: var(--fs-ui); cursor: pointer; color: var(--ink);background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 7px 10px;}.addfolder-trigger:hover { border-color: var(--accent); color: var(--accent); }-.addfolder-trigger.compact { font-size: 12px; padding: 6px 9px; }+.addfolder-trigger.compact { font-size: var(--fs-meta); padding: 6px 9px; }.addfolder-form { display: flex; flex-direction: column; gap: 8px; padding: 2px; }.addfolder-row { display: flex; gap: 8px; align-items: center; }.addfolder-path {- flex: 1; font: inherit; font-size: 13px; color: var(--ink);+ flex: 1; font: inherit; font-size: var(--fs-ui); color: var(--ink);background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; outline: none;}.addfolder-path:focus { border-color: var(--accent); }.addfolder-actions { display: flex; align-items: center; gap: 10px; }-.addfolder-write { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }+.addfolder-write { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--muted); cursor: pointer; }.addfolder-actions .spacer { flex: 1; }/* Cowork session start panel */.intro { max-width: 640px; margin: 0 auto; padding: 40px 20px 24px; }.intro .greeting { font-size: 26px; font-weight: 600; display: flex; align-items: center; gap: 10px; }.intro .greeting .mark { color: var(--accent); }-.intro-lede { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 8px 0 0; }+.intro-lede { color: var(--muted); font-size: var(--fs-body); line-height: 1.5; margin: 8px 0 0; }/* Template tasks on the Cowork start screen (§27): flat hairline rows, no icon tiles — thetitle is the row. Connector dots on the sub-line (brand color = live for this session,@@ -856,11 +932,11 @@ button.btn.danger { color: var(--accent); }}.task-card:first-child { border-top: none; }.task-card-body { flex: 1; min-width: 0; }-.task-card-title { display: block; font-size: 14px; transition: color 0.12s; }+.task-card-title { display: block; font-size: var(--fs-ui); transition: color 0.12s; }.task-card:hover .task-card-title { color: var(--accent); }.task-card-sub {display: flex; align-items: center; gap: 7px;- font-size: 13px; color: var(--faint); margin-top: 3px;+ font-size: var(--fs-ui); color: var(--faint); margin-top: 3px;}.task-dot {width: 18px; height: 18px; border-radius: 50%; flex: none;@@ -870,7 +946,7 @@ button.btn.danger { color: var(--accent); }.task-dot + .task-dot { margin-left: -4px; }.task-dot.off { filter: grayscale(1); opacity: 0.7; }.task-card-act {- color: var(--faint); font-size: 13px; flex: none;+ color: var(--faint); font-size: var(--fs-ui); flex: none;opacity: 0; transition: opacity 0.12s;}.task-card:hover .task-card-act { opacity: 1; color: var(--accent); }@@ -882,7 +958,7 @@ button.btn.danger { color: var(--accent); }padding: 5px 10px; margin-right: 6px;border: 1px solid var(--line-strong); border-radius: 8px;background: var(--panel); color: var(--muted); cursor: pointer;- font: inherit; font-size: 13px;+ font: inherit; font-size: var(--fs-ui);}.topbar-artifacts-btn:hover { color: var(--ink); border-color: var(--accent); }.topbar-artifacts-count {@@ -890,33 +966,38 @@ button.btn.danger { color: var(--accent); }an active state, or a live signal — the accent budget says no cobalt here. */min-width: 17px; padding: 0 5px; border-radius: 9px;background: color-mix(in srgb, var(--faint) 28%, transparent);- color: var(--ink); font-size: 11px; font-weight: 600; text-align: center;+ color: var(--ink); font-size: var(--fs-label); font-weight: 600; text-align: center;}/* the inline add-folder form sits under the "Analyze the files in a directory" task row */.intro-addfolder { padding: 4px 6px 14px 6px; border-top: 1px solid var(--line); }/* request_directory prompt (agent-initiated) */+/* Parked in the Inbox the card sits inside the Inbox item's own panel, which is the one+ box: no border, padding or lift of its own (owner catch 2026-09-17: "two boxes"). */+.gate-nested .dirreq-card { box-shadow: none; border: 0; padding: 0; margin: 0; max-width: none; background: transparent; }.dirreq-card {- background: var(--panel); border: 1px solid var(--accent); border-radius: 12px;- padding: 12px 14px; box-shadow: 0 0 0 3px var(--accent-soft);+ /* Two-tone (owner-ruled 2026-09-17): the same neutral border and lift as the approval+ card. Blue is kept for the one primary button; everything else on a card is ink. */+ background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px;+ padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);/* Same column as the composer/approval dock — full-bleed on wide monitors readbroken (owner catch 2026-08-15 on the tool-request card). */max-width: 760px; margin: 0 auto 9px;}-.dirreq-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink); }-.dirreq-head .ico { color: var(--accent); }-.dirreq-reason { font-size: 13px; color: var(--muted); font-style: italic; margin: 6px 0 10px; }+.dirreq-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--fs-ui); color: var(--ink); }+.dirreq-head .ico { color: var(--muted); }+.dirreq-reason { font-size: var(--fs-ui); color: var(--muted); font-style: italic; margin: 6px 0 10px; }/* the coworker's justification gets an explicit label — the quote alone made readerswork out what the italic line was */.toolreq-label { font-style: normal; font-weight: 600; color: var(--ink); }/* request_tool fact strip — the product's own metadata (version, publisher, checksum),deliberately NOT italic so it can't be misread as the coworker still talking */.toolreq-facts {- font-size: 13px; color: var(--muted); font-style: normal;+ font-size: var(--fs-ui); color: var(--muted); font-style: normal;background: var(--paper); border: 1px solid var(--line); border-radius: 8px;padding: 7px 10px; margin: 2px 0 10px;}-.toolreq-facts code { color: var(--ink); font-size: 13px; }+.toolreq-facts code { color: var(--ink); font-size: var(--fs-ui); }.toolreq-factrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }.toolreq-factrow code + .toolreq-fact::before { content: "· "; color: var(--muted); }.toolreq-explain { margin-top: 4px; }@@ -925,17 +1006,17 @@ button.btn.danger { color: var(--accent); }.dirreq-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }.dirreq-pathrow { display: flex; gap: 8px; align-items: center; }.dirreq-path {- flex: 1; font: inherit; font-size: 13px; color: var(--ink);+ flex: 1; font: inherit; font-size: var(--fs-ui); color: var(--ink);background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; outline: none;}.dirreq-path:focus { border-color: var(--accent); }.dirreq-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }-.dirreq-access { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }+.dirreq-access { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-ui); color: var(--muted); cursor: pointer; }.dirreq-actions .spacer { flex: 1; }/* propose_plan prompt (plan-mode exit) */.plan-card .plan-body {- max-height: 320px; overflow-y: auto; font-size: 13px;+ max-height: 320px; overflow-y: auto; font-size: var(--fs-ui);margin: 8px 0 2px; padding: 8px 10px;background: var(--paper); border: 1px solid var(--line); border-radius: 8px;}@@ -945,19 +1026,19 @@ button.btn.danger { color: var(--accent); }.gate { width: 480px; max-width: 92vw; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 16px; padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,0.18); }.gate-mark { color: var(--accent); font-size: 22px; }.gate h2 { font-family: var(--serif); font-size: 24px; margin: 6px 0 4px; }-.gate-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }+.gate-sub { color: var(--muted); font-size: var(--fs-ui); margin: 0 0 16px; }.gate-input { display: flex; gap: 8px; }-.gate-input input { flex: 1; font: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); outline: none; }+.gate-input input { flex: 1; font: inherit; font-size: var(--fs-ui); padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel); outline: none; }.gate-input input:focus { border-color: var(--accent); }-.gate-error { color: var(--accent); font-size: 13px; margin-top: 8px; }-.gate-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin: 18px 0 6px; }+.gate-error { color: var(--accent); font-size: var(--fs-ui); margin-top: 8px; }+.gate-label { font-size: var(--fs-label); color: var(--faint); margin: 18px 0 6px; }.gate-recents { display: flex; flex-direction: column; max-height: 200px; overflow-y: auto; }.gate-recent { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }.gate-recent:hover { background: var(--panel); }-.gate-recent .folder { font-size: 14px; color: var(--ink); }-.gate-recent .dim { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.gate-recent .folder { font-size: var(--fs-ui); color: var(--ink); }+.gate-recent .dim { font-size: var(--fs-meta); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.gate-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }-.gate-link { font-size: 13px; color: var(--accent); cursor: pointer; }+.gate-link { font-size: var(--fs-ui); color: var(--accent); cursor: pointer; }.gate-link:hover { text-decoration: underline; }.gate-cancel { margin: 0; }@@ -967,7 +1048,7 @@ button.btn.danger { color: var(--accent); }/* Small inline segmented control (Appearance: Light / Dark / Auto). */.seg { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 3px; border-radius: 9px; }-.seg button { font: inherit; font-size: 13px; padding: 5px 14px; border: none; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }+.seg button { font: inherit; font-size: var(--fs-ui); padding: 5px 14px; border: none; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }.seg button.active { background: var(--accent-soft); color: var(--ink); }/* Model checklist (Onboarding + Configure Models): tick = in the composer picker. */@@ -976,37 +1057,37 @@ button.btn.danger { color: var(--accent); }.mlist-row:hover { background: var(--panel); }.mlist-main { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; cursor: pointer; }.mlist-main input { accent-color: var(--accent); margin: 0; }-.mlist-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.mlist-name { font-size: var(--fs-ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.mlist-row.off .mlist-name { color: var(--muted); }.mlist-default {- background: var(--ink); color: var(--panel); font-size: 11px; font-weight: 600;+ background: var(--ink); color: var(--panel); font-size: var(--fs-label); font-weight: 600;padding: 2px 9px; border-radius: 999px; letter-spacing: 0.03em; flex: none;}.mlist-make {visibility: hidden; border: 1px solid var(--line-strong); background: var(--panel);- border-radius: 7px; padding: 3px 9px; font-size: 12px; color: var(--muted); cursor: pointer; flex: none;+ border-radius: 7px; padding: 3px 9px; font-size: var(--fs-meta); color: var(--muted); cursor: pointer; flex: none;}.mlist-row:hover .mlist-make { visibility: visible; }.mlist-make:hover { color: var(--ink); border-color: var(--ink); }.mlist-add { display: flex; gap: 8px; margin-top: 8px; }.mlist-add input {flex: 1; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px;- padding: 7px 10px; color: var(--ink); font: inherit; font-size: 13px; outline: none;+ padding: 7px 10px; color: var(--ink); font: inherit; font-size: var(--fs-ui); outline: none;}.mlist-add input:focus { border-color: var(--accent); }.mlist-add select {background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px;- padding: 7px 8px; color: var(--ink); font: inherit; font-size: 13px; outline: none;+ padding: 7px 8px; color: var(--ink); font: inherit; font-size: var(--fs-ui); outline: none;}.mlist-add select:focus { border-color: var(--accent); }/* .mcp-error is used by ScheduledView; the MCP servers list itself is Tailwind-styled inline(ManageTabs McpTab/McpRow/AddForm). */-.mcp-error { color: var(--accent); font-size: 13px; margin-top: 6px; }+.mcp-error { color: var(--accent); font-size: var(--fs-ui); margin-top: 6px; }-button.btn-primary { font: inherit; font-size: 13px; padding: 8px 16px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; align-self: flex-start; }+button.btn-primary { font: inherit; font-size: var(--fs-ui); padding: 8px 16px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; align-self: flex-start; }button.btn-primary:hover { filter: brightness(1.05); }-button.link { font: inherit; font-size: 13px; background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; }+button.link { font: inherit; font-size: var(--fs-ui); background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; }button.link:hover { color: var(--ink); }button.link.danger:hover { color: var(--accent); }button.link:disabled { color: var(--faint); cursor: default; }@@ -1019,22 +1100,22 @@ button.link:disabled { color: var(--faint); cursor: default; }.switch input:checked + .slider::before { transform: translateX(14px); }/* -- Connectors tab --------------------------------------------------------- */-.conn-name { font-size: 14px; color: var(--ink); display: flex; align-items: center; gap: 8px; }-.conn-meta { font-size: 12px; color: var(--faint); margin-top: 2px; display: flex; align-items: center; gap: 5px; }+.conn-name { font-size: var(--fs-ui); color: var(--ink); display: flex; align-items: center; gap: 8px; }+.conn-meta { font-size: var(--fs-meta); color: var(--faint); margin-top: 2px; display: flex; align-items: center; gap: 5px; }.conn-meta.ok, .conn-meta .ok { color: var(--ok); }.conn-meta.danger, .conn-meta .danger { color: var(--danger); }-button.btn-primary.sm { padding: 5px 13px; font-size: 13px; }-button.btn.sm { padding: 5px 13px; font-size: 13px; }+button.btn-primary.sm { padding: 5px 13px; font-size: var(--fs-ui); }+button.btn.sm { padding: 5px 13px; font-size: var(--fs-ui); }.conn-field { display: flex; flex-direction: column; gap: 4px; }-.conn-field-label { font-size: 13px; color: var(--ink); }+.conn-field-label { font-size: var(--fs-ui); color: var(--ink); }.conn-field-label em { color: var(--faint); font-style: normal; }-.conn-field input { font: inherit; font-size: 13px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); color: var(--ink); outline: none; }+.conn-field input { font: inherit; font-size: var(--fs-ui); padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); color: var(--ink); outline: none; }.conn-field input:focus { border-color: var(--accent); }/* Match the <select> (provider picker) to the text inputs: same box + a custom chevron so itisn't the browser-default control. */.conn-field select {- font: inherit; font-size: 13px; padding: 8px 32px 8px 11px;+ font: inherit; font-size: var(--fs-ui); padding: 8px 32px 8px 11px;border: 1px solid var(--line-strong); border-radius: 9px;background-color: var(--paper); color: var(--ink); outline: none; cursor: pointer;appearance: none; -webkit-appearance: none;@@ -1042,22 +1123,22 @@ button.btn.sm { padding: 5px 13px; font-size: 13px; }background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;}.conn-field select:focus { border-color: var(--accent); }-.conn-field-help { font-size: 12px; color: var(--faint); }+.conn-field-help { font-size: var(--fs-meta); color: var(--faint); }-.sa-sub { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }+.sa-sub { font-size: var(--fs-label); color: var(--faint); margin-top: 4px; }.dim { color: var(--faint); }/* -- Scheduled view (page shell + head are Tailwind, §28) -------------------- */.sched-detail { display: flex; flex-direction: column; gap: 10px; }.sched-detail-head { display: flex; align-items: center; justify-content: space-between; }.sched-actions { display: flex; align-items: center; gap: 12px; }-.sched-instructions { font-size: 13px; color: var(--ink); white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; line-height: 1.5; }+.sched-instructions { font-size: var(--fs-ui); color: var(--ink); white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; line-height: 1.5; }/* "Allowed without asking" — the automation's standing-approval revoke list (§25). */.sched-grants { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }-.sched-grant { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: 13px; }+.sched-grant { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: var(--fs-ui); }.sched-grant:last-child { border-bottom: none; }-.sched-grant-rule code { font-family: var(--mono); font-size: 12px; color: var(--ink); }-.sched-grant-target { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }+.sched-grant-rule code { font-family: var(--mono); font-size: var(--fs-meta); color: var(--ink); }+.sched-grant-target { font-family: var(--mono); font-size: var(--fs-meta); color: var(--muted); overflow-wrap: anywhere; }/* Quick-delete on a list card: revealed on hover, never steals the row click. */.sched-card-del {display: grid; place-items: center; flex: none;@@ -1074,19 +1155,19 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }.sched-edit-sched { margin: 12px 0 4px; }.sched-edit-instr { min-height: 96px; }.sched-run { border-bottom: 1px solid var(--line); }-.sched-run-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 8px 2px; cursor: pointer; color: var(--muted); }+.sched-run-row { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-ui); padding: 8px 2px; cursor: pointer; color: var(--muted); }.run-ok { color: var(--ok); } .run-error { color: var(--accent); } .run-running { color: var(--muted); }/* UX-023: marks runs newer than the seen mark captured when the detail opened. */.run-new-pill {display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: 999px;- background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 16px;+ background: var(--accent); color: #fff; font-size: var(--fs-label); font-weight: 600; line-height: 16px;}/* Run row = a launcher into the run's conversation. */.sched-run.open { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 4px 12px 10px; cursor: pointer; background: var(--panel); }.sched-run.open:hover { border-color: var(--line-strong); background: var(--paper); }.sched-run.open .sched-run-row { cursor: pointer; }-.sched-run-go { color: var(--accent); font-size: 13px; font-weight: 500; }-.sched-run-peek { font-size: 13px; color: var(--muted); line-height: 1.45; max-height: 2.9em; overflow: hidden; margin-top: 2px; }+.sched-run-go { color: var(--accent); font-size: var(--fs-ui); font-weight: 500; }+.sched-run-peek { font-size: var(--fs-ui); color: var(--muted); line-height: 1.45; max-height: 2.9em; overflow: hidden; margin-top: 2px; }/* Desktop boot splash — shown while the Tauri sidecar server comes up. */.boot-splash {@@ -1106,7 +1187,7 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }animation: boot-pulse 1.4s ease-in-out infinite;}.boot-text {- font-size: 14px;+ font-size: var(--fs-ui);opacity: 0.6;}@keyframes boot-pulse {@@ -1152,7 +1233,7 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }padding-left: 82px; /* clear the macOS traffic lights */user-select: none;}-.titlebar-brand { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); user-select: none; }+.titlebar-brand { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-ui); font-weight: 600; color: var(--muted); user-select: none; }.titlebar-brand .mark { color: var(--accent); }/* The sidebar's brand row IS the desktop title bar (pin control + wordmark). On desktop thetraffic lights float top-left, so shift the row RIGHT (not down) to clear them and keep it at@@ -1200,7 +1281,7 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }gap: 11px;padding: 9px 11px;border-radius: 9px;- font-size: 13px;+ font-size: var(--fs-ui);color: var(--muted);}.ob-rail-item.active { color: var(--ink); background: var(--accent-soft); }@@ -1211,7 +1292,7 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }border-radius: 50%;display: grid;place-items: center;- font-size: 12px;+ font-size: var(--fs-meta);font-weight: 600;background: var(--line);color: var(--muted);@@ -1221,9 +1302,9 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }.ob-rail-item.done .ob-dot { background: var(--ok); color: #fff; }.ob-body { grid-column: 2; padding: 40px 40px 16px; overflow-y: auto; }.ob-step h2 { font-family: var(--serif); margin: 0 0 8px; font-size: 24px; color: var(--ink); }-.ob-sub { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 22px; }+.ob-sub { color: var(--muted); font-size: var(--fs-body); line-height: 1.55; margin: 0 0 22px; }.ob-mark { color: var(--accent); font-size: 30px; margin-bottom: 12px; }-.ob-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin: 20px 0 7px; }+.ob-label { display: block; font-size: var(--fs-label); color: var(--faint); margin: 20px 0 7px; }.ob-ok { color: var(--ok); text-transform: none; letter-spacing: 0; font-weight: 500; }.ob-row { display: flex; gap: 8px; align-items: center; }.ob-row input, .ob-select, .ob-input {@@ -1234,13 +1315,13 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }padding: 10px 12px;color: var(--ink);font: inherit;- font-size: 14px;+ font-size: var(--fs-ui);outline: none;}.ob-row input:focus, .ob-select:focus, .ob-input:focus { border-color: var(--accent); }.ob-select, .ob-input { width: 100%; }.ob-input { box-sizing: border-box; display: block; }-.ob-note { font-size: 13px; margin-top: 9px; color: var(--ink); }+.ob-note { font-size: var(--fs-ui); margin-top: 9px; color: var(--ink); }.ob-note.dim, .dim { color: var(--faint); }.ob-toggle {display: flex;@@ -1253,14 +1334,14 @@ button.btn.sm.danger-btn:hover { border-color: var(--danger); }.ob-toggle.disabled { opacity: 0.5; cursor: default; }.ob-toggle input { margin-top: 3px; accent-color: var(--accent); }.ob-toggle span { display: flex; flex-direction: column; gap: 3px; }-.ob-toggle strong { font-weight: 500; font-size: 13px; color: var(--ink); }-.ob-toggle small { color: var(--muted); font-size: 13px; }+.ob-toggle strong { font-weight: 500; font-size: var(--fs-ui); color: var(--ink); }+.ob-toggle small { color: var(--muted); font-size: var(--fs-ui); }.ob-check {display: flex;gap: 8px;align-items: center;margin-top: 24px;- font-size: 13px;+ font-size: var(--fs-ui);color: var(--muted);}.ob-check input { accent-color: var(--accent); }@@ -1278,29 +1359,29 @@ button.btn.ghost:hover { color: var(--ink); }/* Welcome value-prop bullets */.ob-valueprops { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }-.ob-valueprops li { position: relative; padding-left: 22px; font-size: 13px; color: var(--muted); line-height: 1.5; }+.ob-valueprops li { position: relative; padding-left: 22px; font-size: var(--fs-ui); color: var(--muted); line-height: 1.5; }.ob-valueprops li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 700; }.ob-valueprops strong { color: var(--ink); font-weight: 600; }/* Model step: detect / verify status (one line) + key help — generous spacing so the stackedstates don't feel cramped. */-.ob-status { margin-top: 12px; font-size: 13px; line-height: 1.5; }+.ob-status { margin-top: 12px; font-size: var(--fs-ui); line-height: 1.5; }.ob-status.ob-ok { color: var(--ok); }.ob-status.ob-detected { color: var(--ok); }.ob-status.ob-err { color: var(--danger); }.ob-keyhelp { margin-top: 18px; }.ob-link {background: none; border: none; padding: 0; cursor: pointer;- color: var(--accent); font: inherit; font-size: 13px;+ color: var(--accent); font: inherit; font-size: var(--fs-ui);}.ob-link:hover { text-decoration: underline; }.ob-keyhelp-body {margin-top: 8px; padding: 10px 12px;background: var(--accent-soft); border: 1px solid var(--line);- border-radius: 9px; font-size: 13px; color: var(--ink);+ border-radius: 9px; font-size: var(--fs-ui); color: var(--ink);}.ob-url {- flex: 1; font-size: 12px; color: var(--muted);+ flex: 1; font-size: var(--fs-meta); color: var(--muted);overflow-wrap: anywhere; user-select: all;}@@ -1308,7 +1389,7 @@ button.btn.ghost:hover { color: var(--ink); }.ob-skipwarn {grid-column: 2; margin: 0 40px; padding: 12px 14px;background: var(--warn-soft); border: 1px solid var(--warn-ink);- border-radius: 10px; font-size: 13px; color: var(--warn-ink);+ border-radius: 10px; font-size: var(--fs-ui); color: var(--warn-ink);display: flex; flex-direction: column; gap: 10px;}.ob-skipwarn-actions { display: flex; gap: 8px; }@@ -1318,14 +1399,14 @@ button.btn.ghost:hover { color: var(--ink); }.attach-chip {position: relative; display: inline-flex; align-items: center; gap: 6px;border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper);- padding: 5px 9px; font-size: 12px; color: var(--muted); max-width: 220px;+ padding: 5px 9px; font-size: var(--fs-meta); color: var(--muted); max-width: 220px;}.attach-chip .attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.attach-chip.img { padding: 0; border: none; background: transparent; }.attach-chip.img img { width: 46px; height: 46px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line-strong); display: block; }.attach-x {position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;- border: none; background: var(--solid); color: var(--on-solid); font-size: 11px; line-height: 1; cursor: pointer;+ border: none; background: var(--solid); color: var(--on-solid); font-size: var(--fs-label); line-height: 1; cursor: pointer;display: grid; place-items: center;}.icon-btn {@@ -1337,20 +1418,20 @@ button.btn.ghost:hover { color: var(--ink); }/* in-transcript attachments on a user bubble */.bubble-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }.msg-img { max-width: 220px; max-height: 220px; border-radius: 10px; border: 1px solid var(--line-strong); display: block; }-.msg-file { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }+.msg-file { font-size: var(--fs-meta); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }/* ---- Automation form inputs (the form/template cards themselves are Tailwind, §28) ---- */.tmpl-form { display: flex; flex-direction: column; gap: 9px; }.tmpl-input {- font: inherit; font-size: 13px; color: var(--ink); background: var(--panel);+ font: inherit; font-size: var(--fs-ui); color: var(--ink); background: var(--panel);border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; outline: none;}.tmpl-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }-.tmpl-input::placeholder { color: var(--faint); }+.tmpl-input::placeholder { color: var(--placeholder); }.tmpl-textarea { resize: vertical; min-height: 64px; line-height: 1.45; }.tmpl-sched { display: flex; gap: 14px; flex-wrap: wrap; }-.tmpl-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }+.tmpl-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-meta); color: var(--muted); }.tmpl-time, .tmpl-select { padding: 6px 9px; }.tmpl-form-actions { display: flex; align-items: center; gap: 12px; margin-top: 2px; }@@ -1361,7 +1442,7 @@ button.btn.ghost:hover { color: var(--ink); }display: inline-flex; align-items: center; gap: 7px; margin: 8px 0 2px;max-width: 100%; padding: 4px 8px 4px 5px; border: 1px solid var(--line);border-radius: 999px; background: var(--paper); color: var(--muted);- font: inherit; font-size: 13px; cursor: pointer;+ font: inherit; font-size: var(--fs-ui); cursor: pointer;}.inbox-session-chip:hover:not(:disabled) { color: var(--ink); border-color: var(--line-strong); }.inbox-session-chip:disabled { cursor: default; opacity: 0.6; }@@ -1472,7 +1553,7 @@ html[data-theme="dark"] :not(.connector-badge) > .connector-icon[data-dark-mark]animation: spin 0.8s linear infinite; vertical-align: middle;}/* narration markdown stays quiet: the .md defaults (15px, ink) must not win here */-.turn-narr .md { font-size: 13px; color: var(--muted); line-height: 1.5; }+.turn-narr .md { font-size: var(--fs-ui); color: var(--muted); line-height: 1.5; }.turn-narr p { margin: 0 0 4px; }.turn-narr p:last-child { margin-bottom: 0; }@@ -1480,7 +1561,7 @@ html[data-theme="dark"] :not(.connector-badge) > .connector-icon[data-dark-mark].art-chip {display: inline-flex; align-items: center; gap: 9px; margin: 6px 0 2px;padding: 6px 12px 6px 9px; border: 1px solid var(--line); border-radius: 10px;- background: var(--paper); cursor: pointer; font: inherit; font-size: 13px; color: var(--ink);+ background: var(--paper); cursor: pointer; font: inherit; font-size: var(--fs-ui); color: var(--ink);text-align: left; max-width: 100%;}.art-chip:hover { border-color: var(--accent); }@@ -1489,16 +1570,16 @@ html[data-theme="dark"] :not(.connector-badge) > .connector-icon[data-dark-mark]background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;}.art-chip-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }-.art-chip-meta b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.art-chip-meta span { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.art-chip-open { margin-left: 8px; flex: none; font-size: 12px; color: var(--accent); font-weight: 500; }+.art-chip-meta b { font-size: var(--fs-ui); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.art-chip-meta span { font-size: var(--fs-label); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.art-chip-open { margin-left: 8px; flex: none; font-size: var(--fs-meta); color: var(--accent); font-weight: 500; }/* Seventeenth pass: [Board · N items](board:) — the lead's one-time board mention, aninline pill (smaller than the artifact chip: it opens a panel, not a document). */.boardlink-chip {display: inline-flex; align-items: center; gap: 6px; vertical-align: baseline;padding: 2px 10px 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px;- background: var(--panel); cursor: pointer; font: inherit; font-size: 12.5px; color: var(--ink);+ background: var(--panel); cursor: pointer; font: inherit; font-size: var(--fs-meta); color: var(--ink);}.boardlink-chip:hover { border-color: var(--accent); color: var(--accent); }@@ -1508,7 +1589,7 @@ html[data-theme="dark"] :not(.connector-badge) > .connector-icon[data-dark-mark]field — it should read as a screenshot of Slack, not our UI). The OpenWorkerwindow uses app tokens. Everything enters via .hiw-k + an inline --d delay once.hiw-play is set. */-.hiw-tab { position: relative; font: inherit; font-size: 12px; color: var(--muted); background: none;+.hiw-tab { position: relative; font: inherit; font-size: var(--fs-meta); color: var(--muted); background: none;border: 0; padding: 5px 9px 7px; cursor: pointer; border-radius: 7px 7px 0 0; }.hiw-tab:hover { color: var(--ink); background: var(--paper); }.hiw-tab.on { color: var(--ink); font-weight: 600; }@@ -1713,7 +1794,7 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.thinking { margin: 2px 0 4px; }.thinking-head {display: flex; align-items: center; gap: 5px;- font-size: 12px; color: var(--faint);+ font-size: var(--fs-meta); color: var(--faint);background: none; border: none; padding: 2px 0; cursor: pointer;}.thinking-head:hover { color: var(--muted); }@@ -1721,7 +1802,7 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.thinking-caret.open { transform: rotate(0); }.thinking-live { animation: boot-pulse 1.4s ease-in-out infinite; }.thinking-body {- font-size: 12px; line-height: 1.55; color: var(--muted);+ font-size: var(--fs-meta); line-height: 1.55; color: var(--muted);white-space: pre-wrap; overflow-wrap: anywhere;border-left: 2px solid var(--line); padding: 4px 0 4px 10px; margin: 4px 0 6px 4px;max-height: 280px; overflow-y: auto;@@ -1734,12 +1815,11 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:margin-left: 5px;padding: 0.5px 4.5px;border-radius: 999px;- border: 1px solid var(--line-strong);- background: var(--paper);- color: var(--muted);- font-size: 8.5px;- font-weight: 600;- letter-spacing: 0.07em;+ border: 1px solid var(--line);+ background: transparent;+ color: var(--faint);+ font-size: 9.5px;+ font-weight: 500; /* UX-048: sentence case, no tracking, hairline *//* Raised toward the cap line — superscript-ish without true `super` (which readsfussy on a pill); small + high keeps the wordmark the star. */vertical-align: 3px;@@ -1750,18 +1830,18 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.artifact-folder-row {display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;padding: 7px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer;- color: var(--ink); font-size: 13px;+ color: var(--ink); font-size: var(--fs-ui);}.artifact-folder-row:hover { background: var(--paper); }.artifact-folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.artifact-folder-size { font-size: 11px; color: var(--faint); }+.artifact-folder-size { font-size: var(--fs-label); color: var(--faint); }/* ── Agent teams (OPE-96): board rail, expanded overlay, plan gate ─────────── */.board-rail { display: flex; flex-direction: column; gap: 2px; }-.board-rail-quiet { font-size: 12px; color: var(--faint); padding: 2px 0 4px; }+.board-rail-quiet { font-size: var(--fs-meta); color: var(--faint); padding: 2px 0 4px; }.board-finished-toggle {align-self: flex-start; border: none; background: none; padding: 4px 0 0; cursor: pointer;- font-size: 12px; color: var(--faint);+ font-size: var(--fs-meta); color: var(--faint);}.board-finished-toggle:hover { color: var(--muted); text-decoration: underline; }@@ -1770,11 +1850,10 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:border: 1px solid var(--line); border-radius: 10px; background: var(--panel);margin: 2px 0; overflow: hidden;}-.boardwake.attention { border-color: color-mix(in srgb, var(--warn, #b98a2f) 45%, var(--line)); }.boardwake-head {display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;border: none; background: none; cursor: pointer; padding: 7px 10px;- font-size: 13px; color: var(--muted);+ font-size: var(--fs-ui); color: var(--muted);}.boardwake-head:hover { background: var(--paper); }.boardwake-title { font-weight: 600; color: var(--ink); }@@ -1782,33 +1861,44 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.boardwake-chevron.open { transform: rotate(180deg); }.boardwake-summary { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.boardwake-body { border-top: 1px solid var(--line); padding: 6px 10px 8px; max-height: 260px; overflow-y: auto; }-.boardwake-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; }-.boardwake-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }-.boardwake-row-text { font-size: 12px; color: var(--ink); }+/* Expanded: one group per work item (status on the right), plain sentences under it. */+.boardwake-body { max-height: 340px; }+.boardwake-attn { display: inline-block; margin-right: 6px; vertical-align: middle; position: relative; top: -2px; }+.boardwake-group { padding: 6px 0 4px; border-top: 1px solid var(--line); }+.boardwake-group:first-child { border-top: none; padding-top: 2px; }+.boardwake-group-head { display: flex; align-items: baseline; gap: 8px; }+.boardwake-group-title { font-size: var(--fs-ui); color: var(--ink); min-width: 0; flex: 1; }+.boardwake-status { font-size: var(--fs-label); color: var(--muted); white-space: nowrap; }+.boardwake-line { display: flex; flex-direction: column; gap: 2px; margin: 5px 0 0 16px; }+.boardwake-line-text { font-size: var(--fs-meta); color: var(--ink); }+.boardwake-note-wrap { display: flex; flex-direction: column; gap: 1px; }.boardwake-note {- font-size: 12px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere;+ font-size: var(--fs-meta); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere;border-left: 2px solid var(--line); padding-left: 8px;}+.boardwake-note.clamped {+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;+}.boardwake-note-toggle {- align-self: flex-start; border: none; background: none; padding: 0; cursor: pointer;- font-size: 11px; color: var(--accent);+ align-self: flex-start; border: none; background: none; padding: 0 0 0 10px; cursor: pointer;+ font-size: var(--fs-label); color: var(--muted);}-.boardwake-note-toggle:hover { text-decoration: underline; }+.boardwake-note-toggle:hover { color: var(--ink); text-decoration: underline; }.board-group {- font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;+ font-size: var(--fs-label);color: var(--faint); font-weight: 700; margin: 8px 0 3px;}.board-rail > div:first-child .board-group { margin-top: 0; }.board-row {display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left;padding: 5px 6px; border: 0; border-radius: 7px; background: transparent;- cursor: pointer; color: var(--muted); font-size: 13px;+ cursor: pointer; color: var(--muted); font-size: var(--fs-ui);}.board-row:hover { background: var(--paper); }.board-row-main { display: flex; flex-direction: column; min-width: 0; }.board-row-title { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }-.board-row-id { color: var(--faint); font-weight: 600; font-size: 12px; }-.board-row-who { font-size: 11px; color: var(--faint); }+.board-row-id { color: var(--faint); font-weight: 600; font-size: var(--fs-meta); }+.board-row-who { font-size: var(--fs-label); color: var(--faint); }.board-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; background: var(--faint); }.board-dot.work { background: var(--ok-dot); }.board-dot.blocked { background: var(--danger); }@@ -1831,15 +1921,15 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:display: flex; align-items: center; gap: 10px; padding: 12px 16px;border-bottom: 1px solid var(--line);}-.board-overlay-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink); flex: 1; }-.board-overlay-space { color: var(--faint); font-weight: 400; font-size: 12px; }+.board-overlay-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--fs-ui); color: var(--ink); flex: 1; }+.board-overlay-space { color: var(--faint); font-weight: 400; font-size: var(--fs-meta); }.board-overlay-body { flex: 1; display: flex; min-height: 0; }/* -- Overlay list (quiet, Apple-leaning: raw-state sections, no row buttons) -- */.board-list { flex: 1; min-width: 0; overflow-y: auto; padding: 2px 10px 16px; }.board-lsec {- padding: 16px 14px 5px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em;- text-transform: uppercase; color: var(--faint);+ padding: 16px 14px 5px; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.05em;+ color: var(--faint);}.board-lrow {display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;@@ -1849,13 +1939,13 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.board-lrow:hover { background: var(--paper); }.board-lrow.sel { background: color-mix(in srgb, var(--accent) 8%, transparent); }.board-lrow .board-dot { margin-top: 0; flex: none; }-.board-lrow-id { color: var(--faint); font-size: 12px; width: 26px; flex: none; }+.board-lrow-id { color: var(--faint); font-size: var(--fs-meta); width: 26px; flex: none; }.board-lrow-title {- flex: 1; min-width: 0; font-size: 13px;+ flex: 1; min-width: 0; font-size: var(--fs-ui);white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}.board-lrow-end {- flex: none; max-width: 320px; font-size: 12px; color: var(--faint);+ flex: none; max-width: 320px; font-size: var(--fs-meta); color: var(--faint);white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}@@ -1865,20 +1955,20 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:padding: 20px 24px; overflow-y: auto; min-height: 0;}.board-detail-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }-.board-detail-id { color: var(--faint); font-weight: 400; font-size: 13px; margin-right: 2px; }-.board-detail-meta { font-size: 13px; color: var(--muted); margin-top: 5px; }+.board-detail-id { color: var(--faint); font-weight: 400; font-size: var(--fs-ui); margin-right: 2px; }+.board-detail-meta { font-size: var(--fs-ui); color: var(--muted); margin-top: 5px; }.board-detail-st { font-weight: 500; }.st-review { color: var(--warn, #b45309); }.st-blocked { color: var(--danger, #dc2626); }.st-in_progress { color: var(--accent); }.board-detail-worker {- border: none; background: none; padding: 0; font: inherit; font-size: 13px;+ border: none; background: none; padding: 0; font: inherit; font-size: var(--fs-ui);color: var(--accent); cursor: pointer;}.board-detail-worker:hover { text-decoration: underline; }-.board-detail-desc { margin-top: 12px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }+.board-detail-desc { margin-top: 12px; font-size: var(--fs-ui); color: var(--muted); white-space: pre-wrap; }.board-detail-crit {- margin-top: 12px; font-size: 13px; color: var(--ink);+ margin-top: 12px; font-size: var(--fs-ui); color: var(--ink);max-height: 84px; overflow-y: auto; padding-right: 8px;}.board-detail-label { color: var(--faint); font-weight: 600; }@@ -1893,22 +1983,22 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.board-tl-ev.review::before { background: var(--warn, #b45309); }.board-tl-ev.blocked::before { background: var(--danger, #dc2626); }.board-tl-ev.work::before { background: var(--accent); }-.board-tl-line { font-size: 12px; color: var(--faint); }-.board-tl-line b { color: var(--ink); font-weight: 600; font-size: 13px; }-.board-tl-body { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }+.board-tl-line { font-size: var(--fs-meta); color: var(--faint); }+.board-tl-line b { color: var(--ink); font-weight: 600; font-size: var(--fs-ui); }+.board-tl-body { font-size: var(--fs-ui); color: var(--muted); margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }.board-shot { display: block; width: 170px; margin-top: 8px; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.14); text-decoration: none; }.board-shot img { display: block; width: 100%; max-height: 120px; object-fit: cover; background: var(--paper); }-.board-shot-cap { display: block; font-size: 11px; color: var(--faint); padding: 4px 8px; background: var(--panel); }+.board-shot-cap { display: block; font-size: var(--fs-label); color: var(--faint); padding: 4px 8px; background: var(--panel); }.board-note-input {- width: 100%; margin-top: 14px; font: inherit; font-size: 13px; color: var(--ink);+ width: 100%; margin-top: 14px; font: inherit; font-size: var(--fs-ui); color: var(--ink);background: var(--paper); border: 1px solid var(--line); border-radius: 999px;padding: 7px 14px; outline: none;}-.board-note-input::placeholder { color: var(--faint); }+.board-note-input::placeholder { color: var(--placeholder); }.board-note-input:focus { border-color: var(--accent); background: var(--panel); }.board-detail-actions { display: flex; gap: 14px; align-items: center; margin-top: 20px; }-.board-btn { font-size: 13px; cursor: pointer; font-family: inherit; }+.board-btn { font-size: var(--fs-ui); cursor: pointer; font-family: inherit; }.board-btn.primary {color: #fff; background: var(--accent); border: none; border-radius: 999px; padding: 6px 16px;}@@ -1917,7 +2007,7 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.board-btn.ghost:hover { color: var(--ink); }.board-changes { display: flex; flex-direction: column; gap: 8px; width: 100%; }.board-changes textarea {- width: 100%; min-height: 64px; resize: vertical; font: inherit; font-size: 13px;+ width: 100%; min-height: 64px; resize: vertical; font: inherit; font-size: var(--fs-ui);color: var(--ink); background: var(--paper); border: 1px solid var(--line);border-radius: 10px; padding: 8px 10px; outline: none;}@@ -1926,42 +2016,91 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:/* Journal rail section */.journal-list { display: flex; flex-direction: column; gap: 3px; }-.journal-row { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); padding: 3px 4px; }+.journal-row { display: flex; align-items: center; gap: 7px; font-size: var(--fs-ui); color: var(--muted); padding: 3px 4px; }.journal-case { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }-.journal-count { font-size: 11px; color: var(--faint); }+.journal-count { font-size: var(--fs-label); color: var(--faint); }/* Staffing gate (agent teams) */-.teamreq-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }.teamreq-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }-.teamreq-title { font-weight: 600; font-size: 13px; color: var(--ink); }-.teamreq-note { font-size: 12px; color: var(--muted); margin-bottom: 4px; }-.teamreq-row { display: flex; gap: 9px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }-.teamreq-diamond { color: var(--faint); font-size: 11px; padding-top: 1px; }-.teamreq-body code { background: var(--paper); border-radius: 5px; padding: 1px 6px; font-size: 12px; }+.teamreq-title { font-weight: 600; font-size: var(--fs-ui); color: var(--ink); }+.teamreq-note-wrap { margin-bottom: 4px; }+.teamreq-note { font-size: var(--fs-meta); color: var(--muted); }+/* A long note clamps to two lines; More/Less reveals the rest. */+.teamreq-note.clamped {+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;+}+.teamreq-note-toggle, .teamreq-add {+ align-self: flex-start; border: none; background: none; padding: 0; cursor: pointer;+ font-size: var(--fs-label); color: var(--muted); white-space: nowrap;+}+.teamreq-note-toggle:hover, .teamreq-add:hover { color: var(--ink); text-decoration: underline; }+/* A large roster scrolls here instead of pushing the buttons off the window (six workers+ measured ~750px, 2026-09-17). Tall enough for three full rows; never over half the window. */+.teamreq-roster { max-height: min(50vh, 340px); overflow-y: auto; }+.teamreq-row { display: flex; gap: 9px; padding: 7px 0; border-top: 1px solid var(--line); font-size: var(--fs-ui); }+/* A role line (workers sharing a persona) and, when opened, its workers indented under it. */+.teamreq-group-row .teamreq-who { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 5px; }+.teamreq-count { font-weight: 600; color: var(--ink); white-space: nowrap; }+.teamreq-add-inline { align-self: baseline; }+.teamreq-group-toggle { margin-left: auto; align-self: baseline; }+.teamreq-partial { font-size: var(--fs-label); color: var(--warn-ink); background: var(--warn-soft); border-radius: 999px; padding: 0 6px; }+.teamreq-group-members { margin: 0 0 6px 19px; padding-left: 10px; border-left: 2px solid var(--line); }+.teamreq-group-members .teamreq-row:first-child { border-top: none; }+.teamreq-diamond { color: var(--faint); font-size: var(--fs-label); padding-top: 1px; }+.teamreq-body code { background: var(--paper); border-radius: 5px; padding: 1px 6px; font-size: var(--fs-meta); }+/* Spec §11.6: per-worker dials on the staffing card — approval mode + connector checkboxes. */+.teamreq-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }+.teamreq-dials { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; font-size: var(--fs-meta); color: var(--ink-2); }+.teamreq-dial-label { color: var(--ink-3); margin-right: 6px; }+.teamreq-approvals { padding: 8px 0 2px; border-top: 1px solid var(--line); font-size: var(--fs-meta); color: var(--ink-2); }+.teamreq-connectors { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }+.teamreq-connector { display: inline-flex; align-items: baseline; gap: 4px; cursor: pointer; }+.teamreq-connector input { align-self: center; }+.teamreq-connector-reason { color: var(--faint); font-size: var(--fs-label); margin-left: 2px; }+/* The out-of-default group: its label takes its own line, one connector per line. */+.teamreq-beyond { flex-direction: column; gap: 3px; }+.teamreq-beyond .teamreq-dial-label { margin-right: 0; }+.teamreq-none { color: var(--ink-3); font-style: italic; }.teamreq-model { color: var(--muted); }-.teamreq-reason { color: var(--faint); }-.teamreq-grant { font-size: 12px; color: var(--faint); }+/* The per-worker model picker: reads as text on line one — no box, no extra row height. */+.teamreq-model-pick { position: relative; display: inline-block; vertical-align: baseline; max-width: 100%; }+.teamreq-model-pick::after {+ content: "▾"; position: absolute; right: 1px; top: 50%; transform: translateY(-50%);+ color: var(--muted); font-size: var(--fs-meta); line-height: 1; pointer-events: none;+}+.teamreq-model-select {+ appearance: none; -webkit-appearance: none; border: none; border-radius: 4px; background: transparent;+ margin: 0; padding: 0 14px 0 2px; height: auto; max-width: 17em;+ font: inherit; font-size: var(--fs-ui); line-height: inherit; color: var(--ink-2);+ text-overflow: ellipsis; cursor: pointer;+ field-sizing: content; /* hug the chosen label where supported; else the widest option */+}+.teamreq-model-select:hover { background: var(--paper); color: var(--ink); }+.teamreq-model-select:focus-visible { outline: 2px solid var(--accent-soft); }+.teamreq-model-warn { display: inline-flex; vertical-align: -2px; margin-left: 5px; color: var(--warn-ink); cursor: help; }+.teamreq-model-note { display: block; font-size: var(--fs-label); color: var(--faint); }+.teamreq-reason { display: block; font-size: var(--fs-meta); color: var(--muted); }+.teamreq-actions .btn { white-space: nowrap; flex-shrink: 0; }/* Sidebar: the expandable team entry (workers nest under their lead) */.team-child { margin-left: 18px; }-.team-child .team-item { font-size: 11px; color: var(--faint); margin-left: 4px; }+.team-child .team-item { font-size: var(--fs-label); color: var(--faint); margin-left: 4px; }.team-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--faint); }.team-dot.in_progress { background: var(--ok-dot); }.team-dot.blocked { background: var(--danger); }.team-dot.review { background: var(--warn-ink); }/* Decomposition gate (proposed work items) */-.itemsreq-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }.itemsreq-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }-.itemsreq-title { font-weight: 600; font-size: 13px; color: var(--ink); }-.itemsreq-note { font-size: 12px; color: var(--muted); margin-bottom: 4px; }+.itemsreq-title { font-weight: 600; font-size: var(--fs-ui); color: var(--ink); }+.itemsreq-note { font-size: var(--fs-meta); color: var(--muted); margin-bottom: 4px; }.itemsreq-item { display: flex; gap: 9px; padding: 7px 0; border-top: 1px solid var(--line); }-.itemsreq-num { color: var(--faint); font-size: 12px; padding-top: 1px; }+.itemsreq-num { color: var(--faint); font-size: var(--fs-meta); padding-top: 1px; }.itemsreq-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }-.itemsreq-item-title { font-size: 13px; color: var(--ink); }-.itemsreq-ac { font-size: 12px; color: var(--muted); }+.itemsreq-item-title { font-size: var(--fs-ui); color: var(--ink); }+.itemsreq-ac { font-size: var(--fs-meta); color: var(--muted); }.itemsreq-ac b { font-weight: 600; }/* Essay-length criteria clamp to two lines; the expander reveals the rest. Thelist itself caps so a big proposal never occupies two screens of chat. */@@ -1970,40 +2109,40 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:}.itemsreq-ac-toggle {align-self: flex-start; border: none; background: none; padding: 0; cursor: pointer;- font-size: 11px; color: var(--accent);+ font-size: var(--fs-label); color: var(--muted);}-.itemsreq-ac-toggle:hover { text-decoration: underline; }+.itemsreq-ac-toggle:hover { color: var(--ink); text-decoration: underline; }.itemsreq-list { max-height: 320px; overflow-y: auto; }-.itemsreq-more { display: flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--accent); font-size: 12px; cursor: pointer; padding: 6px 0; }-.itemsreq-grant { font-size: 12px; color: var(--faint); }+.itemsreq-more { display: flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font-size: var(--fs-meta); cursor: pointer; padding: 6px 0; }+.itemsreq-grant { font-size: var(--fs-meta); color: var(--faint); }/* # team chat */.teamreq-name { color: var(--ink); font-weight: 600; }-.teamreq-chat { display: flex; align-items: center; gap: 8px; padding: 9px 0 2px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink); cursor: pointer; }+.teamreq-chat { display: flex; align-items: center; gap: 8px; padding: 9px 0 2px; border-top: 1px solid var(--line); font-size: var(--fs-ui); color: var(--ink); cursor: pointer; }.teamreq-info { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--faint); font-size: 9px; cursor: help; }.chat-panel { max-width: 860px; }.chat-hash { color: var(--faint); font-weight: 700; }.chat-scroll { flex: 1; overflow: auto; padding: 14px 18px; display: flex; flex-direction: column; }-.chat-empty { color: var(--faint); font-size: 13px; margin: auto; max-width: 420px; text-align: center; }+.chat-empty { color: var(--faint); font-size: var(--fs-ui); margin: auto; max-width: 420px; text-align: center; }.chat-msg { margin-top: 12px; }.chat-msg.grouped { margin-top: 2px; padding-left: 34px; }.chat-who { display: flex; align-items: baseline; gap: 8px; }-.chat-avatar { width: 26px; height: 26px; border-radius: 7px; background: var(--paper); border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; align-self: center; }+.chat-avatar { width: 26px; height: 26px; border-radius: 7px; background: var(--paper); border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-meta); font-weight: 700; align-self: center; }.chat-avatar.lead { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }.chat-avatar.user { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }-.chat-name { font-size: 13px; font-weight: 700; color: var(--ink); }-.chat-role { font-size: 11px; color: var(--faint); }-.chat-ts { font-size: 11px; color: var(--faint); }-.chat-text { font-size: 13px; color: var(--ink); margin-top: 1px; padding-left: 34px; }+.chat-name { font-size: var(--fs-ui); font-weight: 700; color: var(--ink); }+.chat-role { font-size: var(--fs-label); color: var(--faint); }+.chat-ts { font-size: var(--fs-label); color: var(--faint); }+.chat-text { font-size: var(--fs-ui); color: var(--ink); margin-top: 1px; padding-left: 34px; }.chat-msg.grouped .chat-text { padding-left: 0; }.chat-mention { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }.chat-composer { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }-.chat-input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 13px; background: var(--paper); color: var(--ink); outline: none; }+.chat-input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: var(--fs-ui); background: var(--paper); color: var(--ink); outline: none; }.chat-input:focus { border-color: var(--accent); }/* Sidebar chat row */-.team-hash { color: var(--faint); font-weight: 700; font-size: 12px; width: 10px; text-align: center; }-.team-chat-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 0 6px; }+.team-hash { color: var(--faint); font-weight: 700; font-size: var(--fs-meta); width: 10px; text-align: center; }+.team-chat-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: var(--fs-label); font-weight: 700; border-radius: 8px; padding: 0 6px; }/* # team chat as an in-place view (not a modal): fills .main, sidebar stays live. */.chat-view { position: absolute; inset: 0; z-index: 40; background: var(--paper); display: flex; flex-direction: column; }@@ -2014,12 +2153,12 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.sleep-strip {max-width: 760px; margin: 0 auto 8px; display: flex; align-items: center; gap: 9px;padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;- background: var(--panel); font-size: 13px; color: var(--muted);+ background: var(--panel); font-size: var(--fs-ui); color: var(--muted);}.sleep-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn-ink); opacity: 0.7; flex-shrink: 0; animation: sleep-pulse 2.4s ease-in-out infinite; }@keyframes sleep-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }.sleep-text { flex: 1; }-.sleep-strip .btn.sm { padding: 4px 10px; font-size: 12px; }+.sleep-strip .btn.sm { padding: 4px 10px; font-size: var(--fs-meta); }/* UX-038: viewer header — breadcrumb-as-back, ✕ close, one labeled ⋯ menu. */.artifact-crumb-link {@@ -2036,7 +2175,7 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.artifact-menu-item {display: flex; width: 100%; align-items: center; gap: 9px; padding: 7px 9px;border: 0; background: none; border-radius: 7px; text-align: left;- font-size: 13px; color: var(--ink); cursor: pointer;+ font-size: var(--fs-ui); color: var(--ink); cursor: pointer;}.artifact-menu-item:hover { background: var(--paper); }.artifact-menu-item svg { color: var(--muted); flex: none; }@@ -2048,7 +2187,7 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:.mcp-notice-line { display: flex; align-items: center; gap: 8px; justify-content: center; }.mcp-notice-line > span[aria-hidden] { color: var(--warn-ink); flex: none; }.mcp-notice-act {- font: inherit; font-size: 12px; border: 0; background: none; color: var(--faint);+ font: inherit; font-size: var(--fs-meta); border: 0; background: none; color: var(--faint);cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong);text-underline-offset: 3px; padding: 0; flex: none;}diff --git a/surfaces/gui/src/textSize.ts b/surfaces/gui/src/textSize.tsnew file mode 100644index 00000000..70666cc0--- /dev/null+++ b/surfaces/gui/src/textSize.ts@@ -0,0 +1,51 @@+// Text size (UX-048 follow-up, owner 2026-09-03): three steps for the whole type scale —+// Small (13px body), Default (14px body — owner's pick), Large (15px body). Per-device like the+// theme: localStorage only, applied as data-text-size on <html> so the token blocks in+// styles.css switch. index.html applies the same key pre-paint so the first frame is right.+import { useEffect, useState } from "react";++export type TextSize = "small" | "default" | "large";++const KEY = "openwork-text-size";+const PREF_EVENT = "openwork:text-size";++export function getTextSize(): TextSize {+ try {+ const v = localStorage.getItem(KEY);+ return v === "small" || v === "large" ? v : "default";+ } catch {+ return "default";+ }+}++function apply(size: TextSize) {+ if (size === "default") delete document.documentElement.dataset.textSize;+ else document.documentElement.dataset.textSize = size;+}++export function setTextSize(size: TextSize) {+ try {+ if (size === "default") localStorage.removeItem(KEY);+ else localStorage.setItem(KEY, size);+ } catch {+ /* private mode etc. — still applies for this session */+ }+ apply(size);+ window.dispatchEvent(new CustomEvent(PREF_EVENT));+}++/** Call once at startup. */+export function initTextSize() {+ apply(getTextSize());+}++/** The settings control's hook — stays in sync if the pref changes elsewhere. */+export function useTextSize(): [TextSize, (s: TextSize) => void] {+ const [size, setSize] = useState<TextSize>(getTextSize);+ useEffect(() => {+ const sync = () => setSize(getTextSize());+ window.addEventListener(PREF_EVENT, sync);+ return () => window.removeEventListener(PREF_EVENT, sync);+ }, []);+ return [size, setTextSize];+}diff --git a/surfaces/gui/src/types.ts b/surfaces/gui/src/types.tsindex 160125d3..6452284a 100644--- a/surfaces/gui/src/types.ts+++ b/surfaces/gui/src/types.ts@@ -9,6 +9,7 @@ export type EventType =| "permission_required"| "directory_requested"| "tool_requested"+ | "connector_requested"| "question_requested"| "plan_proposed"| "team_proposed"@@ -102,6 +103,17 @@ export interface SessionInfo {// "From Slack" group and the row's platform icon.origin?: string;origin_label?: string;+ // Remote homes (UX-045): set client-side when the row came from a joined machine's+ // store (fetched through the proxy prefix). Absent = a This-Mac session. Drives the+ // ⌂ badge, the Machine grouping, and machine-aware routing of session API calls.+ machine?: string;+ machine_name?: string;+ // Set when the row came from the controller's stored snapshot because the+ // machine is offline — the sidebar greys it, and opening it explains why.+ machine_offline?: boolean;+ // Per-model token totals persisted by the box (spec §5) — {model: {input, output,+ // cache_read, cache_write, turns}}. The lead's Team panel rolls its workers up.+ usage?: Record<string, TurnUsage & { turns?: number }>;// Agent teams: {} / absent for plain sessions. Workers carry role/lead_session// (+ a computed current-item line); leads carry role/team_id. Drives the sidebar's// ONE expandable team entry (workers nest under their lead; plain rows never expand).@@ -169,6 +181,9 @@ export type Item =// Server-classified: this shell command only reads locally, so the card may offer// the session-wide "Allow read-only commands" grant.readonlyOk?: boolean;+ // decide_worker_call only: the worker's waiting call this decision answers, looked+ // up by the server so the card can show it (absent from an older server).+ workerCall?: { worker?: string; tool: string; arguments?: any; reason?: string; state?: string; resolution?: string | null };// OPE-136 finding 4: where an MCP call actually goes, from the server DEF (the// user's own config, never the server's claims). Drives the honest scope chip —// "leaves this computer → host" (http) / "runs a local program" (stdio).@@ -201,11 +216,47 @@ export type Item =| {// The staffing gate (agent teams): a lead proposes its worker roster.kind: "teamreq";- members: { persona: string; name?: string; model?: string; reason?: string }[];+ // connectors = the LEAD'S SUGGESTION for this worker (arrives ticked on the card);+ // connector_reasons = why, per suggested connector.+ members: {+ persona: string;+ name?: string;+ model?: string;+ reason?: string;+ connectors?: string[];+ connector_reasons?: Record<string, string>;+ // The model this worker WILL run on if the human changes nothing on the card.+ resolved_model?: string;+ // Set when none of the persona's recommended models can run on this machine.+ model_warning?: string;+ }[];enable_chat?: boolean;note?: string;+ // Per worker persona, its RECOMMENDED models that can run on this machine, in order.+ model_options?: Record<string, string[]>;+ // Every model that can run on this machine. Present → the card offers a model+ // picker per worker; absent (older server) → the model stays plain text.+ runnable_models?: { id: string; label: string }[];+ lead_model?: string;+ // Per worker persona, its DEFAULT set that is connected on the machine.+ offer?: Record<string, string[]>;+ // Every other connector connected on the machine — a human may extend a worker+ // beyond its default set from this list (worker-connector-grants spec §2, §6).+ other_connected?: string[];+ // The lead's real approval mode, for a card rendered away from the composer (Inbox).+ lead_mode?: string;resolved?: "approved" | "rejected";}+ | {+ // Spec §11.6: connector access is a human decision. "connect" = the coworker asks+ // for a service to be connected; "grant" = a lead asks to give a worker a connector.+ kind: "connreq";+ request: "connect" | "grant";+ connector: string;+ worker?: string;+ reason: string;+ resolved?: "approved" | "declined";+ }| {// The decomposition gate: a lead proposes work items; approval creates them.kind: "itemsreq";diff --git a/surfaces/gui/src/usage.test.ts b/surfaces/gui/src/usage.test.tsindex 82e85322..040ec51e 100644--- a/surfaces/gui/src/usage.test.ts+++ b/surfaces/gui/src/usage.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from "vitest";-import { addTurnUsage, emptyUsage, formatTokens, totalTokens, usageFromMessages } from "./usage";+import { addTurnUsage, emptyUsage, formatTokens, teamUsage, totalTokens, usageFromMessages } from "./usage";+import type { TurnUsage } from "./types";const turn = (over: Record<string, unknown> = {}) => ({model: "anthropic:claude-fable-5",@@ -76,3 +77,21 @@ describe("totalTokens / formatTokens", () => {expect(formatTokens(NaN)).toBe("0");});});++describe("teamUsage", () => {+ it("rolls the lead's live totals and the workers' persisted totals up by model", () => {+ const lead = addTurnUsage(emptyUsage(), {+ model: "anthropic:claude-opus-4-8", input: 100, output: 10, cache_read: 0, cache_write: 0,+ });+ const workers: { usage?: Record<string, TurnUsage & { turns?: number }> }[] = [+ { usage: { "anthropic:claude-opus-4-8": { input: 50, output: 5, cache_read: 20, cache_write: 0, turns: 2 } } },+ { usage: { "ollama:qwen3-coder:30b": { input: 7, output: 3, cache_read: 0, cache_write: 0, turns: 1 } } },+ {},+ ];+ const t = teamUsage(lead, workers);+ expect(t.byModel["anthropic:claude-opus-4-8"]).toMatchObject({ input: 150, output: 15, cache_read: 20 });+ expect(t.byModel["ollama:qwen3-coder:30b"]).toMatchObject({ input: 7, output: 3 });+ expect(totalTokens(t)).toBe(195);+ expect(t.context).toBe(lead.context); // the lead's window, not a sum+ });+});diff --git a/surfaces/gui/src/usage.ts b/surfaces/gui/src/usage.tsindex 135a3fa1..51267a0e 100644--- a/surfaces/gui/src/usage.ts+++ b/surfaces/gui/src/usage.ts@@ -73,3 +73,18 @@ export function formatTokens(n: number): string {const m = n / 1_000_000;return (m < 100 ? m.toFixed(2).replace(/\.?0+$/, "") : String(Math.round(m))) + "M";}++/** Roll a team up (spec §5): the lead's live accumulation plus each worker's persisted+ * per-model totals, keyed by model. Dollars never appear. */+export function teamUsage(+ lead: SessionUsage,+ workers: { usage?: Record<string, TurnUsage> }[],+): SessionUsage {+ let acc: SessionUsage = { byModel: { ...lead.byModel }, context: lead.context };+ for (const w of workers) {+ for (const [model, u] of Object.entries(w.usage || {})) {+ acc = addTurnUsage(acc, { ...u, model });+ }+ }+ return { byModel: acc.byModel, context: lead.context };+}diff --git a/surfaces/gui/src/useMachineData.ts b/surfaces/gui/src/useMachineData.tsnew file mode 100644index 00000000..964d2aab--- /dev/null+++ b/surfaces/gui/src/useMachineData.ts@@ -0,0 +1,62 @@+import { useCallback, useEffect, useRef, useState } from "react";++// Data loading for machine-scoped Settings pages (UX-046). A remote read+// crosses the bridge and can be slow (or the box can be offline), so pages+// render in three honest states: fresh data · a cached copy while a refresh+// runs (with a visible timestamp) · a loading row when nothing is known yet.+// The cache is session-lifetime and in-memory only — nothing persists.++const cache = new Map<string, { data: unknown; at: number }>();++export interface MachineData<T> {+ data: T | null;+ /** Set when `data` came from the cache and a refresh is still in flight. */+ cachedAt: number | null;+ loading: boolean;+ error: boolean;+ refresh: () => void;+}++export function useMachineData<T>(key: string, fetcher: () => Promise<T>): MachineData<T> {+ const [state, setState] = useState<{ data: T | null; cachedAt: number | null; loading: boolean; error: boolean }>(+ () => {+ const hit = cache.get(key);+ return hit+ ? { data: hit.data as T, cachedAt: hit.at, loading: true, error: false }+ : { data: null, cachedAt: null, loading: true, error: false };+ },+ );+ const keyRef = useRef(key);+ keyRef.current = key;+ const fetcherRef = useRef(fetcher);+ fetcherRef.current = fetcher;++ const load = useCallback(() => {+ const wanted = keyRef.current;+ const hit = cache.get(wanted);+ setState({+ data: (hit?.data as T) ?? null,+ cachedAt: hit?.at ?? null,+ loading: true,+ error: false,+ });+ fetcherRef.current().then(+ (data) => {+ cache.set(wanted, { data, at: Date.now() });+ if (keyRef.current === wanted)+ setState({ data, cachedAt: null, loading: false, error: false });+ },+ () => {+ if (keyRef.current === wanted)+ setState((prev) => ({ ...prev, loading: false, error: true }));+ },+ );+ }, []);++ useEffect(() => {+ load();+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [key]);++ return { ...state, refresh: load };+}diff --git a/surfaces/gui/tailwind.config.js b/surfaces/gui/tailwind.config.jsindex b3316f71..303a7f90 100644--- a/surfaces/gui/tailwind.config.js+++ b/surfaces/gui/tailwind.config.js@@ -46,6 +46,16 @@ export default {mono: ["SF Mono", "JetBrains Mono", "Menlo", "monospace"],},borderRadius: { xl2: "14px" },+ // UX-048: the six-size type scale as classes bound to the CSS tokens (styles.css),+ // so a scale change is one edit. Arbitrary text-[Npx] classes are retired.+ fontSize: {+ title: "var(--fs-title)",+ heading: "var(--fs-heading)",+ body: ["var(--fs-body)", { lineHeight: "var(--lh-body)" }],+ ui: "var(--fs-ui)",+ meta: "var(--fs-meta)",+ label: "var(--fs-label)",+ },},},plugins: [],diff --git a/surfaces/gui/vite.config.ts b/surfaces/gui/vite.config.tsindex 1264a267..24b2143f 100644--- a/surfaces/gui/vite.config.ts+++ b/surfaces/gui/vite.config.ts@@ -24,10 +24,23 @@ export default defineConfig(({ command }) => {// shows the normal startup retry until the standalone server/token file exists.}}+ // COWORKER_DEV_PROXY=http://127.0.0.1:8790 points the dev GUI at a hosted-+ // shaped backend (the machines service) through vite's own origin, so the+ // browser sees no cross-origin calls — the hosted service serves its bundle+ // same-origin and deliberately has no CORS. Pair it with+ // VITE_COWORKER_HTTP/WS set to the vite origin. Off unless set.+ const devProxy = process.env.COWORKER_DEV_PROXY || "";+ const proxy = devProxy+ ? {+ "/v1": { target: devProxy, changeOrigin: true },+ "/ws": { target: devProxy.replace(/^http/, "ws"), ws: true, changeOrigin: true },+ "/j": { target: devProxy, changeOrigin: true },+ }+ : undefined;return {base: "./",plugins: [react()],- server: { port: 1420, strictPort: true },+ server: { port: 1420, strictPort: true, ...(proxy ? { proxy } : {}) },define: { __COWORKER_DEV_TOKEN__: JSON.stringify(devToken) },// Tauri CLI looks for these; harmless for the browser build.clearScreen: false,