Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

Normalize desktop platform reporting

wyt153477e77a01
diff --git a/src/main/features/client_config.ts b/src/main/features/client_config.ts
index de2b2837..00718ca4 100644
--- a/src/main/features/client_config.ts
+++ b/src/main/features/client_config.ts
@@ -12,6 +12,7 @@ import { readJsonSync, writeJsonSync } from '../storage';
import { createLogger } from '../logger';
import { getCurrentDevice } from '../util/device';
import { fetchWithRetry } from '../util/retry';
+import { desktopPlatform } from '../system_info';
export type ClientConfigEffect = 'immediate' | 'restart';
@@ -375,6 +376,10 @@ function region(): string {
return 'global';
}
+export function clientConfigPlatform(platform = process.platform): string {
+ return desktopPlatform(platform);
+}
+
function apiBase(_app: ElectronAppLike): string {
return PROD_DEFAULT;
}
@@ -382,7 +387,7 @@ function apiBase(_app: ElectronAppLike): string {
function buildUrl(app: ElectronAppLike): string {
const url = new URL(`${apiBase(app)}/config/client`);
const device = getCurrentDevice();
- url.searchParams.set('platform', 'pc');
+ url.searchParams.set('platform', clientConfigPlatform());
url.searchParams.set('version', app.getVersion());
url.searchParams.set('channel', channel(app));
url.searchParams.set('region', region());
diff --git a/src/main/index.ts b/src/main/index.ts
index 2d1eb8d9..54278cd1 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -39,6 +39,7 @@ import { app, BrowserWindow, Menu, ipcMain, nativeImage, net, protocol, session,
// rather than in index.ts body (esbuild CJS hoists imports → body runs
// after paths.ts loads, which is too late to set the env var).
import './install-data-root.cjs';
+import { desktopPlatform, osVersion } from './system_info';
const APP_USER_MODEL_ID = 'com.orkas.desktop';
@@ -239,12 +240,15 @@ function registerIpc(): void {
});
ipcMain.handle('orkas.env', () => {
+ const systemVersion = osVersion();
+ const platform = desktopPlatform();
return {
ok: true,
isDev: !app.isPackaged,
isPackaged: app.isPackaged,
version: app.getVersion(),
- platform: process.platform,
+ platform,
+ osVersion: systemVersion,
arch: process.arch,
};
});
diff --git a/src/main/system_info.ts b/src/main/system_info.ts
new file mode 100644
index 00000000..c3bab676
--- /dev/null
+++ b/src/main/system_info.ts
@@ -0,0 +1,25 @@
+import * as os from 'node:os';
+
+type ElectronProcess = NodeJS.Process & { getSystemVersion?: () => string };
+
+export type DesktopPlatform = 'mac' | 'windows' | 'pc';
+
+export function osVersion(): string {
+ try {
+ const getSystemVersion = (process as ElectronProcess).getSystemVersion;
+ if (typeof getSystemVersion === 'function') {
+ const version = getSystemVersion.call(process);
+ if (version) return String(version);
+ }
+ } catch {
+ /* fallback below */
+ }
+ return os.release();
+}
+
+export function desktopPlatform(platform: string = process.platform): DesktopPlatform {
+ const raw = String(platform || '').trim().toLowerCase();
+ if (raw === 'darwin' || raw === 'mac' || raw === 'macos') return 'mac';
+ if (raw === 'win32' || raw === 'win64' || raw === 'windows' || raw === 'win') return 'windows';
+ return 'pc';
+}
diff --git a/test/main/features/client_config.test.ts b/test/main/features/client_config.test.ts
index 4085e14a..51141028 100644
--- a/test/main/features/client_config.test.ts
+++ b/test/main/features/client_config.test.ts
@@ -20,7 +20,14 @@ vi.mock('electron', () => ({
powerMonitor: electronMock.powerMonitor,
}));
-import { ClientConfigManager, getMinimumAppVersion, refresh, start, stop } from '../../../src/main/features/client_config';
+import {
+ ClientConfigManager,
+ clientConfigPlatform,
+ getMinimumAppVersion,
+ refresh,
+ start,
+ stop,
+} from '../../../src/main/features/client_config';
const FOUR_HOURS_MS = 4 * 60 * 60 * 1000;
@@ -64,6 +71,12 @@ describe('client_config', () => {
expect(manager.get('feature.local-default')).toBe(true);
});
+ it('maps desktop OS names to client config platform buckets', () => {
+ expect(clientConfigPlatform('darwin')).toBe('mac');
+ expect(clientConfigPlatform('win32')).toBe('windows');
+ expect(clientConfigPlatform('linux')).toBe('pc');
+ });
+
it('lets Server immediate config override registered defaults', async () => {
const users = await import('../../../src/main/features/users');
const paths = await import('../../../src/main/paths');
@@ -300,7 +313,7 @@ describe('client_config', () => {
const url = new URL(requestedUrl);
expect(url.origin + url.pathname).toBe('https://config.example/api/config/client');
- expect(url.searchParams.get('platform')).toBe('pc');
+ expect(url.searchParams.get('platform')).toBe(clientConfigPlatform());
expect(url.searchParams.get('version')).toBe('9.8.7');
expect(url.searchParams.get('channel')).toBe('dev');
expect(url.searchParams.get('region')).toBe('global');
diff --git a/test/main/features/system_info.test.ts b/test/main/features/system_info.test.ts
new file mode 100644
index 00000000..8fa51442
--- /dev/null
+++ b/test/main/features/system_info.test.ts
@@ -0,0 +1,13 @@
+import { describe, expect, it } from 'vitest';
+
+import { desktopPlatform } from '../../../src/main/system_info';
+
+describe('main/system_info > desktopPlatform', () => {
+ it('normalizes desktop platform keys', () => {
+ expect(desktopPlatform('darwin')).toBe('mac');
+ expect(desktopPlatform('MacOS')).toBe('mac');
+ expect(desktopPlatform('win32')).toBe('windows');
+ expect(desktopPlatform('WIN')).toBe('windows');
+ expect(desktopPlatform('linux')).toBe('pc');
+ });
+});