| 1 | import React from "react"; |
| 2 | import { createRoot } from "react-dom/client"; |
| 3 | import { ManualSessionRecovery } from "../src/components/ManualSessionRecovery"; |
| 4 | import { LocaleProvider } from "../src/lib/i18n"; |
| 5 | import { installDesktopHostStub } from "../src/__tests__/desktopHostStub"; |
| 6 | import "../src/styles.css"; |
| 7 | |
| 8 | let status = "waiting_lock"; |
| 9 | let retries = 0; |
| 10 | let exports = 0; |
| 11 | let release: (() => void) | undefined; |
| 12 | const item = () => ({ operationId: "browser-creation", scope: "global", phase: "starting", ref: { hostId: "local", sessionId: "current" }, |
| 13 | progress: { status, stage: "building_runtime", stageStartedAt: Date.now(), elapsedMs: 0, slow: false } }); |
| 14 | installDesktopHostStub({ |
| 15 | ListManualSessionCreations: async () => [item(), { ...item(), operationId: "old", ref: { hostId: "local", sessionId: "other" }, workspaceRoot: "/private/old-project", phase: "failed" }], |
| 16 | GetManualSessionCreation: async () => item(), |
| 17 | RetryManualSessionCreation: async () => { |
| 18 | retries++; |
| 19 | await new Promise<void>(resolve => { release = resolve; }); |
| 20 | status = "running"; |
| 21 | return item(); |
| 22 | }, |
| 23 | ExportManualCreationDiagnostics: async () => { exports++; return "creation-diagnostics.json"; }, |
| 24 | }); |
| 25 | Object.assign(window, { creationFixture: { finish: () => release?.(), setStatus: (next: string) => { status = next; }, counts: () => ({ retries, exports }) } }); |
| 26 | createRoot(document.getElementById("root")!).render(<LocaleProvider><ManualSessionRecovery sessionId="current" /></LocaleProvider>); |
| 27 |