A desktop coding agent with free access to frontier models.
TypeScript
fix: hide bundled Lima setup step
ogsamrat0d0229e783dd
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex 1e1dd49f..e024f3aa 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -561,7 +561,7 @@ export type OmniRushWorkspaceBoxProgress = {layersTotal: number;startedAt: number | null;/** macOS, the OmniRush VM's first setup: its step ("lima", "vm_image", "vm_boot", "image") and that step's bytes. Older servers: absent. */- setup?: { step: string; bytesDone: number | null; bytesTotal: number | null } | null;+ setup?: { step: string; bytesDone: number | null; bytesTotal: number | null; seen?: string[] } | null;};export type OmniRushWorkspaceBoxChange = OmniRushWorkspaceBox & {engine: { status: "unchanged" | "applied" | "deferred" | "failed" | "unmanaged" };diff --git a/apps/app/src/react-app/domains/settings/sandbox-setup.ts b/apps/app/src/react-app/domains/settings/sandbox-setup.tsindex da2b9337..ed51f68b 100644--- a/apps/app/src/react-app/domains/settings/sandbox-setup.ts+++ b/apps/app/src/react-app/domains/settings/sandbox-setup.ts@@ -97,7 +97,8 @@ function stepBar(done: number | null, total: number | null): { value: number | nexport function macVmSteps(box: OmniRushWorkspaceBox): SandboxSetupStep[] {const setup = box.progress?.setup ?? null;const starting = box.state === "starting" || box.state === "ready";- const at = starting ? VM_STEPS.length : Math.max(0, VM_STEPS.findIndex((s) => s.step === setup?.step));+ // Nothing said yet: the VM image is the first step (Lima, when it is downloaded, names itself first).+ const at = starting ? VM_STEPS.length : setup ? Math.max(0, VM_STEPS.findIndex((s) => s.step === setup.step)) : 1;const steps: SandboxSetupStep[] = VM_STEPS.map((s, index) => {const state = index < at ? "done" : index === at ? "active" : "todo";const progress = state !== "active" ? null@@ -106,8 +107,8 @@ export function macVmSteps(box: OmniRushWorkspaceBox): SandboxSetupStep[] {: null;return { id: s.id, label: s.label, state, ...(progress ? { progress } : {}) };});- // The VM tools came with the app (no "lima" step was ever named): not shown.- const shown = setup && setup.step !== "lima" ? steps.filter((s) => s.id !== "lima") : steps;+ // The VM tools came with the app (the setup never named a "lima" step): not shown.+ const shown = setup?.step === "lima" || setup?.seen?.includes("lima") ? steps : steps.filter((s) => s.id !== "lima");shown.push({ id: "start", label: "Start the sandbox", state: box.state === "starting" ? "active" : box.state === "ready" ? "done" : "todo" });return shown;}diff --git a/apps/app/tests/sandbox-setup.test.tsx b/apps/app/tests/sandbox-setup.test.tsxindex be3ab653..539410b9 100644--- a/apps/app/tests/sandbox-setup.test.tsx+++ b/apps/app/tests/sandbox-setup.test.tsx@@ -105,9 +105,9 @@ describe("sandbox setup panel: what it shows", () => {const mac = (progress: Partial<NonNullable<OmniRushWorkspaceBox["progress"]>> | null, state: OmniRushWorkspaceBox["state"] = "downloading") =>sandboxSetupView(box({ platform: "darwin", state, runtime: vm, setup: setup({ need: "mac_vm" }), progress: progress ? { bytesDone: null, bytesTotal: null, layersDone: 0, layersTotal: 0, startedAt: 1, ...progress } : null }));const steps = (view: ReturnType<typeof sandboxSetupView>) => view?.steps.map((step) => `${step.id}:${step.state}`);- // Nothing said yet: the first step; Lima downloading: its own bytes.- expect(steps(mac(null))).toEqual(["lima:active", "vm_image:todo", "vm_boot:todo", "download:todo", "start:todo"]);- const lima = mac({ setup: { step: "lima", bytesDone: 19_000_000, bytesTotal: 38_000_000 } });+ // Nothing said yet: the VM's steps (Lima only once the setup names it); Lima downloading: its own bytes.+ expect(steps(mac(null))).toEqual(["vm_image:active", "vm_boot:todo", "download:todo", "start:todo"]);+ const lima = mac({ setup: { step: "lima", bytesDone: 19_000_000, bytesTotal: 38_000_000, seen: ["lima"] } });expect(lima).toMatchObject({ kind: "progress", title: "Setting up the sandbox" });expect(lima?.steps[0]?.progress).toEqual({ value: 50, label: "19 of 38 MB · 50%" });// Lima shipped with the app (the first step named is the VM image): no Lima step.@@ -119,6 +119,9 @@ describe("sandbox setup panel: what it shows", () => {expect(steps(box_)).toEqual(["vm_image:done", "vm_boot:done", "download:active", "start:todo"]);expect(box_?.steps[2]?.progress).toEqual({ value: 50, label: "130 of 260 MB · 50%" });expect(steps(mac({ setup: { step: "image", bytesDone: null, bytesTotal: null } }, "starting"))).toEqual(["vm_image:done", "vm_boot:done", "download:done", "start:active"]);+ expect(steps(mac(null, "starting"))).toEqual(["vm_image:done", "vm_boot:done", "download:done", "start:active"]);+ // Lima downloaded first (not shipped with this build): its step stays, done.+ expect(steps(mac({ setup: { step: "vm_boot", bytesDone: null, bytesTotal: null, seen: ["lima", "vm_image", "vm_boot"] } }))).toEqual(["lima:done", "vm_image:done", "vm_boot:active", "download:todo", "start:todo"]);const runtime = sandboxSetupView(box({ platform: "linux", setup: setup({ need: "runtime" }) }));expect(runtime).toMatchObject({ kind: "action", title: "Install Podman or Docker" });expect(runtime?.next?.command).toBe("sudo apt install podman");diff --git a/apps/server/src/box/box-lima.test.ts b/apps/server/src/box/box-lima.test.tsindex c85e1195..0ef0904c 100644--- a/apps/server/src/box/box-lima.test.ts+++ b/apps/server/src/box/box-lima.test.ts@@ -436,8 +436,8 @@ describe("lima: boxes", () => {describe("lima: the first setup's progress and the wait for it", () => {test("setup lines: the step the VM setup is at, with that step's bytes; the image's own bytes after it", () => {const text = [setupLine("lima"), setupLine("lima", 1_000, 38_000_000), setupLine("vm_image"), setupLine("vm_image", 84_000_000, 336_000_000)].join("\n");- expect(parseSetupLines(text)).toEqual({ step: "vm_image", bytesDone: 84_000_000, bytesTotal: 336_000_000 });- expect(parseSetupLines(`${text}\n${setupLine("vm_boot")}`)).toEqual({ step: "vm_boot", bytesDone: null, bytesTotal: null });+ expect(parseSetupLines(text)).toEqual({ step: "vm_image", bytesDone: 84_000_000, bytesTotal: 336_000_000, seen: ["lima", "vm_image"] });+ expect(parseSetupLines(`${text}\n${setupLine("vm_boot")}`)).toEqual({ step: "vm_boot", bytesDone: null, bytesTotal: null, seen: ["lima", "vm_image", "vm_boot"] });expect(parseSetupLines('{"progress":{"bytes":1,"total":2}}')).toBeNull();const dir = tmp();const marker = path.join(dir, "pulls", "lima-x.pid");diff --git a/apps/server/src/box/pull-progress.ts b/apps/server/src/box/pull-progress.tsindex 414c92a9..cc985092 100644--- a/apps/server/src/box/pull-progress.ts+++ b/apps/server/src/box/pull-progress.ts@@ -34,11 +34,12 @@ export type PullProgress = {setup?: SetupProgress | null;};-export type SetupProgress = { step: string; bytesDone: number | null; bytesTotal: number | null };+export type SetupProgress = { step: string; bytesDone: number | null; bytesTotal: number | null; seen: string[] };-/** The last setup step a log names (`{"setup":{"step","bytes","total"}}`), with its bytes; null: none. */+/** The last setup step a log names (`{"setup":{"step","bytes","total"}}`), with its bytes and every step named so far; null: none. */export function parseSetupLines(text: string): SetupProgress | null {let last: SetupProgress | null = null;+ const seen: string[] = [];for (const raw of text.split(/\r?\n|\r/)) {const line = raw.trim();if (!line.startsWith("{\"setup\"")) continue;@@ -49,8 +50,10 @@ export function parseSetupLines(text: string): SetupProgress | null {const bytes = Number(parsed?.setup?.bytes);const total = Number(parsed?.setup?.total);const same: boolean = last !== null && last.step === step;+ if (!seen.includes(step)) seen.push(step);last = {step,+ seen: [...seen],bytesDone: Number.isFinite(bytes) ? bytes : same ? last!.bytesDone : null,bytesTotal: total > 0 ? total : same ? last!.bytesTotal : null,};