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
Sync connector card UI
wyt0f371e9226bb
diff --git a/src/renderer/modules/connectors.js b/src/renderer/modules/connectors.jsindex 5d8feaaa..dce5e820 100644--- a/src/renderer/modules/connectors.js+++ b/src/renderer/modules/connectors.js@@ -328,7 +328,7 @@ function _renderCatalogCard(entry, instance) {// disconnect action as a bottom-row button (they need it visible to recover; the disable toggle// doesn't apply when there's nothing to disable).const menuHtml = connected- ? `<button class="connector-card-menu-btn" data-act="menu" aria-label="${escapeHtml(t('common.more'))}">⋯</button>`+ ? `<button class="connector-card-menu-btn" data-act="menu" aria-label="${escapeHtml(t('common.more'))}" aria-expanded="false">⋯</button>`: '';// Bottom-row action:@@ -338,7 +338,7 @@ function _renderCatalogCard(entry, instance) {// before `_runConnect`'s `finally` clears the connecting flag, and the user sees// the spinner vanish "the moment they return from the browser" even though the// IPC chain (loadConnectors + grid re-render) is still finishing.- // - connected: enable / disable toggle (per-user soft switch — hides instance from LLM)+ // - connected: use in the Commander composer; enable / disable lives in the ⋯ menu// - errored: disconnect (recover from a stuck error state)// - oauth_pending: disabled unavailable button// - default (uninstalled): connect (start OAuth)@@ -351,9 +351,8 @@ function _renderCatalogCard(entry, instance) {} else if (isVisibleDisabled) {action = `<button class="btn btn-sm btn-primary" data-act="unsupported-connect">${escapeHtml(t('connectors.action.connect'))}</button>`;} else if (connected) {- const label = enabledFlag ? t('component.disable') : t('component.enable');- const cls = enabledFlag ? 'btn btn-sm' : 'btn btn-sm btn-primary';- action = `<button class="${cls}" data-act="toggle-enabled">${escapeHtml(label)}</button>`;+ const useTitle = escapeHtml(formatChatUseLabel({ kind: 'connector', id: e.id, name: e.display_name || e.id }));+ action = `<button class="agent-card-use connector-card-use" data-act="use-connector" title="${useTitle}" aria-label="${useTitle}" ${enabledFlag ? '' : 'disabled aria-disabled="true" tabindex="-1"'}>${escapeHtml(t('common.use'))}</button>`;} else if (e._custom) {// Custom server, not connected: retry probes the stored transport// (`connectors.refresh`), never OAuth. Disconnect stays available so a@@ -409,7 +408,7 @@ function _renderCatalogCard(entry, instance) {else if (act === 'unsupported-connect') _showConnectorUnsupportedToast();else if (act === 'disconnect') _quickDisconnect(e, instance);else if (act === 'menu') _openCardMenu(btn, e, instance);- else if (act === 'toggle-enabled') _toggleConnectorEnabled(e, instance, !enabledFlag);+ else if (act === 'use-connector' && enabledFlag) _useConnector(e, instance);else if (act === 'retry-custom') _retryCustomConnect(e);});});@@ -419,19 +418,35 @@ function _renderCatalogCard(entry, instance) {// Tiny absolute-positioned popover anchored under the ⋯ button — one disconnect item for now.// Closes on outside click / Esc / window scroll. Keeping it inline so we don't pull in a generic// menu primitive for one use site; if a second connector-card menu item ever lands, refactor.+function _clearConnectorCardMenuState() {+ document.querySelectorAll('.connector-card.is-menu-open').forEach((card) => card.classList.remove('is-menu-open'));+ document.querySelectorAll('.connector-card-menu-btn[aria-expanded="true"]').forEach((btn) => {+ btn.setAttribute('aria-expanded', 'false');+ });+}+function _openCardMenu(anchorBtn, entry, instance) {+ const card = anchorBtn.closest('.connector-card');+ const openCard = document.querySelector('.connector-card.is-menu-open');const existing = document.querySelector('.connector-card-menu-popover');- if (existing) { existing.remove(); return; }+ if (existing) {+ existing.remove();+ _clearConnectorCardMenuState();+ if (openCard === card) return;+ }+ if (card) card.classList.add('is-menu-open');+ anchorBtn.setAttribute('aria-expanded', 'true');const rect = anchorBtn.getBoundingClientRect();const pop = document.createElement('div');pop.className = 'connector-card-menu-popover';pop.style.top = '-9999px';pop.style.left = '-9999px';- const pickerItem = entry && entry.id === 'gsheets'- ? `<div class="connector-card-menu-item" data-act="authorize-sheets">${escapeHtml(t('connectors.action.select_sheet'))}</div>`- : '';+ const enabledFlag = instance && Object.prototype.hasOwnProperty.call(instance, 'enabled')+ ? !!instance.enabled+ : true;+ const toggleLabel = enabledFlag ? t('component.disable') : t('component.enable');pop.innerHTML = `- ${pickerItem}+ <div class="connector-card-menu-item" data-act="toggle-enabled">${escapeHtml(toggleLabel)}</div><div class="connector-card-menu-item is-danger" data-act="disconnect">${escapeHtml(t('connectors.action.disconnect'))}</div>`;document.body.appendChild(pop);@@ -448,6 +463,7 @@ function _openCardMenu(anchorBtn, entry, instance) {const close = () => {pop.remove();+ _clearConnectorCardMenuState();document.removeEventListener('mousedown', onOutside, true);document.removeEventListener('keydown', onKey, true);window.removeEventListener('scroll', close, true);@@ -458,56 +474,28 @@ function _openCardMenu(anchorBtn, entry, instance) {document.addEventListener('keydown', onKey, true);window.addEventListener('scroll', close, true);- pop.querySelector('[data-act="disconnect"]').addEventListener('click', () => {- close();- _quickDisconnect(entry, instance);- });- const sheetPicker = pop.querySelector('[data-act="authorize-sheets"]');- if (sheetPicker) {- sheetPicker.addEventListener('click', () => {+ pop.querySelectorAll('[data-act]').forEach((item) => {+ item.addEventListener('click', () => {close();- _authorizeGoogleSheetsFiles();+ const act = item.dataset.act;+ if (act === 'disconnect') _quickDisconnect(entry, instance);+ else if (act === 'toggle-enabled') _toggleConnectorEnabled(entry, instance, !enabledFlag);});- }+ });}-async function _authorizeGoogleSheetsFiles() {- const startedAt = performance.now();- _connectorsTrackClick('connector_authorize_files', { connector_id: 'gsheets' });- try {- const res = await window.orkas.invoke('connectors.google_sheets_authorize_files', {});- if (!res || !res.ok) {- _connectorsTrackEvent('connector_authorize_files_result', {- connector_id: 'gsheets',- result: 'failure',- duration_ms: Math.round(performance.now() - startedAt),- });- uiAlert((res && res.error) || t('connectors.errors.authorize_sheet_failed'));- return;- }- const count = Array.isArray(res.picked_file_ids) ? res.picked_file_ids.length : 0;- _connectorsTrackEvent('connector_authorize_files_result', {- connector_id: 'gsheets',- result: 'success',- file_count: count,- duration_ms: Math.round(performance.now() - startedAt),- });- await uiAlert(count > 0- ? t('connectors.toast.sheet_selected', { count })- : t('connectors.toast.sheet_authorized'));- await loadConnectors();- } catch (err) {- _connectorsTrackEvent('connector_authorize_files_result', {- connector_id: 'gsheets',- result: 'failure',- duration_ms: Math.round(performance.now() - startedAt),- });- _connectorsTrackError('connector_authorize_files', {- connector_id: 'gsheets',- error_type: _connectorTrackErrorType(err),- });- uiAlert((err && err.message) || t('connectors.errors.authorize_sheet_failed'));+function _useConnector(entry, instance) {+ if (!instance || !instance.status || instance.status.kind !== 'connected' || instance.enabled === false) return;+ const id = String((instance && instance.id) || (entry && entry.id) || '').trim();+ const name = String((instance && instance.display_name) || (entry && entry.display_name) || id).trim();+ if (!id && !name) return;+ _connectorsTrackClick('connector_use', { ..._connectorTrackPayload(entry, instance), connector_id: id || name });+ setView('new-chat');+ if (typeof setChatRecipient === 'function') {+ setChatRecipient('new-chat', { kind: 'commander' });}+ setChatConnector('new-chat', id || name, name || id);+ setTimeout(() => document.getElementById('new-chat-input')?.focus(), 50);}async function _toggleConnectorEnabled(entry, instance, nextEnabled) {diff --git a/src/renderer/style.css b/src/renderer/style.cssindex d92925e6..ca0b0a10 100644--- a/src/renderer/style.css+++ b/src/renderer/style.css@@ -11815,7 +11815,7 @@ body.model-not-configured .main-content { flex-direction: column; }flex-direction: column;gap: 8px;min-width: 0;- padding: 14px;+ padding: 14px 16px;background: var(--surface);border: 1px solid var(--border);border-radius: 10px;@@ -11842,6 +11842,9 @@ body.model-not-configured .main-content { flex-direction: column; }.connector-card-icon.is-svg {padding: 6px;}+.connector-card[data-id="sentry"] .connector-card-icon.is-svg {+ padding: 4px;+}.connector-card-icon.is-svg svg {width: 100%;height: 100%;@@ -11897,23 +11900,33 @@ body.model-not-configured .main-content { flex-direction: column; }overflow: hidden;text-wrap: pretty;}-/* Connected card's ⋯ menu lives at the top-right of `.connector-card-top`. Hosts the destructive- "disconnect" action; kept off the visible foot row so it's one extra click away from the- common "enable / disable" toggle. */+/* Match skill / agent card ⋯ placement: compact, hover-only, nudged toward the card edge. */.connector-card-menu-btn {margin-left: auto;- width: 28px;- height: 28px;+ margin-top: -2px;+ margin-right: -4px;+ width: 22px;+ height: 22px;+ padding: 0;border: 0;background: transparent;- border-radius: 6px;- font-size: 18px;+ border-radius: 4px;+ font-size: 16px;line-height: 1;- color: #6b7280;+ color: var(--muted);cursor: pointer;flex-shrink: 0;+ align-self: flex-start;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ visibility: hidden;+ transition: background 0.1s, color 0.1s;}-.connector-card-menu-btn:hover { background: rgba(15, 23, 42, 0.06); color: #111827; }+.connector-card:hover .connector-card-menu-btn,+.connector-card:focus-within .connector-card-menu-btn,+.connector-card.is-menu-open .connector-card-menu-btn { visibility: visible; }+.connector-card-menu-btn:hover { background: rgba(15, 23, 42, 0.08); color: #334155; }.connector-card-menu-popover {position: fixed;z-index: 1000;@@ -11955,7 +11968,17 @@ body.model-not-configured .main-content { flex-direction: column; }animation: marketplace-upload-spin 0.8s linear infinite;}-.connector-card-foot { margin-top: auto; display: flex; justify-content: flex-end; gap: 6px; align-items: center; }+.connector-card-foot {+ margin-top: auto;+ display: flex;+ justify-content: flex-end;+ gap: 8px;+ align-items: center;+ min-width: 0;+}+.connector-card-foot .btn {+ flex: 0 0 auto;+}.connector-card-foot .btn-link {background: transparent;border: none;diff --git a/test/renderer/connectors-card.test.ts b/test/renderer/connectors-card.test.tsnew file mode 100644index 00000000..0ec2f98a--- /dev/null+++ b/test/renderer/connectors-card.test.ts@@ -0,0 +1,49 @@+import { describe, expect, it } from 'vitest';+import * as fs from 'node:fs';+import * as path from 'node:path';++const root = path.join(__dirname, '../..');++function read(rel: string) {+ return fs.readFileSync(path.join(root, rel), 'utf8');+}++describe('connectors card surface', () => {+ it('keeps the synced card grid sizing and compact menu styling', () => {+ const css = read('src/renderer/style.css');++ expect(css).toMatch(/\.connectors-grid\s*{[\s\S]*?--connector-card-min:\s*280px;[\s\S]*?grid-template-columns:\s*repeat\(auto-fill,\s*minmax\(min\(100%,\s*max\(var\(--connector-card-min\),\s*calc\(\(100% - \(3 \* var\(--connector-grid-gap\)\)\) \/ 4\)\)\),\s*1fr\)\);/);+ expect(css).toMatch(/\.connector-card\s*{[\s\S]*?padding:\s*14px 16px;/);+ expect(css).toMatch(/\.connector-card-menu-btn\s*{[\s\S]*?width:\s*22px;[\s\S]*?height:\s*22px;[\s\S]*?visibility:\s*hidden;/);+ expect(css).toContain('.connector-card:hover .connector-card-menu-btn');+ expect(css).toMatch(/\.connector-card-foot\s*{[\s\S]*?gap:\s*8px;[\s\S]*?min-width:\s*0;/);+ expect(css).toMatch(/\.connector-card-foot \.btn\s*{[\s\S]*?flex:\s*0 0 auto;/);+ });++ it('renders connected cards with Use and keeps enable/disable in the card menu', () => {+ const js = read('src/renderer/modules/connectors.js');++ expect(js).toContain('data-act="use-connector"');+ expect(js).toContain('connector-card-use');+ expect(js).toContain("setChatConnector('new-chat'");+ expect(js).toContain('data-act="toggle-enabled"');+ expect(js).toContain('_clearConnectorCardMenuState');+ expect(js).not.toContain('authorize-sheets');+ expect(js).not.toContain('connectors.google_sheets_authorize_files');+ });++ it('continues filtering PC credit-gated connector UI', () => {+ const js = read('src/renderer/modules/connectors.js');+ const css = read('src/renderer/style.css');+ const locales = ['en', 'zh', 'ja', 'pt'].map((lang) => read(`src/renderer/locales/${lang}.json`)).join('\n');+ const meteringKey = ['usage', '_metering'].join('');+ const pricingKey = ['credits', '_milli_per_call'].join('');+ const copyKey = ['connectors.badge.', 'credits', '_required'].join('');++ expect(js).not.toContain(meteringKey);+ expect(js).not.toContain(pricingKey);+ expect(js).not.toContain('_connectorCreditBadge');+ expect(css).not.toContain('connector-card-credit-badge');+ expect(locales).not.toContain(copyKey);+ });+});