Skip to content

The agent that grows with you

fix(desktop): clarify inherited profile gateway

KaliShodan4656a1a00980
diff --git a/apps/desktop/src/app/settings/gateway-settings.test.tsx b/apps/desktop/src/app/settings/gateway-settings.test.tsx
new file mode 100644
index 00000000000..89df6a90491
--- /dev/null
+++ b/apps/desktop/src/app/settings/gateway-settings.test.tsx
@@ -0,0 +1,78 @@
+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { atom } from 'nanostores'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import type { ProfileInfo } from '@/types/hermes'
+
+const getConnectionConfig = vi.fn()
+const profiles = atom<ProfileInfo[]>([])
+
+vi.mock('@/store/profile', () => ({
+ $profiles: profiles,
+ refreshActiveProfile: vi.fn()
+}))
+
+const localConnection = {
+ cloudOrg: '',
+ envOverride: false,
+ mode: 'local',
+ remoteAuthMode: 'token',
+ remoteOauthConnected: false,
+ remoteTokenPreview: null,
+ remoteTokenSet: false,
+ remoteUrl: ''
+}
+
+beforeEach(() => {
+ profiles.set([
+ {
+ has_env: false,
+ is_default: true,
+ model: null,
+ name: 'default',
+ path: '/tmp/hermes',
+ provider: null,
+ skill_count: 0
+ },
+ {
+ has_env: false,
+ is_default: false,
+ model: null,
+ name: 'work',
+ path: '/tmp/hermes/profiles/work',
+ provider: null,
+ skill_count: 0
+ }
+ ])
+ getConnectionConfig.mockResolvedValue(localConnection)
+ Object.defineProperty(window, 'hermesDesktop', {
+ configurable: true,
+ value: { getConnectionConfig }
+ })
+})
+
+afterEach(() => {
+ cleanup()
+ vi.clearAllMocks()
+})
+
+describe('GatewaySettings', () => {
+ it('labels local mode as default inheritance for a named profile', async () => {
+ const { GatewaySettings } = await import('./gateway-settings')
+
+ render(<GatewaySettings />)
+ expect(await screen.findByText('Local gateway')).toBeTruthy()
+ expect(
+ screen.getByText('Start a private Hermes backend on localhost. This is the default and works offline.')
+ ).toBeTruthy()
+
+ fireEvent.click(screen.getByRole('button', { name: 'work' }))
+
+ await waitFor(() => expect(getConnectionConfig).toHaveBeenLastCalledWith('work'))
+ expect(await screen.findByText('Use default gateway')).toBeTruthy()
+ expect(screen.getByText("Remove this profile's override and use the default connection.")).toBeTruthy()
+ expect(
+ screen.queryByText('Start a private Hermes backend on localhost. This is the default and works offline.')
+ ).toBeNull()
+ })
+})
diff --git a/apps/desktop/src/app/settings/gateway-settings.tsx b/apps/desktop/src/app/settings/gateway-settings.tsx
index eafe0ce2f37..30afd2dfd3d 100644
--- a/apps/desktop/src/app/settings/gateway-settings.tsx
+++ b/apps/desktop/src/app/settings/gateway-settings.tsx
@@ -1054,11 +1054,11 @@ export function GatewaySettings({ embedded = false }: { embedded?: boolean } = {
<div className="grid auto-rows-fr grid-cols-1 gap-2 sm:grid-cols-2 min-[72rem]:grid-cols-4">
<ModeCard
active={state.mode === 'local'}
- description={g.localDesc}
+ description={scope === null ? g.localDesc : g.inheritDesc}
disabled={state.envOverride}
icon={Monitor}
onSelect={() => setState(current => ({ ...current, mode: 'local' }))}
- title={g.localTitle}
+ title={scope === null ? g.localTitle : g.inheritTitle}
/>
<ModeCard
active={state.mode === 'cloud'}
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 25a6fa82fb6..e4ac084ec2c 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -576,13 +576,15 @@ export const en: Translations = {
allProfiles: 'All profiles',
defaultConnection: 'Default connection for every profile that has no override of its own.',
profileConnection: profile =>
- `Connection used only when “${profile}” is the active profile. Set it to Local to inherit the default.`,
+ `Connection used only when “${profile}” is the active profile. Choose Use default gateway to remove its override.`,
envOverrideTitle: 'Environment variables are controlling this desktop session.',
envOverrideDesc:
'Unset HERMES_DESKTOP_REMOTE_URL and HERMES_DESKTOP_REMOTE_TOKEN to use the saved setting below.',
modeTitle: 'Connection mode',
localTitle: 'Local gateway',
localDesc: 'Start a private Hermes backend on localhost. This is the default and works offline.',
+ inheritTitle: 'Use default gateway',
+ inheritDesc: "Remove this profile's override and use the default connection.",
remoteTitle: 'Remote gateway',
remoteDesc: 'Connect this desktop shell to a remote Hermes backend.',
remoteAuthHint: 'Hosted gateways use OAuth or a username and password; self-hosted ones may use a session token.',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 75cfe0feaf8..a8164a5ab86 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -683,13 +683,15 @@ export const ja = defineLocale({
allProfiles: 'すべてのプロファイル',
defaultConnection: '独自のオーバーライドがないすべてのプロファイルのデフォルト接続。',
profileConnection: profile =>
- `"${profile}" がアクティブプロファイルのときのみ使用される接続。ローカルに設定するとデフォルトを継承します。`,
+ `"${profile}" がアクティブプロファイルのときのみ使用される接続。「デフォルトゲートウェイを使用」を選ぶとオーバーライドが削除されます。`,
envOverrideTitle: '環境変数がこのデスクトップセッションを制御しています。',
envOverrideDesc:
'保存された設定を使用するには HERMES_DESKTOP_REMOTE_URL と HERMES_DESKTOP_REMOTE_TOKEN の設定を解除してください。',
localTitle: 'ローカルゲートウェイ',
localDesc:
'ローカルホストでプライベートな Hermes バックエンドを起動します。これがデフォルトで、オフラインでも動作します。',
+ inheritTitle: 'デフォルトゲートウェイを使用',
+ inheritDesc: 'このプロファイルのオーバーライドを削除し、デフォルト接続を使用します。',
remoteTitle: 'リモートゲートウェイ',
remoteDesc:
'このデスクトップシェルをリモートの Hermes バックエンドに接続します。ホスト型ゲートウェイは OAuth またはユーザー名とパスワードを使用します。自己ホスト型はセッショントークンを使用する場合があります。',
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 928493ec05a..c83039d09d2 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -486,6 +486,8 @@ export interface Translations {
modeTitle: string
localTitle: string
localDesc: string
+ inheritTitle: string
+ inheritDesc: string
remoteTitle: string
remoteDesc: string
remoteAuthHint: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 90240c358a0..c54465840ac 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -670,11 +670,13 @@ export const zhHant = defineLocale({
appliesTo: '套用至',
allProfiles: '全部設定檔',
defaultConnection: '預設連線適用於所有沒有自訂覆寫的設定檔。',
- profileConnection: profile => `僅當「${profile}」為作用中設定檔時使用此連線。設為本機可繼承預設連線。`,
+ profileConnection: profile => `僅當「${profile}」為作用中設定檔時使用此連線。選擇「使用預設閘道」可移除其覆寫。`,
envOverrideTitle: '環境變數正在控制此桌面工作階段。',
envOverrideDesc: '取消設定 HERMES_DESKTOP_REMOTE_URL 和 HERMES_DESKTOP_REMOTE_TOKEN 後才會使用下方儲存的設定。',
localTitle: '本機閘道',
localDesc: '在 localhost 啟動私有 Hermes 後端。這是預設方式,可離線使用。',
+ inheritTitle: '使用預設閘道',
+ inheritDesc: '移除此設定檔的自訂覆寫並使用預設連線。',
remoteTitle: '遠端閘道',
remoteDesc:
'將此桌面殼層連線至遠端 Hermes 後端。託管閘道使用 OAuth 或帳號密碼;自託管閘道也可使用工作階段 Token。',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index f9f4c92a774..e6600316653 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -782,12 +782,14 @@ export const zh: Translations = {
appliesTo: '应用于',
allProfiles: '所有 profile',
defaultConnection: '默认连接会用于所有没有自定义覆盖的 profile。',
- profileConnection: profile => `仅当“${profile}”是当前 profile 时使用此连接。设为本地即可继承默认连接。`,
+ profileConnection: profile => `仅当“${profile}”是当前 profile 时使用此连接。选择“使用默认网关”可移除其覆盖。`,
envOverrideTitle: '环境变量正在控制此桌面会话。',
envOverrideDesc: '取消设置 HERMES_DESKTOP_REMOTE_URL 和 HERMES_DESKTOP_REMOTE_TOKEN 后才会使用下面保存的设置。',
modeTitle: '连接模式',
localTitle: '本地网关',
localDesc: '在 localhost 启动私有 Hermes 后端。这是默认方式,并且可离线工作。',
+ inheritTitle: '使用默认网关',
+ inheritDesc: '移除此 profile 的自定义覆盖并使用默认连接。',
remoteTitle: '远程网关',
remoteDesc: '将此桌面外壳连接到远程 Hermes 后端。',
remoteAuthHint: '托管网关使用 OAuth 或用户名密码;自托管网关也可能使用会话 token。',