Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
fix(console): use Windows' own tar to unpack the local-server toolchain (#917)
Louis Amaudruzc4c366a653ff
diff --git a/console/apps/switch-console-desktop/scripts/build-local-server-bundle.mjs b/console/apps/switch-console-desktop/scripts/build-local-server-bundle.mjsindex 5a1c81749..b0de3f3b6 100644--- a/console/apps/switch-console-desktop/scripts/build-local-server-bundle.mjs+++ b/console/apps/switch-console-desktop/scripts/build-local-server-bundle.mjs@@ -106,8 +106,18 @@ async function download(url, file, integrity) {}}+// On Windows, the system bsdtar: the runner's PATH puts Git's GNU tar first,+// which reads `C:\…` as a remote host and cannot open zip.+const tarCommand = (() => {+ if (process.platform !== 'win32') return 'tar';+ if (!process.env.SystemRoot) throw new Error("SystemRoot is unset; cannot find Windows' tar.exe");+ const systemTar = path.win32.join(process.env.SystemRoot, 'System32', 'tar.exe');+ if (!existsSync(systemTar)) throw new Error(`Windows' tar.exe was not found at ${systemTar}`);+ return systemTar;+})();+function tar(args) {- execFileSync('tar', args, { stdio: 'inherit' });+ execFileSync(tarCommand, args, { stdio: 'inherit' });}async function unpackPinned(archive, destination) {diff --git a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/native/download.ts b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/native/download.tsindex d6181f33e..6833154ab 100644--- a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/native/download.ts+++ b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/native/download.ts@@ -1,6 +1,6 @@import { execFile } from 'node:child_process';import { createHash } from 'node:crypto';-import { createWriteStream } from 'node:fs';+import { createWriteStream, existsSync } from 'node:fs';import { mkdir, rename, rm } from 'node:fs/promises';import path from 'node:path';import { Readable } from 'node:stream';@@ -75,17 +75,21 @@ export async function downloadFile(/*** The `tar` this machine has. Every platform Console ships on carries one:* bsdtar on macOS and on Windows 10 and later (which also reads zip), GNU tar- * on Linux.+ * on Linux. On Windows it is always the system bsdtar, never a `tar` found+ * earlier on PATH: that is usually Git's GNU tar, which reads `C:\…` as a+ * remote host and cannot open zip.*/export function tarExecutable(env: NodeJS.ProcessEnv = process.env): string {- return resolveExecutable('tar', {- candidates: [- '/usr/bin/tar',- '/bin/tar',- windowsInstallPath(env, 'SystemRoot', 'System32', 'tar.exe') ?? '',- ].filter(Boolean),- env,- });+ if (process.platform === 'win32') {+ const systemTar = windowsInstallPath(env, 'SystemRoot', 'System32', 'tar.exe');+ if (!systemTar || !existsSync(systemTar)) {+ throw new Error(+ `Windows' tar.exe was not found${systemTar ? ` at ${systemTar}` : ' (SystemRoot is unset)'}; it ships with Windows 10 and later.`+ );+ }+ return systemTar;+ }+ return resolveExecutable('tar', { candidates: ['/usr/bin/tar', '/bin/tar'], env });}/**