A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.
TypeScript
fix(daemon): write no transpile cache inside the app bundle
Alan Buscaglia125b5010111d
diff --git a/packages/daemon/src/auth.ts b/packages/daemon/src/auth.tsindex 609a0a5..01ffc53 100644--- a/packages/daemon/src/auth.ts+++ b/packages/daemon/src/auth.ts@@ -66,7 +66,8 @@ async function registerEngineProviders(runtime: {registerNativeProvider(provider: never): void;}): Promise<void> {const { createJiti } = await import("jiti");- const jiti = createJiti(import.meta.url);+ // No transpile cache: in the packaged app the default one lands inside the signed bundle (S35.1).+ const jiti = createJiti(import.meta.url, { fsCache: false });const { createNanProviderConfig } = await jiti.import<{createNanProviderConfig: () => { id: string };}>("gentle-pi/lib/nan-provider.ts");diff --git a/packages/daemon/test/auth.test.ts b/packages/daemon/test/auth.test.tsindex 8387291..e8cb38a 100644--- a/packages/daemon/test/auth.test.ts+++ b/packages/daemon/test/auth.test.ts@@ -1,4 +1,4 @@-import { statSync } from "node:fs";+import { readdirSync, statSync } from "node:fs";import { join } from "node:path";import type { ServerMessage } from "@gentle-dot/protocol";import { afterEach, describe, expect, it } from "vitest";@@ -262,6 +262,22 @@ describe("createModelAuthRuntime (Pi's runtime, offline)", () => {}});+ it("loads the engine's providers without writing a transpile cache anywhere (S35.1, #8, #28)", async () => {+ // jiti's default cache goes to node_modules/.cache/jiti or the temp dir; in the packaged app the+ // former is inside the signed bundle. Point the temp dir at an empty folder and look there.+ const home = tempDir();+ const tmp = tempDir();+ const saved = process.env.TMPDIR;+ process.env.TMPDIR = tmp;+ try {+ await createModelAuthRuntime(home, home);+ } finally {+ if (saved === undefined) delete process.env.TMPDIR;+ else process.env.TMPDIR = saved;+ }+ expect(readdirSync(tmp)).toEqual([]);+ });+it("lists NaN, the provider the engine's own extension registers, with its API key sign-in", async () => {const home = tempDir();const runtime = await createModelAuthRuntime(home, home);