Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.
TypeScript
fix(byoa): restore Windows engine version detection (#117)
LILACb2a972f95670
diff --git a/server/src/__tests__/agents-computer-engine-version.test.ts b/server/src/__tests__/agents-computer-engine-version.test.tsindex 31e8160..61f1e93 100644--- a/server/src/__tests__/agents-computer-engine-version.test.ts+++ b/server/src/__tests__/agents-computer-engine-version.test.ts@@ -10,13 +10,16 @@*/import { test } from 'node:test'import assert from 'node:assert/strict'+import { mkdtemp, rm, writeFile } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { join } from 'node:path'process.env.CUMORA_RUNTIME_CLIENT = 'http'process.env.OPENAI_API_KEY ??= 'test-key'const {parseCliVersion, isCliOutdated, inferUpdateCommand,- parseCursorAbout, parseGrokCheck, ENGINE_VERSION_SPECS,+ parseCursorAbout, parseGrokCheck, ENGINE_VERSION_SPECS, versionCommandInvocation,} = await import('../agents/computer/cli-version.js')const { sanitizeDetectedEngines } = await import('../agents/computer/registry.js')@@ -32,6 +35,23 @@ test('parseCliVersion reads the shapes real CLIs print', () => {assert.equal(parseCliVersion(null), null)})+test('Windows version probe replaces an extensionless npm shim with its runnable .cmd sibling', async () => {+ const root = await mkdtemp(join(tmpdir(), 'cumora-engine-version-'))+ try {+ const shim = join(root, 'codex')+ await writeFile(shim, '#!/bin/sh\n')+ await writeFile(`${shim}.cmd`, '@echo off\r\necho codex-cli 0.15.1\r\n')+ const comspec = String.raw`C:\Windows\System32\cmd.exe`+ assert.deepEqual(versionCommandInvocation(shim, ['--version'], 'win32', comspec), {+ command: comspec,+ args: ['/d', '/s', '/c', `""${shim}.cmd" --version"`],+ windowsVerbatimArguments: true,+ })+ } finally {+ await rm(root, { recursive: true, force: true })+ }+})+test('isCliOutdated only fires when upstream is strictly newer', () => {assert.equal(isCliOutdated('1.2.3', '1.2.4'), true)assert.equal(isCliOutdated('1.2.3', '1.3.0'), true)diff --git a/server/src/agents/computer/cli-version.ts b/server/src/agents/computer/cli-version.tsindex 9d1e76a..5936019 100644--- a/server/src/agents/computer/cli-version.ts+++ b/server/src/agents/computer/cli-version.ts@@ -14,6 +14,46 @@import { spawn } from 'node:child_process'import fs from 'node:fs'+interface CommandInvocation {+ command: string+ args: string[]+ windowsVerbatimArguments?: boolean+}++/** npm on Windows installs an extensionless POSIX shim before the runnable+ * `.cmd` shim in `where` output. CreateProcess cannot execute either file+ * directly, so select the sibling batch shim and invoke it through ComSpec. */+export function versionCommandInvocation(+ command: string,+ args: string[],+ platform = process.platform,+ comspec = process.env.ComSpec || 'cmd.exe',+): CommandInvocation {+ if (platform !== 'win32') return { command, args }++ let runnable = command+ if (!/\.(?:cmd|bat|com|exe)$/i.test(runnable)) {+ for (const ext of ['.cmd', '.bat', '.exe', '.com']) {+ if (fs.existsSync(`${command}${ext}`)) {+ runnable = `${command}${ext}`+ break+ }+ }+ }+ if (!/\.(?:cmd|bat)$/i.test(runnable)) return { command: runnable, args }++ const commandArgs = args.map((arg) => {+ const value = String(arg)+ return /^[\w./:=+-]+$/u.test(value) ? value : `"${value.replace(/"/g, '""')}"`+ })+ const commandLine = `""${runnable}"${commandArgs.length ? ` ${commandArgs.join(' ')}` : ''}"`+ return {+ command: comspec,+ args: ['/d', '/s', '/c', commandLine],+ windowsVerbatimArguments: true,+ }+}+/** How to ask an engine its version, and how to find out what the newest one is. */export interface EngineVersionSpec {/** Args that make the binary print its version (`--version` for all but hermes). */@@ -176,7 +216,12 @@ function spawnText(cmd: string, args: string[], timeoutMs: number): Promise<strilet settled = falselet child: ReturnType<typeof spawn>try {- child = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'] })+ const invocation = versionCommandInvocation(cmd, args)+ child = spawn(invocation.command, invocation.args, {+ stdio: ['ignore', 'pipe', 'pipe'],+ windowsHide: true,+ windowsVerbatimArguments: invocation.windowsVerbatimArguments === true,+ })} catch {resolve('')return