Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.
TypeScript agentai-agentai-agentsai-assistantandroidautomationchatgptcoding-agentcomputer-usedesktop-appelectronllmlocal-firstmcpmulti-agentollamaopenaiprivacyself-hostedtypescript
feat(desktop): Windows builds bundle MinGit so Git is always available
leen.zhouce3ed4b0074d
diff --git a/THIRD_PARTY_NOTICES b/THIRD_PARTY_NOTICESindex 919406e..0075d55 100644--- a/THIRD_PARTY_NOTICES+++ b/THIRD_PARTY_NOTICES@@ -61,7 +61,15 @@ Bundled binaries and assetsonly. Details, sources and the MPL-2.0 text:apps/desktop/resources/licenses/-8. External agent logos (packages/external-agents/assets/logos/)+8. MinGit (Git for Windows) 2.56.1 (bundled unmodified in the Windows desktop+ app only, as resources/bin/git/)+ Source: https://github.com/git-for-windows/git/releases/tag/v2.56.1.windows.1+ License: GNU General Public License, version 2 (Git), plus the licenses of+ its bundled components; full texts ship in resources/bin/git/LICENSE.txt.+ Pi Bot runs it as a separate program; the GPL does not apply to the rest of+ Pi Bot. Details and corresponding source: apps/desktop/resources/licenses/mingit.md++9. External agent logos (packages/external-agents/assets/logos/)Codex, Claude, Cursor and OpenCode marks are trademarks of their owners andare used only to identify the user's own installed agent. Sources are listedin packages/external-agents/assets/logos/NOTICE.md. These marks are notdiff --git a/apps/desktop/resources/licenses/mingit.md b/apps/desktop/resources/licenses/mingit.mdnew file mode 100644index 0000000..209befb--- /dev/null+++ b/apps/desktop/resources/licenses/mingit.md@@ -0,0 +1,27 @@+# MinGit (Git for Windows), Windows builds only++The Windows installer of Pi Bot bundles MinGit, the minimal distribution of Git for Windows, so+that Git is available on computers that have none. Pi Bot runs it as a separate program and uses+it only when no Git is installed on the computer.++| Files | Version | License | Source |+|---|---|---|---|+| `resources/bin/git/` (MinGit-2.56.1-64-bit.zip on x64, MinGit-2.56.1-arm64.zip on arm64) | Git for Windows 2.56.1 (`v2.56.1.windows.1`) | GNU General Public License, version 2 (Git), plus the licenses of the bundled components | https://github.com/git-for-windows/git/releases/tag/v2.56.1.windows.1 |++MinGit is distributed unmodified, exactly as published in the release above (SHA-256+`4a92850b6e917da4fd010669b614b55dccf5b0ec333a534cc4be4700dfefdafd` for x64,+`96571e442e90523a90e5fd8661b4c4e43bc192910f3c6db938816e6955b4cc8c` for arm64).++The complete license texts, including the GNU General Public License version 2 and the licenses+of every component MinGit contains, are in `resources/bin/git/LICENSE.txt` of the installed+application.++Corresponding source code:++- Git for Windows: https://github.com/git-for-windows/git/tree/v2.56.1.windows.1 (source+ archives are attached to the release page above).+- The runtime packages MinGit is assembled from (MSYS2 / MINGW packages and their build recipes):+ https://github.com/git-for-windows/MINGW-packages, https://github.com/git-for-windows/MSYS2-packages+ and https://github.com/git-for-windows/build-extra (`mingit/`).++The GPL applies to MinGit only, not to the rest of Pi Bot, which runs it as a separate program.diff --git a/apps/desktop/scripts/package/prepare-mingit.mjs b/apps/desktop/scripts/package/prepare-mingit.mjsnew file mode 100644index 0000000..b72745d--- /dev/null+++ b/apps/desktop/scripts/package/prepare-mingit.mjs@@ -0,0 +1,89 @@+// Maintainers 2026-11-21: Windows builds ship MinGit, because most Windows computers have no Git+// and group parallel steps, the changes panel, commits and review all need it. System Git still+// wins at runtime (packages/execution/src/git/git-program.ts lists the bundled copy last).+//+// Official Git for Windows release, exact version, SHA-256 pinned here (the release notes' table+// and GitHub's asset digest agree) and checked before anything is unpacked. Shipped unmodified+// under GPLv2; the source link is in apps/desktop/resources/licenses/mingit.md.+import { execFile } from "node:child_process";+import { createHash } from "node:crypto";+import { access, cp, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { promisify } from "node:util";++export const MINGIT_VERSION = "2.56.1";+const RELEASE = "v2.56.1.windows.1";+const DIGESTS = {+ x64: [+ "MinGit-2.56.1-64-bit.zip",+ "4a92850b6e917da4fd010669b614b55dccf5b0ec333a534cc4be4700dfefdafd",+ ],+ arm64: [+ "MinGit-2.56.1-arm64.zip",+ "96571e442e90523a90e5fd8661b4c4e43bc192910f3c6db938816e6955b4cc8c",+ ],+};+const MAX_ARCHIVE = 100 * 1024 * 1024;+const run = promisify(execFile);++/**+ * Downloads (or reuses from .cache) and verifies MinGit for one Windows architecture, then+ * replaces `<binDirectory>/git` with the unpacked tree; `git/cmd/git.exe` is what runtime looks for.+ */+export async function prepareMinGit(desktop, arch, binDirectory) {+ const entry = DIGESTS[arch];+ if (!entry) throw new Error(`No pinned MinGit for win-${arch}`);+ const [name, expected] = entry;+ const cache = join(desktop, "../../.cache/pibot-mingit", RELEASE);+ await mkdir(cache, { recursive: true });+ const archive = join(cache, name);+ let bytes;+ let downloaded = false;+ try {+ bytes = await readFile(archive);+ } catch (error) {+ if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT"))+ throw error;+ const response = await fetch(+ `https://github.com/git-for-windows/git/releases/download/${RELEASE}/${name}`,+ { signal: AbortSignal.timeout(300_000) },+ );+ if (!response.ok) throw new Error(`MinGit download failed (${response.status})`);+ const buffer = Buffer.from(await response.arrayBuffer());+ if (buffer.byteLength > MAX_ARCHIVE) throw new Error("MinGit archive exceeds limit");+ bytes = buffer;+ downloaded = true;+ }+ const actual = createHash("sha256").update(bytes).digest("hex");+ if (actual !== expected) {+ await rm(archive, { force: true });+ throw new Error(`MinGit checksum mismatch for win-${arch}`);+ }+ if (downloaded) await writeFile(archive, bytes, { mode: 0o600 });+ const temporary = await mkdtemp(join(tmpdir(), "pibot-mingit-"));+ try {+ await run("unzip", ["-q", archive, "-d", temporary]);+ // The launcher and the licence must exist before the previous copy is replaced.+ await Promise.all([+ access(join(temporary, "cmd", "git.exe")),+ access(join(temporary, "LICENSE.txt")),+ ]);+ const target = join(binDirectory, "git");+ await rm(target, { recursive: true, force: true });+ await mkdir(binDirectory, { recursive: true });+ await cp(temporary, target, { recursive: true });+ console.info(+ JSON.stringify({+ event: "package.mingit",+ version: MINGIT_VERSION,+ release: RELEASE,+ target: `win-${arch}`,+ sha256: actual,+ }),+ );+ return join(target, "cmd", "git.exe");+ } finally {+ await rm(temporary, { recursive: true, force: true });+ }+}diff --git a/apps/desktop/scripts/package/prepare-resources.mjs b/apps/desktop/scripts/package/prepare-resources.mjsindex 1b166e8..061bd88 100644--- a/apps/desktop/scripts/package/prepare-resources.mjs+++ b/apps/desktop/scripts/package/prepare-resources.mjs@@ -2,6 +2,7 @@ import { chmod, copyFile, mkdir, readFile, realpath, writeFile } from "node:fs/pimport { createRequire } from "node:module";import { dirname, join } from "node:path";import { prepareCuaDaemon } from "./prepare-cua-daemon.mjs";+import { prepareMinGit } from "./prepare-mingit.mjs";import { prepareNodeHelper } from "./prepare-node-helper.mjs";/** @param {import("app-builder-lib").BeforePackContext} context */@@ -72,18 +73,16 @@ export default async function prepareM1Resources(context) {throw new Error(`Invalid parser WASM asset: ${target}`);}await prepareCodeMapGrammars(desktop, execRequire);- // Child Node workloads run on this helper, never on Pi Bot's executable.- await prepareNodeHelper(+ const binDirectory = join(desktop,- context.electronPlatformName,- arch,- join(- desktop,- "out/native-resources",- `${context.packager.platform.buildConfigurationKey}-${arch}`,- "bin",- ),+ "out/native-resources",+ `${context.packager.platform.buildConfigurationKey}-${arch}`,+ "bin",);+ // Child Node workloads run on this helper, never on Pi Bot's executable.+ await prepareNodeHelper(desktop, context.electronPlatformName, arch, binDirectory);+ // Only Windows bundles Git; macOS and Linux use the system's.+ if (context.electronPlatformName === "win32") await prepareMinGit(desktop, arch, binDirectory);}/**diff --git a/apps/desktop/scripts/package/verify-target-package.ts b/apps/desktop/scripts/package/verify-target-package.tsindex 0948fa7..74fce1a 100644--- a/apps/desktop/scripts/package/verify-target-package.ts+++ b/apps/desktop/scripts/package/verify-target-package.ts@@ -64,6 +64,12 @@ export async function verifyTargetPackage(}verifyTargetBinary(join(resources, "bin", win ? "rg.exe" : "rg"), platform, arch);verifyChildNode(resources, platform, arch);+ if (win) {+ // Bundled MinGit: runtime resolves bin/git/cmd/git.exe after any installed Git.+ verifyTargetBinary(join(resources, "bin", "git", "cmd", "git.exe"), platform, arch);+ assert(existsSync(join(resources, "bin", "git", "LICENSE.txt")), "Missing MinGit licence");+ assert(existsSync(join(resources, "licenses", "mingit.md")), "Missing MinGit notice");+ }verifyCodeMapGrammars(join(resources, "wasm", "codemap"));for (const name of ["web-tree-sitter.wasm", "tree-sitter-bash.wasm"])assert(diff --git a/packages/execution/src/git/git-config-process.ts b/packages/execution/src/git/git-config-process.tsindex 4cfad7d..6a73fd6 100644--- a/packages/execution/src/git/git-config-process.ts+++ b/packages/execution/src/git/git-config-process.ts@@ -9,12 +9,13 @@ import { gitPrograms } from "./git-program.ts";export interface GitConfigurationProcessOptions {platform: NodeJS.Platform;env: Readonly<NodeJS.ProcessEnv>;+ resourcesDir?: string;}export async function configurationGitProgram(requested: string,options: GitConfigurationProcessOptions,) {- const candidates = gitPrograms(options.platform, options.env).filter(+ const candidates = gitPrograms(options.platform, options.env, options.resourcesDir).filter((path) => requested === "git" || path === requested,);for (const path of candidates) {diff --git a/packages/execution/src/git/git-process.ts b/packages/execution/src/git/git-process.tsindex 03f4f0a..aafbfc8 100644--- a/packages/execution/src/git/git-process.ts+++ b/packages/execution/src/git/git-process.ts@@ -10,6 +10,8 @@ export interface GitProcessOptions {platform: NodeJS.Platform;env: Readonly<NodeJS.ProcessEnv>;userHome: string;+ /** Packaged app resources; on Windows the bundled MinGit there is the last Git candidate. */+ resourcesDir?: string;}export interface GitProcessResult {@@ -22,8 +24,10 @@ export interface GitProcessResult {durationMs: number;}-export async function findGit(options: Pick<GitProcessOptions, "platform" | "env">) {- for (const candidate of gitPrograms(options.platform, options.env)) {+export async function findGit(+ options: Pick<GitProcessOptions, "platform" | "env" | "resourcesDir">,+) {+ for (const candidate of gitPrograms(options.platform, options.env, options.resourcesDir)) {try {await access(candidate, options.platform === "win32" ? constants.F_OK : constants.X_OK);return candidate;diff --git a/packages/execution/src/git/git-program.ts b/packages/execution/src/git/git-program.tsindex 34e72ac..b987d11 100644--- a/packages/execution/src/git/git-program.ts+++ b/packages/execution/src/git/git-program.ts@@ -64,7 +64,11 @@ export function gitHardening(platform: NodeJS.Platform, program: string) {* Fixed install locations only; PATH lookup could pick a Bot-planted `git`. On macOS the* /usr/bin/git shim is avoided because it opens the developer-tools installer when tools are absent.*/-export function gitPrograms(platform: NodeJS.Platform, env: Readonly<NodeJS.ProcessEnv>) {+export function gitPrograms(+ platform: NodeJS.Platform,+ env: Readonly<NodeJS.ProcessEnv>,+ resourcesDir?: string,+) {if (platform === "darwin")return ["/opt/homebrew/bin/git",@@ -82,6 +86,14 @@ export function gitPrograms(platform: NodeJS.Platform, env: Readonly<NodeJS.Procvalue("LOCALAPPDATA") && win32.isAbsolute(value("LOCALAPPDATA") as string)? [win32.join(value("LOCALAPPDATA") as string, "Programs", "Git", "cmd", "git.exe")]: [],+ )+ .concat(+ // Packaged Windows builds ship MinGit (most Windows computers have no Git). It is last so+ // the user's own Git, with their credential manager and LFS, wins. It lives inside Pi Bot's+ // own install, so whoever could replace it could replace Pi Bot. Dev runs have none.+ resourcesDir && win32.isAbsolute(resourcesDir) && !/[\0\r\n]/.test(resourcesDir)+ ? [win32.join(resourcesDir, "bin", "git", "cmd", "git.exe")]+ : [],);}return ["/usr/bin/git", "/usr/local/bin/git", "/bin/git"];diff --git a/packages/execution/src/managed/managed-folder.ts b/packages/execution/src/managed/managed-folder.tsindex 2f52c36..b560d03 100644--- a/packages/execution/src/managed/managed-folder.ts+++ b/packages/execution/src/managed/managed-folder.ts@@ -147,13 +147,16 @@ function inside(root: string, relativePath: string) {return absolute;}-export function createManagedFolders(options: Pick<ExecOptions, "platform" | "env" | "tempDir">) {+export function createManagedFolders(+ options: Pick<ExecOptions, "platform" | "env" | "tempDir" | "resourcesDir">,+) {// An empty HOME: the user's global Git config (filters, hooks, signing) never applies here.const home = join(options.tempDir, "managed-folder-home");const processOptions: GitProcessOptions = {platform: options.platform,env: options.env,userHome: home,+ resourcesDir: options.resourcesDir,};async function git(repository: string, args: string[], signal: AbortSignal) {const program = await findGit(processOptions);diff --git a/packages/execution/src/managed/managed-git.ts b/packages/execution/src/managed/managed-git.tsindex 246dc8b..7423183 100644--- a/packages/execution/src/managed/managed-git.ts+++ b/packages/execution/src/managed/managed-git.ts@@ -88,6 +88,7 @@ export function createManagedGit(options: ExecOptions) {platform: options.platform,env: options.env,userHome: options.systemHome,+ resourcesDir: options.resourcesDir,};const reader = createGitReader(processOptions);const live = new Set<import("node:child_process").ChildProcess>();diff --git a/packages/runner/src/managed-git-port.ts b/packages/runner/src/managed-git-port.tsindex b1bac9d..b8c0378 100644--- a/packages/runner/src/managed-git-port.ts+++ b/packages/runner/src/managed-git-port.ts@@ -71,6 +71,7 @@ export function createManagedGitPort(platform: options.platform,env: options.env,userHome: options.systemHome,+ resourcesDir: options.resourcesDir,});const sourceRoot = (binding: Binding) => {const root = binding.source?.root.canonicalPath;diff --git a/packages/workspaces/src/brain/changes/changes-service.ts b/packages/workspaces/src/brain/changes/changes-service.tsindex 888a0a8..522ca6b 100644--- a/packages/workspaces/src/brain/changes/changes-service.ts+++ b/packages/workspaces/src/brain/changes/changes-service.ts@@ -88,6 +88,7 @@ export class ChangesService {platform: local.deps.platform,env: local.deps.env,userHome: local.deps.userHome,+ resourcesDir: local.deps.resourcesDir,});this.turn = new RunChanges({db: local.deps.db,diff --git a/packages/workspaces/src/brain/changes/write/changes-write-run.ts b/packages/workspaces/src/brain/changes/write/changes-write-run.tsindex c94adc1..b8faf69 100644--- a/packages/workspaces/src/brain/changes/write/changes-write-run.ts+++ b/packages/workspaces/src/brain/changes/write/changes-write-run.ts@@ -49,7 +49,12 @@ async function run(// Windows only, and only from the user's changes.discard / changes.commit clicks.if (mode === "direct")return runGitWriteDirect(- { platform: deps.platform, env: deps.env, userHome: deps.userHome },+ {+ platform: deps.platform,+ env: deps.env,+ userHome: deps.userHome,+ resourcesDir: deps.resourcesDir,+ },{ cwd: root, operations, signal, timeoutMs: 120_000, assertAuthorized },);const runId = randomUUID();diff --git a/packages/workspaces/src/brain/groups/group-member-worktrees.ts b/packages/workspaces/src/brain/groups/group-member-worktrees.tsindex 87e8095..366444c 100644--- a/packages/workspaces/src/brain/groups/group-member-worktrees.ts+++ b/packages/workspaces/src/brain/groups/group-member-worktrees.ts@@ -73,6 +73,7 @@ export class GroupMemberWorktrees {platform: local.deps.platform,env: local.deps.env,userHome: local.deps.userHome,+ resourcesDir: local.deps.resourcesDir,});this.git = createManagedGit({platform: local.deps.platform,@@ -87,6 +88,7 @@ export class GroupMemberWorktrees {platform: local.deps.platform,env: local.deps.env,tempDir: local.deps.tempDir,+ resourcesDir: local.deps.resourcesDir,});this.localHost = localWorktreeHost(local, this.git, this.reader);this.timer = setInterval(() => {diff --git a/packages/workspaces/src/brain/groups/group-worktree-commit.ts b/packages/workspaces/src/brain/groups/group-worktree-commit.tsindex 1954ee3..abcf5a3 100644--- a/packages/workspaces/src/brain/groups/group-worktree-commit.ts+++ b/packages/workspaces/src/brain/groups/group-worktree-commit.ts@@ -36,6 +36,7 @@ export async function commitGroupWorktree(platform: local.deps.platform,env: local.deps.env,userHome: local.deps.userHome,+ resourcesDir: local.deps.resourcesDir,});// The fixed recipe reads these files inside its sandbox, which reads the Bot home but not the// system temp folder (the same place changes-write keeps its pathspec and message files).