Files
hermes-agent/apps/desktop/electron/preload-flags.test.ts
Siddharth Balyan d9d122a003 refactor(onboarding): remove the intro cinematic, the guided-onboarding tests, and their comments (#126139)
* refactor(desktop): remove the onboarding intro cinematic and the guided-onboarding tests

The guided first run now opens straight into the guide: the gate's
`cinematic` phase becomes `pending`, and OnboardingChatGate owes the guide
on mount (the old HERMES_SKIP_INTRO path, now the only path). Removes the
native intro window, its IPC bridge, the `?win=intro` renderer, its assets,
and the skipIntro launch flag. Deletes the guided-onboarding test files ahead
of the rewrite, plus the reset helpers only they called.

* refactor(onboarding): strip comments from the guided-onboarding modules

Clears comments and docstrings from the guided-onboarding files ahead of
their rewrite, desktop and backend. Lint and type pragmas stay. No code
changes.
2026-09-28 08:33:43 +00:00

37 lines
1.5 KiB
TypeScript

import { expect, it, vi } from 'vitest'
const host = vi.hoisted(() => ({
exposeInMainWorld: vi.fn(),
send: vi.fn<(channel: string, line: string) => void>(),
sendSync: vi.fn((channel: string): unknown =>
channel === 'hermes:feature-flags' ? { localModels: true, guestOnboarding: true } : {}
)
}))
vi.mock('electron', () => ({
contextBridge: { exposeInMainWorld: host.exposeInMainWorld },
ipcRenderer: { send: host.send, sendSync: host.sendSync },
webFrame: {},
webUtils: {}
}))
it('publishes the feature flags answered by main before the renderer starts', async (): Promise<void> => {
await import('./preload')
const registration = host.exposeInMainWorld.mock.calls.find(([name]): boolean => name === 'hermesDesktop')
expect(registration).toBeDefined()
expect(registration![1]).toMatchObject({ localModelsEnabled: true, guestOnboardingEnabled: true })
expect(host.sendSync).toHaveBeenCalledWith('hermes:feature-flags')
})
it('forwards full renderer error lines through the exposed bridge', async (): Promise<void> => {
await import('./preload')
const registration = host.exposeInMainWorld.mock.calls.find(([name]): boolean => name === 'hermesDesktop')
const bridge = registration?.[1] as { logLine?: (line: string) => void } | undefined
const line: string = '[renderer error:main] Prompt failed: database is locked\n at saveSession (session.ts:12)'
expect(bridge?.logLine).toBeTypeOf('function')
bridge?.logLine?.(line)
expect(host.send).toHaveBeenCalledExactlyOnceWith('hermes:logs:renderer-line', line)
})