A desktop coding agent with free access to frontier models.
TypeScript
feat(desktop): quality fail labels, jackpot size, and the open session
ogsamrat7ae82e445292
diff --git a/apps/app/src/app/lib/quality.ts b/apps/app/src/app/lib/quality.tsindex 393a3ce0..e8cca058 100644--- a/apps/app/src/app/lib/quality.ts+++ b/apps/app/src/app/lib/quality.ts@@ -254,10 +254,19 @@ export function spinPayoutText(spin: QualitySpin): string {return `+${compactTokenCount(spin.tokens)} tokens added to your pot`;}+/** The jackpot slice: the segment paying `jackpotTokens`, else the biggest prize. */+export function jackpotIndex(segments: WheelSegment[], jackpotTokens?: number | null): number {+ const named = jackpotTokens ? segments.findIndex((segment) => segment.tokens === jackpotTokens) : -1;+ if (named >= 0) return named;+ let best = 0;+ segments.forEach((segment, index) => { if (segment.tokens > (segments[best]?.tokens ?? 0)) best = index; });+ return best;+}+/** The near-miss tease, only when the server flags it. */-export function nearMissText(spin: QualitySpin): string | null {+export function nearMissText(spin: QualitySpin, jackpotTokens?: number | null): string | null {if (!spin.nearMiss) return null;- const jackpot = spin.jackpotTokens || Math.max(...spin.segments.map((segment) => segment.tokens));+ const jackpot = spin.jackpotTokens || jackpotTokens || Math.max(...spin.segments.map((segment) => segment.tokens));return `So close to ${compactTokenCount(jackpot)}!`;}@@ -278,15 +287,25 @@ export const useAccountStatusStore = create<AccountStatusStore>((set) => ({}));let inFlight: Promise<OmniRushAccountStatus | null> | null = null;+let openSessionId: string | null = null;++/** The session open in the app: profile reads name it so next_spin_hint and nudge speak about it. */+export function setQualitySessionId(sessionId: string | null | undefined): void {+ openSessionId = sessionId?.trim() || null;+}++export function qualitySessionId(): string | null {+ return openSessionId;+}/*** Reads the account status (/device/me) once for every caller in flight:* the sidebar footer and the quality popup share one request.*/export function refreshAccountStatus(- read: () => Promise<OmniRushAccountStatus>,+ read: (options?: { sessionId?: string | null }) => Promise<OmniRushAccountStatus>,): Promise<OmniRushAccountStatus | null> {- inFlight ??= read()+ inFlight ??= read(openSessionId ? { sessionId: openSessionId } : undefined).then((status) => {useAccountStatusStore.getState().set(status);return status;diff --git a/apps/app/src/react-app/domains/quality/quality-notice.tsx b/apps/app/src/react-app/domains/quality/quality-notice.tsxindex 9f6d1570..0f1ac7c6 100644--- a/apps/app/src/react-app/domains/quality/quality-notice.tsx+++ b/apps/app/src/react-app/domains/quality/quality-notice.tsx@@ -25,19 +25,34 @@ import type { OmniRushQualitySession } from "@omnirush/types/desktop-ipc";import { BiggestWinTicker, NextSpinHint, QualityTierBadge, StreakLine } from "./quality-parts";import { QualitySpinDialog } from "./quality-spin-dialog";-const FAIL_LABELS: Record<string, string> = {+/** Used only when the server sends no `fail_labels` entry for a code. */+const FALLBACK_FAIL_LABELS: Record<string, string> = {outside_path: "edits outside the project folder",- windows: "recorded on Windows",- no_tests: "no tests",- too_small: "too little work to count",+ home_folder: "started in the home folder",+ wrong_folder: "started in another folder",+ windows_host: "recorded on Windows",+ small_fix: "a small fix",+ one_shot: "a one-shot answer",+ non_coding: "not coding work",};-function failLabel(fail: string): string {- return FAIL_LABELS[fail] ?? fail.replace(/[_-]+/g, " ");+export function failLabel(fail: string, labels: Record<string, string> = {}): string {+ return labels[fail] ?? FALLBACK_FAIL_LABELS[fail] ?? fail.replace(/[_-]+/g, " ");+}++export type QualitySessionReasons = { sessions: OmniRushQualitySession[]; failLabels: Record<string, string> };++function workSummary(work: OmniRushQualitySession["work"]): string | null {+ if (!work) return null;+ const parts = [`${work.codeFiles} code file${work.codeFiles === 1 ? "" : "s"}`, `${work.linesChanged} lines`];+ parts.push(work.testRuns > 0 ? `${work.testRuns} test run${work.testRuns === 1 ? "" : "s"}` : "no tests");+ return parts.join(" · ");}/** "See why": each recent session, with what earned spins and what held it back. */-function SessionReasons({ sessions }: { sessions: OmniRushQualitySession[] | null }) {+export function SessionReasons({ reasons }: { reasons: QualitySessionReasons | null }) {+ if (reasons === null) return <div className="text-xs text-white/50">Loading your sessions…</div>;+ const { sessions, failLabels } = reasons;if (sessions === null) return <div className="text-xs text-white/50">Loading your sessions…</div>;if (!sessions.length) return <div className="text-xs text-white/50">No sessions checked yet. They are checked about once an hour.</div>;return (@@ -51,11 +66,15 @@ function SessionReasons({ sessions }: { sessions: OmniRushQualitySession[] | nul) : null}</div>{session.why ? <div className="mt-0.5 text-xs leading-5 text-white/80">{session.why}</div> : null}- {session.fails.length ? (+ {workSummary(session.work) ? <div className="mt-0.5 text-[10.5px] text-white/45">{workSummary(session.work)}</div> : null}+ {session.fails.length || session.reproducible === "pass" ? (<div className="mt-1 flex flex-wrap gap-1">+ {session.reproducible === "pass" ? (+ <span className="rounded-full bg-[#a3e635]/15 px-1.5 py-0.5 text-[10px] text-[#d9f99d]">reproducible</span>+ ) : null}{session.fails.map((fail) => (- <span key={fail} className="rounded-full bg-white/[0.06] px-1.5 py-0.5 text-[10px] text-white/60">- {failLabel(fail)}+ <span key={fail} data-fail={fail} className="rounded-full bg-white/[0.06] px-1.5 py-0.5 text-[10px] text-white/60">+ {failLabel(fail, failLabels)}</span>))}</div>@@ -72,8 +91,8 @@ export type QualityNoticeCardProps = {notice: QualityNotice | null;onSpin: () => void;onDismiss: () => void;- /** GET /me/quality sessions for "see why"; fetched when first opened. */- loadSessions?: () => Promise<OmniRushQualitySession[] | null>;+ /** GET /me/quality sessions (and fail labels) for "see why"; fetched when first opened. */+ loadSessions?: () => Promise<QualitySessionReasons | null>;};/**@@ -85,7 +104,7 @@ export function QualityNoticeCard(props: QualityNoticeCardProps) {const { quality, notice } = props;const coaching = isCoachingNotice(notice, quality);const [whyOpen, setWhyOpen] = useState(false);- const [sessions, setSessions] = useState<OmniRushQualitySession[] | null>(null);+ const [sessions, setSessions] = useState<QualitySessionReasons | null>(null);const title = notice?.title ?? `Quality: ${qualityTierLabel(quality.tier)}`;const body = notice?.body || (notice ? "" : quality.nextTierHint ?? "");const spinnable = canSpinNow(quality);@@ -93,7 +112,8 @@ export function QualityNoticeCard(props: QualityNoticeCardProps) {const toggleWhy = () => {setWhyOpen((open) => !open);if (sessions === null && props.loadSessions) {- void props.loadSessions().then((next) => setSessions(next ?? [])).catch(() => setSessions([]));+ const none = { sessions: [], failLabels: {} };+ void props.loadSessions().then((next) => setSessions(next ?? none)).catch(() => setSessions(none));}};@@ -155,7 +175,7 @@ export function QualityNoticeCard(props: QualityNoticeCardProps) {See why<ChevronDown className={cn("size-3.5 transition", whyOpen && "rotate-180")} /></button>- {whyOpen ? <div className="mt-2 max-h-56 overflow-y-auto pe-1"><SessionReasons sessions={sessions} /></div> : null}+ {whyOpen ? <div className="mt-2 max-h-56 overflow-y-auto pe-1"><SessionReasons reasons={sessions} /></div> : null}</div>) : null}@@ -247,7 +267,10 @@ export function QualityRewards() {useQualityUiStore.getState().openSpin();}, [markNoticeSeen]);- const loadSessions = useCallback(async () => (await omnirushQualityDetails())?.sessions ?? null, []);+ const loadSessions = useCallback(async (): Promise<QualitySessionReasons | null> => {+ const details = await omnirushQualityDetails();+ return details ? { sessions: details.sessions, failLabels: details.failLabels ?? {} } : null;+ }, []);if (!quality) return null;const showCard = !spinOpen && (panelOpen || notice !== null);diff --git a/apps/app/src/react-app/domains/quality/quality-spin-dialog.tsx b/apps/app/src/react-app/domains/quality/quality-spin-dialog.tsxindex 0c191629..3ad29c89 100644--- a/apps/app/src/react-app/domains/quality/quality-spin-dialog.tsx+++ b/apps/app/src/react-app/domains/quality/quality-spin-dialog.tsx@@ -86,6 +86,7 @@ export function QualitySpinDialog(props: QualitySpinDialogProps) {const reducedMotion = usePrefersReducedMotion();const [segments, setSegments] = useState<WheelSegment[]>(DEFAULT_WHEEL_SEGMENTS);const [expectedTokens, setExpectedTokens] = useState<number | null>(null);+ const [jackpotTokens, setJackpotTokens] = useState<number | null>(null);const [totals, setTotals] = useState<{ spun: number; paidTokens: number } | null>(null);const [phase, setPhase] = useState<Phase>("idle");const [result, setResult] = useState<QualitySpin | null>(null);@@ -103,6 +104,7 @@ export function QualitySpinDialog(props: QualitySpinDialogProps) {if (!active || !details) return;if (details.segments.length) setSegments(details.segments);setExpectedTokens(details.expectedTokens);+ setJackpotTokens(details.jackpotTokens ?? null);}).catch(() => undefined);void omnirushQualitySpins()@@ -159,7 +161,7 @@ export function QualitySpinDialog(props: QualitySpinDialogProps) {};const resting = !canSpinNow(quality) && quality.spinsAvailable > 0;- const tease = result && phase === "result" ? nearMissText(result) : null;+ const tease = result && phase === "result" ? nearMissText(result, jackpotTokens) : null;const celebrate = result?.celebrate ?? "none";const busy = phase === "requesting" || phase === "spinning";const canSpin = !busy && spinsLeft > 0 && !(phase !== "result" && resting);@@ -224,6 +226,7 @@ export function QualitySpinDialog(props: QualitySpinDialogProps) {nearMiss={result?.nearMiss ?? false}soundEnabled={soundEnabled}reducedMotion={reducedMotion}+ jackpotTokens={result?.jackpotTokens ?? jackpotTokens}size={300}/></div>diff --git a/apps/app/src/react-app/domains/quality/quality-wheel.tsx b/apps/app/src/react-app/domains/quality/quality-wheel.tsxindex 7e066448..9699a8cb 100644--- a/apps/app/src/react-app/domains/quality/quality-wheel.tsx+++ b/apps/app/src/react-app/domains/quality/quality-wheel.tsx@@ -2,6 +2,7 @@import { useEffect, useMemo, useRef } from "react";import {+ jackpotIndex,sliceAtPointer,wheelAngleAt,wheelOvershoot,@@ -27,6 +28,8 @@ export type QualityWheelProps = {/** Pixel size of the wheel (square). */size?: number;durationMs?: number;+ /** The top prize (GET /me/quality `jackpot_tokens`); the biggest segment otherwise. */+ jackpotTokens?: number | null;};/** Low prizes in slate and teal, rising to the lime jackpot. */@@ -151,7 +154,7 @@ export function QualityWheel(props: QualityWheelProps) {// eslint-disable-next-line react-hooks/exhaustive-deps}, [targetIndex, spinId]);- const jackpot = segments.length - 1;+ const jackpot = jackpotIndex(segments, props.jackpotTokens);return (<divref={rootRef}diff --git a/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx b/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsxindex 00521743..11ea3b18 100644--- a/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx+++ b/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx@@ -40,7 +40,7 @@ import { getDisplaySessionTitle } from "../../../../app/lib/session-title";import { omnirushAccountStatus, type WorkspaceInfo } from "../../../../app/lib/desktop";import { omnirushUsageSummary } from "../../../../app/lib/omnirush-usage";import { isDesktopRuntime } from "../../../../app/lib/runtime-env";-import { refreshAccountStatus, useAccountStatusStore, useQualityUiStore, type AccountQuality } from "../../../../app/lib/quality";+import { refreshAccountStatus, setQualitySessionId, useAccountStatusStore, useQualityUiStore, type AccountQuality } from "../../../../app/lib/quality";import { ProgressRing, QualityTierBadge, SpinButton } from "../../quality/quality-parts";import { OmniRushDenHelpLink } from "../../workspace/omnirush-den-help-link";import { NotificationBell } from "../../../shell/notification-center";@@ -1139,6 +1139,11 @@ export function AppSidebar(props: AppSidebarProps) {[props.sessionNumberShortcuts.targets],);+ // Profile reads name the open session, so the quality hint and nudge are about it.+ React.useEffect(() => {+ setQualitySessionId(props.selectedSessionId ?? null);+ }, [props.selectedSessionId]);+// Green unread dots: agent finished while the user was on another session.React.useEffect(() => {const statuses = props.sessionStatusById ?? {};diff --git a/apps/app/tests/quality.test.tsx b/apps/app/tests/quality.test.tsxindex 8f045d7d..59e93fb9 100644--- a/apps/app/tests/quality.test.tsx+++ b/apps/app/tests/quality.test.tsx@@ -5,6 +5,9 @@ import {DEFAULT_WHEEL_SEGMENTS,NOTICE_SEEN_STORAGE_KEY,canSpinNow,+ jackpotIndex,+ refreshAccountStatus,+ setQualitySessionId,nearMissText,noticeToShow,nudgeToShow,@@ -24,7 +27,7 @@ import {type QualityTier,} from "../src/app/lib/quality";import { QualityTierBadge, streakText } from "../src/react-app/domains/quality/quality-parts";-import { QualityNoticeCard, QualityRewards } from "../src/react-app/domains/quality/quality-notice";+import { QualityNoticeCard, QualityRewards, SessionReasons, failLabel } from "../src/react-app/domains/quality/quality-notice";import { QualitySpinDialog } from "../src/react-app/domains/quality/quality-spin-dialog";const quality: AccountQuality = {@@ -242,3 +245,46 @@ describe("spin results", () => {expect(html).toContain("Today's biggest win");});});++describe("revision: fail labels, jackpot, open session", () => {+ test("fail codes read with the server's labels, a fallback otherwise", () => {+ expect(failLabel("outside_path", { outside_path: "Edits outside the project folder" })).toBe("Edits outside the project folder");+ expect(failLabel("outside_path")).toBe("edits outside the project folder");+ expect(failLabel("capture_truncated")).toBe("capture truncated");+ const html = renderToStaticMarkup(+ <SessionReasons+ reasons={{+ failLabels: { home_folder: "Started in your home folder" },+ sessions: [{+ sessionId: "ses_1", at: null, verdict: "review", why: "Started in ~.", fails: ["home_folder"], workspace: "my-app", spins: 0, counted: true,+ reproducible: "pass", workSize: 3, work: { codeFiles: 3, linesChanged: 120, toolCalls: 14, testRuns: 0, floor: 2, step: 3 },+ }],+ }}+ />,+ );+ expect(html).toContain("Started in your home folder");+ expect(html).toContain("3 code files · 120 lines · no tests");+ expect(html).toContain("reproducible");+ });++ test("the jackpot slice is the segment paying jackpot_tokens", () => {+ expect(jackpotIndex(DEFAULT_WHEEL_SEGMENTS, 10_000_000)).toBe(5);+ expect(jackpotIndex(DEFAULT_WHEEL_SEGMENTS, 5_000_000)).toBe(4);+ expect(jackpotIndex(DEFAULT_WHEEL_SEGMENTS, null)).toBe(5);+ expect(nearMissText({ ...spin, nearMiss: true, jackpotTokens: null }, 20_000_000)).toBe("So close to 20M!");+ });++ test("profile reads name the open session", async () => {+ const calls: unknown[] = [];+ const read = async (options?: { sessionId?: string | null }) => {+ calls.push(options ?? null);+ return { connected: true, gatewayConfigured: true, quality: null };+ };+ setQualitySessionId("ses_open");+ await refreshAccountStatus(read);+ setQualitySessionId(null);+ await refreshAccountStatus(read);+ expect(calls).toEqual([{ sessionId: "ses_open" }, null]);+ useAccountStatusStore.getState().set(null);+ });+});diff --git a/apps/desktop/electron/main.mjs b/apps/desktop/electron/main.mjsindex 7ff20778..315955f1 100644--- a/apps/desktop/electron/main.mjs+++ b/apps/desktop/electron/main.mjs@@ -2148,16 +2148,18 @@ const desktopCommandHandlers = {return runtimeManager.omnirushServerInfo();},"omnirushAccountStatus": async (event, ...args) => {- return omnirushAccountStore.status();+ // Optional `{ sessionId }`: the session open in the app, for the quality hint.+ const input = args[0] && typeof args[0] === "object" ? args[0] : {};+ return omnirushAccountStore.status({ sessionId: typeof input.sessionId === "string" ? input.sessionId : null });},// Quality rewards: the wheel's segments and recent sessions, spin totals, and one spin with the device// credential (X-OmniRush-Client like every account request). A refusal// (409 no_spins / wheel_resting / quality_rewards_off) comes back as a// value, not a thrown error, so the dialog can say which one it was.- "omnirushQualityDetails": async () => {+ "omnirushQualityDetails": async (event) => {return omnirushAccountStore.qualityDetails();},- "omnirushQualitySpins": async () => {+ "omnirushQualitySpins": async (event) => {return omnirushAccountStore.qualitySpinTotals();},"omnirushQualitySpin": async (event, ...args) => {diff --git a/apps/desktop/electron/omnirush-account.mjs b/apps/desktop/electron/omnirush-account.mjsindex 659e8466..183e5adc 100644--- a/apps/desktop/electron/omnirush-account.mjs+++ b/apps/desktop/electron/omnirush-account.mjs@@ -13,7 +13,7 @@ import {writePlaintextCredentialFile,} from "./plaintext-credential-file.mjs";import { CLIENT_HEADER, guiClientHeaderValue, parseClientUpdate } from "./update-gate.mjs";-import { parseAccountQuality, parseQualitySessions, parseSpinResult, parseWheelSegments, spinIdempotencyKey, spinRefusal } from "./quality.mjs";+import { parseAccountQuality, parseFailLabels, parseQualitySessions, profileSessionId, parseSpinResult, parseWheelSegments, spinIdempotencyKey, spinRefusal } from "./quality.mjs";const execFileAsync = promisify(execFile);@@ -933,9 +933,11 @@ export function createDesktopOmniRushAccountStore({* expired while the app was idle, so a second one is allowed before the* session counts as gone.*/- async function fetchProfile(credentials, refreshesLeft = 2) {+ async function fetchProfile(credentials, refreshesLeft = 2, sessionId = null) {const profileUrl = controlPlaneBase(credentials.gatewayUrl);profileUrl.pathname += "/device/me";+ // The open session: next_spin_hint and nudge then speak about it.+ if (sessionId) profileUrl.searchParams.set("session_id", sessionId);const response = await send(profileUrl, {headers: { Authorization: `Bearer ${credentials.accessToken}` },signal: AbortSignal.timeout(20_000),@@ -943,7 +945,7 @@ export function createDesktopOmniRushAccountStore({if (response.status === 401 && refreshesLeft > 0) {const refreshed = await refresh(credentials.accessToken);if (!refreshed) throw new InvalidAccountCredentialsError("Device session expired");- return fetchProfile(refreshed, refreshesLeft - 1);+ return fetchProfile(refreshed, refreshesLeft - 1, sessionId);}if (response.status === 401 || response.status === 403) {throw new InvalidAccountCredentialsError("Device session expired");@@ -1027,7 +1029,8 @@ export function createDesktopOmniRushAccountStore({}/** @returns {Promise<AccountStatus>} */- async function status() {+ async function status(input = {}) {+ const sessionId = profileSessionId(input?.sessionId);const credentials = await load();const configured = await configuredGatewayUrl();const gatewayConfigured = Boolean(configured);@@ -1046,7 +1049,7 @@ export function createDesktopOmniRushAccountStore({return { connected: false, gatewayConfigured, ...server, ...storage };}try {- const profile = await fetchProfile(credentials);+ const profile = await fetchProfile(credentials, 2, sessionId);return {connected: true,gatewayConfigured,@@ -1123,10 +1126,13 @@ export function createDesktopOmniRushAccountStore({const payload = await response.json();if (!payload || typeof payload !== "object" || !payload.quality) return null;const expected = Number(payload.expected_tokens);+ const jackpot = Number(payload.jackpot_tokens);return {segments: parseWheelSegments(payload.segments),expectedTokens: Number.isFinite(expected) ? expected : null,+ jackpotTokens: Number.isFinite(jackpot) && jackpot > 0 ? jackpot : null,sessions: parseQualitySessions(payload.sessions),+ failLabels: parseFailLabels(payload.fail_labels),};} catch {return null;diff --git a/apps/desktop/electron/quality.mjs b/apps/desktop/electron/quality.mjsindex eb699851..0598256c 100644--- a/apps/desktop/electron/quality.mjs+++ b/apps/desktop/electron/quality.mjs@@ -197,9 +197,42 @@ export function parseQualitySessions(value) {workspace: text(session.workspace),spins: count(session.spins),counted: session.counted === true,+ reproducible: ["pass", "fail", "unknown"].includes(session.reproducible) ? session.reproducible : null,+ workSize: Number.isInteger(session.work_size) ? Math.min(4, Math.max(0, session.work_size)) : null,+ work: parseSessionWork(session.work),}));}+function parseSessionWork(value) {+ if (!value || typeof value !== "object") return null;+ return {+ codeFiles: count(value.code_files),+ linesChanged: count(value.lines_changed),+ toolCalls: count(value.tool_calls),+ testRuns: count(value.test_runs),+ floor: count(value.floor),+ step: count(value.step),+ };+}++/** `fail_labels` of GET /me/quality: `{code: label}`, strings only. */+export function parseFailLabels(value) {+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};+ /** @type {Record<string, string>} */+ const labels = {};+ for (const [code, label] of Object.entries(value)) {+ const clean = text(label);+ if (clean && /^[a-z0-9_-]{1,64}$/i.test(code)) labels[code] = clean;+ }+ return labels;+}++/** A session id the profile request may name (`/device/me?session_id=`), or null. */+export function profileSessionId(value) {+ const id = text(value);+ return id && /^[A-Za-z0-9_-]{1,128}$/.test(id) ? id : null;+}+/** `{"detail": "wheel_resting"}` (or `{"detail": {"code": ...}}`) from a 409. */export function spinRefusal(payload) {const detail = payload && typeof payload === "object" ? payload.detail : null;diff --git a/apps/desktop/electron/quality.test.mjs b/apps/desktop/electron/quality.test.mjsindex c1d047b6..49e5db6f 100644--- a/apps/desktop/electron/quality.test.mjs+++ b/apps/desktop/electron/quality.test.mjs@@ -216,15 +216,39 @@ test("quality details: segments, expected tokens and the sessions' reasons", asyassert.equal(new URL(url).pathname, "/omnirush/me/quality");return Response.json({quality: QUALITY,- sessions: [{ session_id: "ses_1", at: "2026-10-04T10:00:00Z", verdict: "review", why: "Edits outside the project.", fails: ["outside_path"], workspace: "my-app", spins: 0, counted: true }],+ sessions: [{ session_id: "ses_1", at: "2026-10-04T10:00:00Z", verdict: "review", why: "Edits outside the project.", fails: ["outside_path"], workspace: "my-app", spins: 0, counted: true,+ reproducible: "fail", work_size: 3, work: { code_files: 3, lines_changed: 120, tool_calls: 14, test_runs: 0, floor: 2, step: 3 } },+ { session_id: "ses_2", reproducible: "maybe", work_size: 9, work: null }],segments: SEGMENTS,expected_tokens: 1037500,+ jackpot_tokens: 10000000,+ fail_labels: { outside_path: "Edits outside the project folder", "bad key!": "x", empty: "" },});});const details = await store.qualityDetails();assert.equal(details.segments.length, 6);assert.equal(details.expectedTokens, 1037500);+ assert.equal(details.jackpotTokens, 10000000);+ assert.deepEqual(details.failLabels, { outside_path: "Edits outside the project folder" });assert.deepEqual(details.sessions[0].fails, ["outside_path"]);+ assert.equal(details.sessions[0].reproducible, "fail");+ assert.equal(details.sessions[0].workSize, 3);+ assert.deepEqual(details.sessions[0].work, { codeFiles: 3, linesChanged: 120, toolCalls: 14, testRuns: 0, floor: 2, step: 3 });+ assert.equal(details.sessions[1].reproducible, null);+ assert.equal(details.sessions[1].workSize, 4);+ assert.equal(details.sessions[1].work, null);const off = await signedInStore(async () => Response.json({ quality: null, sessions: [], segments: [] }));assert.equal(await off.qualityDetails(), null);});++test("the profile read names the open session: /device/me?session_id=", async () => {+ const seen = [];+ const store = await signedInStore(async (url) => {+ seen.push(new URL(url).search);+ return Response.json({ email: "[email protected]", status: "active", quality: QUALITY });+ });+ await store.status({ sessionId: "ses_abc123" });+ await store.status();+ await store.status({ sessionId: "../etc?x=1" });+ assert.deepEqual(seen, ["?session_id=ses_abc123", "", ""]);+});diff --git a/packages/types/src/desktop-ipc.ts b/packages/types/src/desktop-ipc.tsindex 8f0836d2..d97ab969 100644--- a/packages/types/src/desktop-ipc.ts+++ b/packages/types/src/desktop-ipc.ts@@ -253,12 +253,20 @@ export type OmniRushQualitySession = {workspace: string | null;spins: number;counted: boolean;+ reproducible: "pass" | "fail" | "unknown" | null;+ /** The work-size step, 0..4. */+ workSize: number | null;+ work: { codeFiles: number; linesChanged: number; toolCalls: number; testRuns: number; floor: number; step: number } | null;};export type OmniRushQualityDetails = {segments: OmniRushWheelSegment[];expectedTokens: number | null;+ /** The top segment's prize. */+ jackpotTokens: number | null;sessions: OmniRushQualitySession[];+ /** `{code: label}` for the sessions' `fails`. */+ failLabels: Record<string, string>;};/** GET /me/quality/spins totals. */@@ -734,7 +742,7 @@ export type DesktopCommandMap = {// OmniRush.ai server sidecaromnirushServerInfo: { args: []; result: OmniRushServerInfo };omnirushAccountStatus: {- args: [];+ args: [options?: { sessionId?: string | null }];result: OmniRushAccountStatus;};omnirushQualityDetails: { args: []; result: OmniRushQualityDetails | null };