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
fix(connectors): use local dev server in source runs
wyt01bea513cb14
diff --git a/src/main/features/connectors/_server_bridge.ts b/src/main/features/connectors/_server_bridge.tsindex cd1c80a5..3485a790 100644--- a/src/main/features/connectors/_server_bridge.ts+++ b/src/main/features/connectors/_server_bridge.ts@@ -2,31 +2,33 @@* Server-bridge stubs for connector OAuth in the open-source build.** PC's `features/connectors/oauth*.ts` reaches into `features/account/{server,token_store}` for:- * - `accountApiBase()` — the Orkas global prod Server base URL+ * - `accountApiBase()` — the connector Server base URL* - `tokenStore.getDeviceId()` — stable per-machine UUID* - `tokenStore.authHeaders()` — `{user_id, session_id}` for the logged-in PC user** `features/account/` is stripped from the public build (no account backend). Connectors still- * need the first two pieces for the pinned global HTTPS callback/bridge. Server-bridge exchange+ * need the first two pieces for their callback/bridge. Server-bridge exchange* and refresh accept `channel=open` plus this stable device id; the third piece is always empty* because this build never has an Orkas account session. Paid connector routes add the user's* separately stored Orkas API Key in their own connector modules.** Where each piece comes from:- * - `accountApiBase` aliases `features/marketplace.apiBase()` (global prod only — single- * source of truth across all Server-bridged features in this build).+ * - `accountApiBase` uses the local dev Server for source runs and the global production+ * Server for packaged builds. Marketplace routing is independent.* - `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.*/import * as fs from 'node:fs';import * as path from 'node:path';import * as crypto from 'node:crypto';+import { app } from 'electron';import { userLocalConfigDir } from '../../paths';import { getActiveUserId } from '../users';import { apiBase } from '../marketplace';export function accountApiBase(): string {+ if (app?.isPackaged === false) return 'http://localhost:8888/api';return apiBase();}diff --git a/src/main/features/connectors/oauth-dcr.ts b/src/main/features/connectors/oauth-dcr.tsindex 275ef7f2..b6a6d44b 100644--- a/src/main/features/connectors/oauth-dcr.ts+++ b/src/main/features/connectors/oauth-dcr.ts@@ -280,9 +280,8 @@ export async function startMcpDcrOAuth(token_auth: tokenEndpointAuthMethod,});- // The public build has one Server environment. `accountApiBase()` is pinned to the global- // production HTTPS base by `_server_bridge.ts`, so source and packaged runs register the same- // stable callback URI.+ // Register with the same Server environment that will exchange the callback.+ // Source runs use the local dev bridge; packaged builds use the production bridge.const redirectUri = `${accountApiBase().replace(/\/+$/, '')}/connectors/oauth/dcr-callback`;const registered = await _registerClient(meta.registration_endpoint, redirectUri, tokenEndpointAuthMethod);log.info('DCR registration done', { client_id_tail: registered.client_id.slice(-6) });diff --git a/test/main/features/connectors/open-source-boundary.test.ts b/test/main/features/connectors/open-source-boundary.test.tsindex 684634a7..c77d6198 100644--- a/test/main/features/connectors/open-source-boundary.test.ts+++ b/test/main/features/connectors/open-source-boundary.test.ts@@ -1,4 +1,4 @@-import { describe, expect, it } from 'vitest';+import { describe, expect, it, vi } from 'vitest';import * as fs from 'node:fs';import * as path from 'node:path';import { CONNECTOR_CATALOG } from '../../../../src/main/features/connectors/catalog';@@ -30,17 +30,32 @@ describe('public connector boundary', () => {}});- it('pins connector OAuth to the global HTTPS bridge with no loopback or environment override', () => {- const bridge = read('src/main/features/connectors/_server_bridge.ts');- const marketplace = read('src/main/features/marketplace.ts');+ it.each([+ [false, 'http://localhost:8888/api'],+ [true, 'https://orkas.ai/api'],+ ])('routes connectors for isPackaged=%s without changing marketplace routing', async (isPackaged, expected) => {+ vi.resetModules();+ vi.doMock('electron', () => ({ app: { isPackaged } }));+ const marketplaceBase = vi.fn(() => 'https://orkas.ai/api');+ vi.doMock('../../../../src/main/features/marketplace', () => ({ apiBase: marketplaceBase }));+ try {+ const { accountApiBase, tokenStore } = await import('../../../../src/main/features/connectors/_server_bridge');+ expect(accountApiBase()).toBe(expected);+ expect(tokenStore.authHeaders()).toEqual({});+ expect(marketplaceBase).toHaveBeenCalledTimes(isPackaged ? 1 : 0);+ } finally {+ vi.doUnmock('electron');+ vi.doUnmock('../../../../src/main/features/marketplace');+ vi.resetModules();+ }+ });++ it('keeps connector endpoint selection centralized without arbitrary environment overrides', () => {const oauthSources = [- bridge,read('src/main/features/connectors/oauth.ts'),read('src/main/features/connectors/oauth-dcr.ts'),+ read('src/main/features/connectors/manager.ts'),].join('\n');-- expect(bridge).toContain('return apiBase();');- expect(marketplace).toContain("const GLOBAL_PROD_API_BASE = 'https://orkas.ai' + '/api';");expect(oauthSources).not.toMatch(/http:\/\/(?:localhost|127\.0\.0\.1)|ORKAS_API_BASE_URL|OAUTH_REDIRECT_BASE/);});