Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
fix(local-installation): repair damaged bundled TeamHub binaries
Afloatd130cca184b8
diff --git a/packages/local-installation/AGENTS.md b/packages/local-installation/AGENTS.mdindex 7e767bb5..b09c2aa5 100644--- a/packages/local-installation/AGENTS.md+++ b/packages/local-installation/AGENTS.md@@ -95,6 +95,11 @@ never leaves a directory that later attempts treat as initialized. A `postgres-d`PG_VERSION` but no `postmaster.opts` (which only a started server writes)never served a connection, holds no data, and is initialized again.+The desktop's bundled TeamHub binaries (`teamhub-binaries.ts`) count as current+only when their files still match the manifest's sizes and hashes. A missing+or damaged installed file is copied again from the bundle, so Native can use+the verified binaries without downloading Go and compiling from source.+Every Linger release creates TeamHub's schema from the 852 baselinemigration, which refuses a database that already holds one. A database fromthe desktop app before the rename has `public.accounts` but no applied 852diff --git a/packages/local-installation/src/teamhub-binaries.test.ts b/packages/local-installation/src/teamhub-binaries.test.tsindex 32992f04..6fa3393d 100644--- a/packages/local-installation/src/teamhub-binaries.test.ts+++ b/packages/local-installation/src/teamhub-binaries.test.ts@@ -74,6 +74,30 @@ test("copies the binaries of its own source package into the source", async () =).toBe("absent");});+test.each(["missing", "truncated", "same-sized change"])(+ "repairs a %s installed binary even when its manifest is current",+ async (damage) => {+ const f = await bundle();+ const expected = { target, sourceArchiveSha256 };+ await installTeamhubBinaries(f.from, f.repo, expected);+ const file = path.join(f.repo, TEAMHUB_BINARY_DIRECTORY, "teamhub.exe");+ if (damage === "missing") await rm(file);+ else+ await writeFile(+ file,+ damage === "truncated" ? "teamhub" : "teamhub for windowz",+ );+ expect(await installTeamhubBinaries(f.from, f.repo, expected)).toBe(+ "installed",+ );+ expect(await readFile(file, "utf8")).toBe("teamhub for windows");+ expect(await checkTeamhubBinaries(f.repo, target)).toBe("verified");+ expect(await installTeamhubBinaries(f.from, f.repo, expected)).toBe(+ "current",+ );+ },+);+test("refuses binaries of another target or source package", async () => {const f = await bundle();await expect(diff --git a/packages/local-installation/src/teamhub-binaries.ts b/packages/local-installation/src/teamhub-binaries.tsindex 2a0ab081..858eb560 100644--- a/packages/local-installation/src/teamhub-binaries.ts+++ b/packages/local-installation/src/teamhub-binaries.ts@@ -132,7 +132,15 @@ export async function installTeamhubBinaries();const destination = path.join(repo, TEAMHUB_BINARY_DIRECTORY);const current = await readTeamhubBinaries(destination).catch(() => undefined);- if (JSON.stringify(current) === JSON.stringify(manifest)) return "current";+ if (JSON.stringify(current) === JSON.stringify(manifest)) {+ try {+ await verifyTeamhubBinaries(destination, manifest);+ return "current";+ } catch {+ // A matching manifest can outlive a missing or damaged binary. Restore+ // the bundled copy before Native has to fall back to compiling it.+ }+ }await rm(destination, { recursive: true, force: true });await mkdir(destination, { recursive: true });try {