fmt(js): npm run fix on merge (#87839)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
12eeadf8ac
commit
b007b80cb7
@@ -131,13 +131,13 @@ test('backendScopeKey: non-local connections get an unambiguous composite', () =
|
||||
|
||||
// --- resolveRegistryLocalRoute (registry 'local' entry vs the v1 route) ---
|
||||
|
||||
test("registry local route: delegates to the legacy path when v1 is local (single-source users byte-identical)", () => {
|
||||
test('registry local route: delegates to the legacy path when v1 is local (single-source users byte-identical)', () => {
|
||||
assert.deepEqual(resolveRegistryLocalRoute('research', {}), { delegate: true, poolKey: 'research' })
|
||||
assert.deepEqual(resolveRegistryLocalRoute('', {}), { delegate: true, poolKey: 'default' })
|
||||
assert.deepEqual(resolveRegistryLocalRoute(null, { globalRemote: false }), { delegate: true, poolKey: 'default' })
|
||||
})
|
||||
|
||||
test("registry local route: v1 REMOTE global mode forces a genuinely-local backend (migration scenario)", () => {
|
||||
test('registry local route: v1 REMOTE global mode forces a genuinely-local backend (migration scenario)', () => {
|
||||
// The migration keeps the mandatory 'local' entry AND makes the v1 remote
|
||||
// the registry primary. If 'local' delegated to the v1 route here, the
|
||||
// roster's "This device" rows would enumerate + dial the REMOTE primary —
|
||||
@@ -559,7 +559,14 @@ test('upsertConnection replaces by id and appends new ids', () => {
|
||||
// --- connectionDialFieldsChanged (edit → recycle decision) ---
|
||||
|
||||
test('connectionDialFieldsChanged: label-only edits do not recycle', () => {
|
||||
const before = { id: 'homelab', kind: 'remote', label: 'Homelab', url: 'http://10.0.0.5:9119', authMode: 'token', token: { encoding: 'safeStorage', value: 'abc' } } as const
|
||||
const before = {
|
||||
id: 'homelab',
|
||||
kind: 'remote',
|
||||
label: 'Homelab',
|
||||
url: 'http://10.0.0.5:9119',
|
||||
authMode: 'token',
|
||||
token: { encoding: 'safeStorage', value: 'abc' }
|
||||
} as const
|
||||
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, label: 'Home lab (renamed)' }), false)
|
||||
// Identity edit is also a no-op.
|
||||
@@ -567,11 +574,21 @@ test('connectionDialFieldsChanged: label-only edits do not recycle', () => {
|
||||
})
|
||||
|
||||
test('connectionDialFieldsChanged: url / auth / token changes recycle', () => {
|
||||
const before = { id: 'homelab', kind: 'remote', label: 'Homelab', url: 'http://10.0.0.5:9119', authMode: 'token', token: { encoding: 'safeStorage', value: 'abc' } } as const
|
||||
const before = {
|
||||
id: 'homelab',
|
||||
kind: 'remote',
|
||||
label: 'Homelab',
|
||||
url: 'http://10.0.0.5:9119',
|
||||
authMode: 'token',
|
||||
token: { encoding: 'safeStorage', value: 'abc' }
|
||||
} as const
|
||||
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, url: 'http://10.0.0.9:9119' }), true)
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, authMode: 'oauth', token: undefined }), true)
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, token: { encoding: 'safeStorage', value: 'NEW' } }), true)
|
||||
assert.equal(
|
||||
connectionDialFieldsChanged(before, { ...before, token: { encoding: 'safeStorage', value: 'NEW' } }),
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
test('connectionDialFieldsChanged: ssh routing fields recycle, kind change recycles', () => {
|
||||
@@ -581,5 +598,8 @@ test('connectionDialFieldsChanged: ssh routing fields recycle, kind change recyc
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, host: 'other.lan' }), true)
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, port: 2222 }), true)
|
||||
assert.equal(connectionDialFieldsChanged(before, { ...before, remoteProfile: 'work' }), true)
|
||||
assert.equal(connectionDialFieldsChanged(before, { id: 'box', kind: 'remote', label: 'Box', url: 'http://x:1' }), true)
|
||||
assert.equal(
|
||||
connectionDialFieldsChanged(before, { id: 'box', kind: 'remote', label: 'Box', url: 'http://x:1' }),
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
@@ -5,17 +5,7 @@ import { Codicon } from '@/components/ui/codicon'
|
||||
import { Tip, TipKeybindLabel } from '@/components/ui/tooltip'
|
||||
import { useI18n } from '@/i18n'
|
||||
import { triggerHaptic } from '@/lib/haptics'
|
||||
import {
|
||||
AudioLines,
|
||||
Ear,
|
||||
EarOff,
|
||||
iconSize,
|
||||
Layers3,
|
||||
Loader2,
|
||||
Square,
|
||||
Volume2,
|
||||
VolumeX
|
||||
} from '@/lib/icons'
|
||||
import { AudioLines, Ear, EarOff, iconSize, Layers3, Loader2, Square, Volume2, VolumeX } from '@/lib/icons'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { $wakeWord, toggleWakeWord } from '@/store/wake-word'
|
||||
|
||||
|
||||
@@ -343,8 +343,7 @@ export function useGatewayEventHandler(deps: GatewayEventDeps) {
|
||||
// backendScopeKey — untagged (local/primary) events keep the legacy
|
||||
// bare-profile behavior byte-identical.
|
||||
const fromActiveSource = (): boolean =>
|
||||
(!event.profile ||
|
||||
normalizeProfileKey(event.profile) === normalizeProfileKey($activeGatewayProfile.get())) &&
|
||||
(!event.profile || normalizeProfileKey(event.profile) === normalizeProfileKey($activeGatewayProfile.get())) &&
|
||||
backendScopeKey(event.connectionId ?? null, event.profile ?? null) ===
|
||||
backendScopeKey(activeGatewayConnectionId(), event.profile ?? null)
|
||||
|
||||
@@ -508,12 +507,7 @@ export function useGatewayEventHandler(deps: GatewayEventDeps) {
|
||||
// gateway may reconcile the foreground cache. Requiring the renderer's
|
||||
// source tag prevents an event queued before a profile swap from being
|
||||
// attributed to the newly active profile.
|
||||
if (
|
||||
isActiveEvent &&
|
||||
typeof payload?.approval_mode === 'string' &&
|
||||
event.profile &&
|
||||
fromActiveSource()
|
||||
) {
|
||||
if (isActiveEvent && typeof payload?.approval_mode === 'string' && event.profile && fromActiveSource()) {
|
||||
reconcileApprovalModeForProfile(event.profile, payload.approval_mode)
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ describe('submit in-flight TTL', () => {
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('isTargetSessionBusy', () => {
|
||||
it('reads the target session slice, not the leftover foreground flag', () => {
|
||||
expect(isTargetSessionBusy({ a: { busy: true }, b: { busy: false } }, 'b', true)).toBe(false)
|
||||
|
||||
@@ -1453,13 +1453,7 @@ function ServerIconActions({
|
||||
// README shape — mcp.json snippet, npx/docker command line, `claude mcp add`,
|
||||
// a bare URL, or a Cursor deeplink — see the inferred name + config, then
|
||||
// merge it into the editor draft (unsaved, like the "+" starter entry).
|
||||
function McpImportButton({
|
||||
disabled,
|
||||
onImport
|
||||
}: {
|
||||
disabled: boolean
|
||||
onImport: (entries: McpImportEntry[]) => void
|
||||
}) {
|
||||
function McpImportButton({ disabled, onImport }: { disabled: boolean; onImport: (entries: McpImportEntry[]) => void }) {
|
||||
const { t } = useI18n()
|
||||
const m = t.settings.mcp
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
Vendored
+1
-3
@@ -147,9 +147,7 @@ declare global {
|
||||
// materially edited so the renderer can dispose (and re-dial) the
|
||||
// secondary gateways scoped to it. Optional: older Electron mains
|
||||
// don't emit it.
|
||||
onChanged?: (
|
||||
callback: (payload: { connectionId: string; reason: 'removed' | 'updated' }) => void
|
||||
) => () => void
|
||||
onChanged?: (callback: (payload: { connectionId: string; reason: 'removed' | 'updated' }) => void) => () => void
|
||||
}
|
||||
sshConfigHosts: () => Promise<DesktopSshHostsResult>
|
||||
sshResolveHost: (host: string) => Promise<DesktopSshResolveResult>
|
||||
|
||||
@@ -793,7 +793,7 @@ export interface Translations {
|
||||
deepLinkErrorConfig: string
|
||||
deepLinkErrorShape: string
|
||||
deepLinkErrorUrl: string
|
||||
deepLinkErrorTooLarge: string,
|
||||
deepLinkErrorTooLarge: string
|
||||
importButton: string
|
||||
importPlaceholder: string
|
||||
importNoMatch: string
|
||||
|
||||
@@ -100,18 +100,18 @@ describe('parseMcpImport', () => {
|
||||
|
||||
describe('claude mcp add lines', () => {
|
||||
it('parses a stdio add with env and a -- separator', () => {
|
||||
expect(parseMcpImport('claude mcp add airtable -e AIRTABLE_API_KEY=YOUR_KEY -- npx -y airtable-mcp-server')).toEqual(
|
||||
[
|
||||
{
|
||||
config: {
|
||||
args: ['-y', 'airtable-mcp-server'],
|
||||
command: 'npx',
|
||||
env: { AIRTABLE_API_KEY: 'YOUR_KEY' }
|
||||
},
|
||||
name: 'airtable'
|
||||
}
|
||||
]
|
||||
)
|
||||
expect(
|
||||
parseMcpImport('claude mcp add airtable -e AIRTABLE_API_KEY=YOUR_KEY -- npx -y airtable-mcp-server')
|
||||
).toEqual([
|
||||
{
|
||||
config: {
|
||||
args: ['-y', 'airtable-mcp-server'],
|
||||
command: 'npx',
|
||||
env: { AIRTABLE_API_KEY: 'YOUR_KEY' }
|
||||
},
|
||||
name: 'airtable'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('parses a stdio add without a -- separator', () => {
|
||||
@@ -131,7 +131,9 @@ describe('parseMcpImport', () => {
|
||||
|
||||
it('parses an sse add with a header', () => {
|
||||
expect(
|
||||
parseMcpImport('claude mcp add --transport sse api -H "Authorization: Bearer TOKEN_HERE" https://api.example.com/sse')
|
||||
parseMcpImport(
|
||||
'claude mcp add --transport sse api -H "Authorization: Bearer TOKEN_HERE" https://api.example.com/sse'
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
config: {
|
||||
|
||||
@@ -2,11 +2,7 @@ import { afterEach, describe, expect, it } from 'vitest'
|
||||
|
||||
import { createClientSessionState } from '@/lib/chat-runtime'
|
||||
import { host } from '@/sdk'
|
||||
import {
|
||||
setActiveSessionId,
|
||||
setAwaitingResponse,
|
||||
setBusy
|
||||
} from '@/store/session'
|
||||
import { setActiveSessionId, setAwaitingResponse, setBusy } from '@/store/session'
|
||||
import { clearAllSessionStates, publishSessionState } from '@/store/session-states'
|
||||
|
||||
describe('host.state turn flags', () => {
|
||||
|
||||
@@ -38,13 +38,7 @@ import {
|
||||
setActiveProfile,
|
||||
setShowAllProfiles
|
||||
} from '@/store/profile'
|
||||
import {
|
||||
$activeSessionId,
|
||||
$currentCwd,
|
||||
$currentModel,
|
||||
$gatewayState,
|
||||
$selectedStoredSessionId
|
||||
} from '@/store/session'
|
||||
import { $activeSessionId, $currentCwd, $currentModel, $gatewayState, $selectedStoredSessionId } from '@/store/session'
|
||||
import {
|
||||
$focusedRuntimeId,
|
||||
$focusedSessionState,
|
||||
|
||||
@@ -38,8 +38,13 @@ vi.mock('@/store/session', () => ({
|
||||
}))
|
||||
vi.mock('@/store/notify-baseline', () => ({ markNativeNotifyBaseline: vi.fn() }))
|
||||
|
||||
const { closeSecondaryGateways, configureGatewayRegistry, openGatewayForAgent, pruneSecondaryGateways, setPrimaryGateway } =
|
||||
await import('./gateway')
|
||||
const {
|
||||
closeSecondaryGateways,
|
||||
configureGatewayRegistry,
|
||||
openGatewayForAgent,
|
||||
pruneSecondaryGateways,
|
||||
setPrimaryGateway
|
||||
} = await import('./gateway')
|
||||
|
||||
function installDesktop(): void {
|
||||
;(window as unknown as { hermesDesktop: unknown }).hermesDesktop = {
|
||||
|
||||
@@ -107,6 +107,7 @@ async function sweep(): Promise<void> {
|
||||
}
|
||||
|
||||
const raw = config.mcp_servers
|
||||
|
||||
const servers =
|
||||
raw && typeof raw === 'object' && !Array.isArray(raw) ? (raw as Record<string, Record<string, unknown>>) : {}
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ const localConn = (over: Partial<HermesConnection> = {}): HermesConnection =>
|
||||
({ baseUrl: '', mode: 'local', profile: 'default', ...over }) as HermesConnection
|
||||
|
||||
const getConnection = vi.fn<(profile?: string | null) => Promise<HermesConnection>>()
|
||||
const getConnectionFor = vi.fn<(payload: { connectionId?: null | string; profile?: null | string }) => Promise<HermesConnection>>()
|
||||
const getConnectionFor =
|
||||
vi.fn<(payload: { connectionId?: null | string; profile?: null | string }) => Promise<HermesConnection>>()
|
||||
|
||||
function deferred(): { promise: Promise<void>; resolve: () => void } {
|
||||
let resolve!: () => void
|
||||
|
||||
@@ -68,11 +68,7 @@ export const $sessionStates = atom<Record<string, ClientSessionState>>({})
|
||||
|
||||
const sessionScopeByRuntimeId = new Map<string, string>()
|
||||
|
||||
export function recordSessionEventScope(event: {
|
||||
connectionId?: string
|
||||
profile?: string
|
||||
session_id?: string
|
||||
}): void {
|
||||
export function recordSessionEventScope(event: { connectionId?: string; profile?: string; session_id?: string }): void {
|
||||
if (event.session_id && event.connectionId) {
|
||||
sessionScopeByRuntimeId.set(event.session_id, backendScopeKey(event.connectionId, event.profile))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user