A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.
TypeScript
fix(runtime): pin the engine's packages and update Pi to 1.4.0
Alan Buscaglia278a2eb82f8a
diff --git a/packages/daemon/package.json b/packages/daemon/package.jsonindex ca4772a..38fa40d 100644--- a/packages/daemon/package.json+++ b/packages/daemon/package.json@@ -10,12 +10,12 @@"build:runtime": "node scripts/build-runtime.ts"},"dependencies": {- "@earendil-works/pi-ai": "1.0.4",- "@earendil-works/pi-coding-agent": "1.0.4",- "@earendil-works/pi-mcp": "1.0.4",- "@earendil-works/pi-tui": "1.0.4",+ "@earendil-works/pi-ai": "1.4.0",+ "@earendil-works/pi-coding-agent": "1.4.0",+ "@earendil-works/pi-mcp": "1.4.0",+ "@earendil-works/pi-tui": "1.4.0","@gentle-dot/protocol": "workspace:*",- "gentle-pi": "4.0.0",+ "gentle-pi": "4.3.0","jiti": "2.7.0","ws": "^8.22.0"},diff --git a/packages/daemon/src/rotation.ts b/packages/daemon/src/rotation.tsindex ba526b6..2d2cfec 100644--- a/packages/daemon/src/rotation.ts+++ b/packages/daemon/src/rotation.ts@@ -17,7 +17,7 @@ export const DEFAULT_ROTATION: RotationLimits = { bytes: 20 * 1024 * 1024, compa/** `customType` of the hidden message that carries the earlier session into the new one. */export const HANDOFF_TYPE = "gentle-dot.handoff";-/** The engine's session format (`CURRENT_SESSION_VERSION` in pi-coding-agent 1.0.4). */+/** The engine's session format (`CURRENT_SESSION_VERSION` in pi-coding-agent 1.0.4 through 1.4.0). */const SESSION_VERSION = 3;const RECENT_MESSAGES = 12;const MESSAGE_CHARS = 2000;diff --git a/packages/daemon/src/runtime-build.ts b/packages/daemon/src/runtime-build.tsindex fb9de89..d0aa52f 100644--- a/packages/daemon/src/runtime-build.ts+++ b/packages/daemon/src/runtime-build.ts@@ -33,6 +33,29 @@ export function lockedDependencies(return versions;}+/**+ * The lockfile's versions of the engine's own packages (`@earendil-works/*`) that the runtime+ * does not list directly. The engine asks for them with `^` ranges, so a fresh `npm install`+ * would take newer releases that may no longer fit it; the runtime pins them as `overrides`.+ */+export function lockedEnginePackages(+ direct: Record<string, string>,+ lockfile: string = readFileSync(LOCKFILE, "utf8"),+): Record<string, string> {+ const versions: Record<string, string> = {};+ let inPackages = false;+ for (const line of lockfile.split("\n")) {+ if (/^\S/.test(line)) inPackages = line.trim() === "packages:";+ const match = inPackages ? /^ {2}'?(@earendil-works\/[^@'/]+)@([^(':]+)/.exec(line) : null;+ if (!match?.[1] || !match[2] || match[1] in direct) continue;+ const [, name, version] = match;+ if (versions[name] && versions[name] !== version)+ throw new Error(`The lockfile holds two versions of ${name}.`);+ versions[name] = version;+ }+ return versions;+}+/** A `pi` command that runs the runtime's own Node on the engine, from wherever the runtime folder is. */export function piWrapper(engineEntry: string): string {return `#!/bin/sh@@ -92,7 +115,13 @@ export async function buildRuntime(outDir: string): Promise<void> {for (const name of ["approval-guard.ts", "screenshot-context.ts"]) {copyFileSync(join(PACKAGE, "src", "extensions", name), join(daemon, "extensions", name));}- const manifest = { name: "gentle-dot-runtime", private: true, type: "module", dependencies };+ const manifest = {+ name: "gentle-dot-runtime",+ private: true,+ type: "module",+ dependencies,+ overrides: lockedEnginePackages(dependencies),+ };writeFileSync(join(daemon, "package.json"), `${JSON.stringify(manifest, null, "\t")}\n`);writeFileSync(join(outDir, "bin", "pi"), piWrapper(engineEntry()), { mode: 0o755 });}diff --git a/packages/daemon/test/runtime-build.test.ts b/packages/daemon/test/runtime-build.test.tsindex bf7dd87..522c6ee 100644--- a/packages/daemon/test/runtime-build.test.ts+++ b/packages/daemon/test/runtime-build.test.ts@@ -66,16 +66,27 @@ describe("build:runtime", () => {const manifest = JSON.parse(readFileSync(join(out, "daemon", "package.json"), "utf8"));expect(manifest).toMatchObject({ private: true, type: "module" });expect(manifest.dependencies).toEqual({- "@earendil-works/pi-ai": "1.0.4",- "@earendil-works/pi-coding-agent": "1.0.4",- "@earendil-works/pi-mcp": "1.0.4",- "@earendil-works/pi-tui": "1.0.4",- "gentle-pi": "4.0.0",+ "@earendil-works/pi-ai": "1.4.0",+ "@earendil-works/pi-coding-agent": "1.4.0",+ "@earendil-works/pi-mcp": "1.4.0",+ "@earendil-works/pi-tui": "1.4.0",+ "gentle-pi": "4.3.0",jiti: "2.7.0",ws: "8.22.0",});});+ // The engine asks for its siblings with `^` ranges; a fresh install would take newer ones+ // that no longer match it (pi-codemode 1.4.0 broke pi-coding-agent 1.0.4).+ it("pins the engine's own packages to the lockfile's versions", () => {+ const manifest = JSON.parse(readFileSync(join(out, "daemon", "package.json"), "utf8"));+ expect(manifest.overrides).toEqual({+ "@earendil-works/pi-agent-core": "1.4.0",+ "@earendil-works/pi-codemode": "1.4.0",+ "@earendil-works/pi-telemetry": "1.4.0",+ });+ });+it("runs its self-check from the output with the engine resolved inside it", () => {symlinkSync(join(PACKAGE, "node_modules"), join(out, "daemon", "node_modules"));const check = spawnSync(process.execPath, [join(out, "daemon", "cli.mjs"), "--self-check"], {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex b7891f7..a451521 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -33,23 +33,23 @@ importers:packages/daemon:dependencies:'@earendil-works/pi-ai':- specifier: 1.0.4- version: 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])+ specifier: 1.4.0+ version: 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])'@earendil-works/pi-coding-agent':- specifier: 1.0.4+ specifier: 1.4.0'@earendil-works/pi-mcp':- specifier: 1.0.4- version: 1.0.4+ specifier: 1.4.0+ version: 1.4.0'@earendil-works/pi-tui':- specifier: 1.0.4- version: 1.0.4+ specifier: 1.4.0+ version: 1.4.0'@gentle-dot/protocol':specifier: workspace:*version: link:../protocolgentle-pi:- specifier: 4.0.0- version: 4.0.0(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])([email protected])+ specifier: 4.3.0+ version: 4.3.0(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])([email protected])jiti:specifier: 2.7.0version: 2.7.0@@ -326,38 +326,34 @@ packages:resolution: {integrity: sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==}engines: {node: '>=20.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-d2JZw2utoa/reoSmL07O71wsXiMDhIlnnxTb4LCNV+Oq8Evj2rGLvjVuYrlXZGbXUr0IDNfvd1RT/utCY1UhkQ==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-PoKY84SKUwnt7S5QBZaGUqfNO1kjP3KHpHUA9QpFTj4cOjaVWMYIcBPJ6FDRCdE8Zen9OSECQUd0uUfVgtSmgA==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-/xGICE+N/+G9N7KfYFSxlE8G8fQcBlLHKiY+j1Ehz9vvb1zhvGneWosFK56d2qmA5oteafeG7yKr2nqU4ed9ig==}- engines: {node: '>=22.19.0'}-- '@earendil-works/[email protected]':- resolution: {integrity: sha512-/Eu5R0gfor6wcmRcVyOmulUiZmsHJ0bKu5wXXnpCoSHF3y4FnW4fgnjRlLjNza8NJWXdvW5Uew90Zukx7Sh2rw==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-hQM/C4+1w8rHYACzDDf+0vQMnEnpzIop1tptIERVgR3ZeT/hHSzBNG8PaWPgxWQjqSeKCyBZSyp8uTT6eKK1pQ==}engines: {node: '>=22.19.0'}hasBin: true- '@earendil-works/[email protected]':- resolution: {integrity: sha512-e198pjBsdEQJ/RCjJ9ZeYIjRaQYWUgtoZbPCmJ57auuOsiRsBXeSZ1aiWtTah0/7gx97WIOD1XqHvgRU0gOXtg==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-23CNAXpS9DuLzPMyYuvrXVVio46x4YhffCgCqaWmF7F5H8PooqjrQvX4ucF6M0BhUd+x2tV6r1J0dv8cCME4Cg==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-+956nfMFHr5lDUVY/2Q4k+YzojzBuCaBXFgj0eSlXVGr7QVliVddKdc1Pz6yVg1dOlJQmb67doOVrlMsIcIdaw==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-Z41LpZ3yYHSC/UUps6Mr39UMFPwH8elhJBG9DY1P7kuzsE5qSK/6eMj2EHzO5evJRQWLbKSqUMw+4nCNtIyiQg==}engines: {node: '>=22.19.0'}hasBin: true- '@earendil-works/[email protected]':- resolution: {integrity: sha512-I6SqOqrKED+XrjkkFIXY7Ze38QtXtjojPJlQsJ2v5soCPV4QI1bNxXDwQaqzZ2a+6pNN8meWrRw1qkSMbPy9QQ==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-92aZmmGsUpHHknYuKXZHRINQfahntw5hU9If0I0ZM49GojOaFHpkl5/GF3/aatqpt7v7GjZbBfpfSygGKW+pnw==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-DL2eXXtnL5/VQkuQd97fL57GXTG1/zKHtMmDsrv8tGeJ5EgYYTWvzy44dqbYL0lD0Z22v/NOwqU3PHO75HVrqA==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-MLIfowwUYIY65jSjMX82paZOrX/NTvLk6D08h+3Jq42a99RzUOewzuCR0zOlPul3D6UBfddat76VT6LvsHEs1w==}engines: {node: '>=22.19.0'}- '@earendil-works/[email protected]':- resolution: {integrity: sha512-TgvDJohtxvG3XWQID5w6bwEyBocywdG0F9yHZtP+Ywvtiq9RgeSMbeB8quUobk7/4ko6IvFOQo45AqIqNVr8Rg==}+ '@earendil-works/[email protected]':+ resolution: {integrity: sha512-4obPOjgOD7g4mGSlngIvxyujC1UPdmyI9zdVthbr8GufacFEX+Ce0+scPgHg++k2xj5+QjESM2d5TxvIuzCVmg==}engines: {node: '>=22.19.0'}'@esbuild/[email protected]':@@ -1437,13 +1433,13 @@ packages:resolution: {integrity: sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg==}engines: {node: '>=18'}- resolution: {integrity: sha512-ZG/diWBSKPfjU4MjiHVUXxHWQvDSRS2dvpPCma4ZINuV+8UGdZAPHca6vcK27FLAAG7crlJpwdWOcwVNW4rh/Q==}+ resolution: {integrity: sha512-xXBEZaGqden4bblEPagQEnkF12L0JHhsPr1REBGvhSeDy6mbHDQmEvUU5ATr9lvWb7xsTOXV7gwnfq4U+z7lpA==}engines: {node: '>=22.19.0'}hasBin: truepeerDependencies:'@earendil-works/pi-ai': '*'- '@earendil-works/pi-coding-agent': '>=0.99.1'+ '@earendil-works/pi-coding-agent': '>=1.2.0''@earendil-works/pi-tui': '*'typebox: '*'peerDependenciesMeta:@@ -1667,6 +1663,12 @@ packages:resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}+ resolution: {integrity: sha512-GUj8HjiEbur9yhgUo52FBgKizggF1QtT6gVdrYdWW6ZB4lVVjgS3EyyXPyfyRD0V4ghGRPlO7MO80rgSWbm0eA==}+ engines: {node: '>=18'}+ peerDependencies:+ marked: '>=15.0.0'+resolution: {integrity: sha512-HnslJfsZkRPBDJRHvVtAaWlZHEpSu7u8LgQuJCELjRKuWR+hpq4A7sLq3p8HaI9ypVoXDXxV34CsQJEe1+J5Aw==}engines: {node: '>= 20'}@@ -2556,13 +2558,9 @@ snapshots:'@csstools/[email protected]': {}- '@earendil-works/[email protected]':+ '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])':dependencies:- esbuild: 0.28.2-- '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])':- dependencies:- '@earendil-works/pi-ai': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])+ '@earendil-works/pi-ai': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])typebox: 1.3.27transitivePeerDependencies:- '@aws-sdk/credential-provider-node'@@ -2577,11 +2575,11 @@ snapshots:- ws- zod- '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])':+ '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])':dependencies:'@anthropic-ai/sdk': 0.129.0'@aws-sdk/client-bedrock-runtime': 3.1127.0- '@earendil-works/pi-telemetry': 1.0.4+ '@earendil-works/pi-telemetry': 1.4.0'@google/genai': 2.21.0'@smithy/node-http-handler': 4.12.1http-proxy-agent: 9.1.0@@ -2602,11 +2600,11 @@ snapshots:- ws- zod- '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])':+ '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])':dependencies:'@anthropic-ai/sdk': 0.129.0'@aws-sdk/client-bedrock-runtime': 3.1127.0- '@earendil-works/pi-telemetry': 1.0.4+ '@earendil-works/pi-telemetry': 1.4.0'@google/genai': 2.21.0'@smithy/node-http-handler': 4.12.1http-proxy-agent: 9.1.0@@ -2627,18 +2625,17 @@ snapshots:- ws- zod- '@earendil-works/[email protected]':+ '@earendil-works/[email protected]':dependencies:quickjs-wasi: 3.6.2- '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])':+ '@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])':dependencies:- '@earendil-works/chord': 1.0.4- '@earendil-works/pi-agent-core': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])- '@earendil-works/pi-ai': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])- '@earendil-works/pi-codemode': 1.0.4- '@earendil-works/pi-mcp': 1.0.4- '@earendil-works/pi-tui': 1.0.4+ '@earendil-works/pi-agent-core': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])+ '@earendil-works/pi-ai': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])+ '@earendil-works/pi-codemode': 1.4.0+ '@earendil-works/pi-mcp': 1.4.0+ '@earendil-works/pi-tui': 1.4.0'@silvia-odwyer/photon-node': 0.3.4brace-expansion: 5.0.12chalk: 6.0.0@@ -2668,16 +2665,17 @@ snapshots:- ws- zod- '@earendil-works/[email protected]':+ '@earendil-works/[email protected]':dependencies:cross-spawn: 7.0.6- '@earendil-works/[email protected]': {}+ '@earendil-works/[email protected]': {}- '@earendil-works/[email protected]':+ '@earendil-works/[email protected]':dependencies:get-east-asian-width: 1.6.0marked: 18.0.11+ marked-cjk-friendly: 0.1.2([email protected])'@esbuild/[email protected]':optional: true@@ -2811,11 +2809,11 @@ snapshots:- supports-color- utf-8-validate- '@heyhuynhgiabuu/[email protected](@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])':+ '@heyhuynhgiabuu/[email protected](@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])':dependencies:- '@earendil-works/pi-ai': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])- '@earendil-works/pi-coding-agent': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])- '@earendil-works/pi-tui': 1.0.4+ '@earendil-works/pi-ai': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])+ '@earendil-works/pi-coding-agent': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])+ '@earendil-works/pi-tui': 1.4.0'@ff-labs/fff-node': 0.10.6'@shikijs/cli': 4.5.0shiki: 4.0.2@@ -3477,14 +3475,14 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])([email protected]):+ [email protected](@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])([email protected]):dependencies:- '@heyhuynhgiabuu/pi-pretty': 0.6.27(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])+ '@heyhuynhgiabuu/pi-pretty': 0.6.27(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))(@earendil-works/[email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected]))(@earendil-works/[email protected])typebox: 1.3.27optionalDependencies:- '@earendil-works/pi-ai': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])- '@earendil-works/pi-coding-agent': 1.0.4(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])- '@earendil-works/pi-tui': 1.0.4+ '@earendil-works/pi-ai': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])+ '@earendil-works/pi-coding-agent': 1.4.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])+ '@earendil-works/pi-tui': 1.4.0@@ -3719,6 +3717,10 @@ snapshots:+ dependencies:+ marked: 18.0.11+