hermes-agent/apps/desktop/electron/window-growth.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

54 lines
1.5 KiB
TypeScript

import type { Rectangle } from 'electron'
export interface GrowRequest {
bottom?: number
left?: number
minWidth?: number
right?: number
top?: number
}
export interface GrowInputs {
bounds: { height: number; width: number }
frameWidth?: number
workArea: { height: number; width: number; x: number; y: number }
zoom?: number
}
const MAX_DELTA_PX = 4000
const MAX_WORK_AREA = 0.92
export function growWindowBounds(
request: GrowRequest | null | undefined,
{ bounds, frameWidth = 0, workArea, zoom = 1 }: GrowInputs
) {
const dip = (value: number | undefined, round: (n: number) => number) =>
Math.max(0, Math.min(MAX_DELTA_PX, round((Number(value) || 0) * zoom)))
const toDip = (value?: number) => dip(value, Math.round)
const requestedMin = dip(request?.minWidth, Math.ceil)
const grown = bounds.width + toDip(request?.left) + toDip(request?.right)
const width = Math.min(
Math.max(grown, requestedMin ? requestedMin + frameWidth : 0),
Math.round(workArea.width * MAX_WORK_AREA)
)
const height = Math.min(
bounds.height + toDip(request?.top) + toDip(request?.bottom),
Math.round(workArea.height * MAX_WORK_AREA)
)
return centeredBounds(workArea, width, height)
}
export function centeredBounds(workArea: Rectangle, width: number, height: number): Rectangle {
return {
height,
width,
x: Math.round(workArea.x + (workArea.width - width) / 2),
y: Math.round(workArea.y + (workArea.height - height) / 2)
}
}