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.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
Lock OrkasOpen to global prod services
wytffb361cbbf9a
diff --git a/run.cmd b/run.cmdindex 6b18d60e..2001d969 100644--- a/run.cmd+++ b/run.cmd@@ -10,13 +10,7 @@ if not exist "%APP_DIR%\package.json" (exit /b 1)-REM Priority: positional %1 > ORKAS_PROFILE env > default global.-if not "%~1"=="" (- set "ORKAS_PROFILE=%~1"-) else if "%ORKAS_PROFILE%"=="" (- set "ORKAS_PROFILE=global"-)-echo [Orkas] 启动 profile=%ORKAS_PROFILE%+echo [Orkas] 启动 OrkasOpen (global prod)call node "%APP_DIR%\scripts\ensure-deps.cjs"if errorlevel 1 exit /b 1diff --git a/run.sh b/run.shindex 861b83d3..386a97a7 100755--- a/run.sh+++ b/run.sh@@ -2,14 +2,10 @@# Orkas PC launcher. Lives under PC/; the script's own directory is the PC root.# Behavior: kills any prior instance, then starts a new one in the foreground.#-# Usage (matches Server `env/start/{dev_,}api_start.sh` profile mode; see Server CLAUDE.md §7):-# ./run.sh # profile=global (default, overseas orkas.ai)-# ./run.sh cn # profile=cn (CN orkas.work)-# ORKAS_PROFILE=global ./run.sh # env style remains supported-# Profile is passed to the main process through ORKAS_PROFILE and read by-# features/marketplace.ts::apiBase() and related resolvers. Local dev can still-# point to a custom server explicitly:-# ORKAS_API_BASE_URL=http://localhost:8888/api ./run.sh.+# Usage:+# ./run.sh+#+# OrkasOpen has exactly one server environment: global prod.set -eAPP_DIR="$(cd "$(dirname "$0")" && pwd)"@@ -41,9 +37,7 @@ EOFexit 1fi-# Priority: positional $1 > ORKAS_PROFILE env > default global-export ORKAS_PROFILE="${1:-${ORKAS_PROFILE:-global}}"-echo "[Orkas] Starting profile=$ORKAS_PROFILE"+echo "[Orkas] Starting OrkasOpen (global prod)"node "$APP_DIR/scripts/ensure-deps.cjs"@@ -54,13 +48,7 @@ sleep 0.3if [ "$(uname -s)" = "Darwin" ]; thenAPP_BUNDLE="$APP_DIR/node_modules/electron/dist/Orkas.app"if [ -d "$APP_BUNDLE" ]; then- ARGS=("$APP_DIR" "--orkas-profile=$ORKAS_PROFILE")- if [ -n "${ORKAS_API_BASE_URL:-}" ]; then- ARGS+=("--orkas-api-base-url=$ORKAS_API_BASE_URL")- fi- if [ -n "${ORKAS_VOICE_API_BASE:-}" ]; then- ARGS+=("--orkas-voice-api-base=$ORKAS_VOICE_API_BASE")- fi+ ARGS=("$APP_DIR")# Launch through LaunchServices so macOS routes orkas:// open-url events to this dev app# instance. Directly executing `Electron .` leaves the app running, but protocol callbacks# may be delivered to the .app bundle instead of the command-line process.diff --git a/src/main/features/client_config.ts b/src/main/features/client_config.tsindex b10a460a..07f0c2e0 100644--- a/src/main/features/client_config.ts+++ b/src/main/features/client_config.ts@@ -50,7 +50,6 @@ type ElectronPowerMonitorLike = {const log = createLogger('client-config');const REFRESH_INTERVAL_MS = 4 * 60 * 60 * 1000;const PROD_DEFAULT = 'https://orkas.ai/api';-const DEV_DEFAULT = 'http://127.0.0.1:8888/api';let started = false;let inFlight: Promise<ConfigRefreshResult> | null = null;@@ -363,40 +362,18 @@ export class ClientConfigManager {export const clientConfig = new ClientConfigManager();-export type ClientConfigChannel = 'prod' | 'dev' | 'open';+export type ClientConfigChannel = 'open';-function normalizeChannel(raw: string | undefined): ClientConfigChannel | null {- const v = String(raw || '').trim().toLowerCase();- if (v === 'prod' || v === 'dev' || v === 'open') return v;- return null;-}--function isOpenSourcePackage(app: ElectronAppLike): boolean {- try {- const appPath = typeof app.getAppPath === 'function' ? app.getAppPath() : '';- if (!appPath) return false;- const pkg = JSON.parse(fs.readFileSync(path.join(appPath, 'package.json'), 'utf8')) as Record<string, unknown>;- return String(pkg.license || '').trim().toUpperCase() === 'MIT';- } catch {- return false;- }-}--function channel(app: ElectronAppLike): ClientConfigChannel {- const envChannel = normalizeChannel(process.env.ORKAS_CLIENT_CHANNEL || process.env.ORKAS_CHANNEL);- if (envChannel) return envChannel;- if (isOpenSourcePackage(app)) return 'open';- return app.isPackaged ? 'prod' : 'dev';+function channel(_app: ElectronAppLike): ClientConfigChannel {+ return 'open';}function region(): string {- return (process.env.ORKAS_PROFILE || 'global').trim() || 'global';+ return 'global';}-function apiBase(app: ElectronAppLike): string {- const env = process.env.ORKAS_ACCOUNT_API_BASE || process.env.ORKAS_API_BASE_URL;- if (env) return env.replace(/\/+$/, '');- return app.isPackaged ? PROD_DEFAULT : DEV_DEFAULT;+function apiBase(_app: ElectronAppLike): string {+ return PROD_DEFAULT;}function buildUrl(app: ElectronAppLike): string {diff --git a/src/main/features/connectors/_server_bridge.ts b/src/main/features/connectors/_server_bridge.tsindex 09d0b2b9..0d91ac63 100644--- a/src/main/features/connectors/_server_bridge.ts+++ b/src/main/features/connectors/_server_bridge.ts@@ -2,7 +2,7 @@* Server-bridge stubs for connector OAuth in the OrkasOpen build.** PC's `features/connectors/oauth*.ts` reaches into `features/account/{server,token_store}` for:- * - `accountApiBase()` — the Orkas Server base URL (region-routed)+ * - `accountApiBase()` — the Orkas global prod Server base URL* - `tokenStore.getDeviceId()` — stable per-machine UUID* - `tokenStore.authHeaders()` — `{user_id, session_id}` for the logged-in user*@@ -13,7 +13,7 @@* session in OrkasOpen — but exposing the same signature keeps the call sites identical.** Where each piece comes from:- * - `accountApiBase` aliases `features/marketplace.apiBase()` (same resolver — single+ * - `accountApiBase` aliases `features/marketplace.apiBase()` (global prod only — single* source of truth across all Server-bridged features in this build).* - `getDeviceId()` persists a UUID at `<uid>/local/config/device.json` on first call. Stable* across runs on the same machine; resets if the user wipes the local config dir.diff --git a/src/main/features/connectors/oauth-dcr.ts b/src/main/features/connectors/oauth-dcr.tsindex 06aecee3..3440bb42 100644--- a/src/main/features/connectors/oauth-dcr.ts+++ b/src/main/features/connectors/oauth-dcr.ts@@ -200,13 +200,8 @@ export async function startMcpDcrOAuth(resource,});- // Register client. The redirect_uri must point at our Server's `/connectors/oauth/dcr-callback`- // endpoint, which is environment-dependent (`accountApiBase()` resolves to the dev or prod- // Server URL per `OAUTH_REDIRECT_BASE` / debug-mode rules). DCR registers whichever URL we- // declare with the provider, so dev (localhost) and prod (orkas.ai) just work side-by-side- // — each ConnectorInstance carries its own dcr_client tied to whichever env it was installed- // under. (A dev-mode install does NOT migrate to prod automatically; the user would- // reconnect.)+ // Register client. OrkasOpen has exactly one redirect base: global prod. Each+ // ConnectorInstance carries its own dcr_client for that Server-side callback.const redirectUri = `${accountApiBase().replace(/\/+$/, '')}/connectors/oauth/dcr-callback`;const registered = await _registerClient(meta.registration_endpoint, redirectUri);log.info('DCR registration done', { client_id_tail: registered.client_id.slice(-6) });diff --git a/src/main/features/marketplace.ts b/src/main/features/marketplace.tsindex 2216eaa0..81bcdd0d 100644--- a/src/main/features/marketplace.ts+++ b/src/main/features/marketplace.ts@@ -74,22 +74,12 @@ import { persistReport as persistQualityReport } from '../quality/report';const log = createLogger('marketplace');// ── server URL ────────────────────────────────────────────────────────────-// Profile-driven (mirrors Server `env/start/{dev_,}api_start.sh` — see PC/CLAUDE.md §1 +-// Server CLAUDE.md §7): `ORKAS_PROFILE=global` (default) routes to overseas prod-// (`orkas.ai`), `ORKAS_PROFILE=cn` routes to China prod (`orkas.work`). Use the apex-// hosts directly so POST marketplace calls do not first hit a www -> apex 301 redirect.-// `run.sh` exports the env from its positional arg (`./run.sh cn`). An explicit-// `ORKAS_API_BASE_URL` always wins for local debugging, but OrkasOpen never auto-pins-// source-run builds to a dev Server.-const PROFILE_BASES: Record<string, string> = {- global: 'https://orkas.ai/api',- cn: 'https://orkas.work/api',-};+// OrkasOpen has exactly one server environment: global prod. Use the apex host directly+// so POST marketplace calls do not first hit a www -> apex 301 redirect.+const GLOBAL_PROD_API_BASE = 'https://orkas.ai/api';export function apiBase(): string {- if (process.env.ORKAS_API_BASE_URL) return process.env.ORKAS_API_BASE_URL.replace(/\/+$/, '');- const profile = process.env.ORKAS_PROFILE || 'global';- return PROFILE_BASES[profile] || PROFILE_BASES.global;+ return GLOBAL_PROD_API_BASE;}// ── envelope ──────────────────────────────────────────────────────────────diff --git a/src/main/index.ts b/src/main/index.tsindex 4db27082..910da312 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -48,9 +48,7 @@ import './install-data-root.cjs';// edge case where productName isn't picked up early.app.setName('Orkas');-// OrkasOpen uses the same public prod API defaults in source-run and packaged builds.-// Keep `ORKAS_API_BASE_URL` as an explicit override only; otherwise marketplace resolves-// by `ORKAS_PROFILE` (global -> orkas.ai, cn -> orkas.work) inside features/marketplace.ts.+// OrkasOpen has exactly one server environment: global prod.// Register the KB file protocol BEFORE `app.whenReady()` — privileged// schemes can't be added after. `kb-file:///<relpath>` serves a singlediff --git a/test/main/features/client_config.test.ts b/test/main/features/client_config.test.tsindex 4b7b90af..a2f4c6c9 100644--- a/test/main/features/client_config.test.ts+++ b/test/main/features/client_config.test.ts@@ -33,22 +33,12 @@ describe('client_config', () => {electronMock.app.off.mockClear();electronMock.powerMonitor.on.mockClear();electronMock.powerMonitor.off.mockClear();- delete process.env.ORKAS_ACCOUNT_API_BASE;- delete process.env.ORKAS_API_BASE_URL;- delete process.env.ORKAS_PROFILE;- delete process.env.ORKAS_CLIENT_CHANNEL;- delete process.env.ORKAS_CHANNEL;});afterEach(() => {stop();vi.unstubAllGlobals();vi.restoreAllMocks();- delete process.env.ORKAS_ACCOUNT_API_BASE;- delete process.env.ORKAS_API_BASE_URL;- delete process.env.ORKAS_PROFILE;- delete process.env.ORKAS_CLIENT_CHANNEL;- delete process.env.ORKAS_CHANNEL;});it('returns registered local defaults before any Server config is available', () => {@@ -211,7 +201,6 @@ describe('client_config', () => {const now = 1_234_567;vi.spyOn(Date, 'now').mockReturnValue(now);- process.env.ORKAS_API_BASE_URL = 'https://config.example/api/';let requestedUrl = '';let requestedInit: RequestInit | undefined;vi.stubGlobal('fetch', async (input: string | URL | Request, init?: RequestInit) => {@@ -233,10 +222,10 @@ describe('client_config', () => {expect(result).toEqual({ updated: true });const url = new URL(requestedUrl);- expect(url.origin + url.pathname).toBe('https://config.example/api/config/client');+ expect(url.origin + url.pathname).toBe('https://orkas.ai/api/config/client');expect(url.searchParams.get('platform')).toBe('pc');expect(url.searchParams.get('version')).toBe('9.8.7');- expect(url.searchParams.get('channel')).toBe('dev');+ expect(url.searchParams.get('channel')).toBe('open');expect(url.searchParams.get('region')).toBe('global');expect(url.searchParams.get('os')).toBe(process.platform);expect(url.searchParams.get('arch')).toBe(process.arch);@@ -255,17 +244,13 @@ describe('client_config', () => {}});- it('uses the open channel when the open-source package marker is present', async () => {+ it('uses the open channel for OrkasOpen config requests', async () => {const users = await import('../../../src/main/features/users');const paths = await import('../../../src/main/paths');const uid = 'clientconfigopenchannel';users.activateUser(uid);const file = paths.userRemoteConfigFile(uid);fs.mkdirSync(path.dirname(file), { recursive: true });- const appDir = fs.mkdtempSync(path.join(path.dirname(file), 'open-app-'));- fs.writeFileSync(path.join(appDir, 'package.json'), JSON.stringify({ license: 'MIT' }), 'utf8');- (electronMock.app as any).getAppPath = vi.fn(() => appDir);-let requestedUrl = '';vi.stubGlobal('fetch', async (input: string | URL | Request) => {requestedUrl = String(input);diff --git a/test/main/features/connectors/oauth-github-server-managed.test.ts b/test/main/features/connectors/oauth-github-server-managed.test.tsindex bd090779..c27d783a 100644--- a/test/main/features/connectors/oauth-github-server-managed.test.ts+++ b/test/main/features/connectors/oauth-github-server-managed.test.ts@@ -26,22 +26,18 @@ vi.mock('../../../../src/main/features/config', () => ({let tmpDir: string;let prevWs: string | undefined;-let prevApi: string | undefined;beforeEach(() => {vi.clearAllMocks();tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-github-oauth-'));prevWs = process.env.ORKAS_WORKSPACE_ROOT;- prevApi = process.env.ORKAS_API_BASE_URL;process.env.ORKAS_WORKSPACE_ROOT = tmpDir;- process.env.ORKAS_API_BASE_URL = 'http://account.example/api';vi.resetModules();});afterEach(() => {vi.unstubAllGlobals();process.env.ORKAS_WORKSPACE_ROOT = prevWs;- process.env.ORKAS_API_BASE_URL = prevApi;fs.rmSync(tmpDir, { recursive: true, force: true });});