Skip to content

PreviewWiring

Defined in: src/poller.ts:52

Injectable preview wiring: service + throttle cadence + scan/pick overrides. Defaults to the real implementations; tests inject fakes to avoid /proc + network.

optional idleStop?: object

Defined in: src/poller.ts:72

Opt-in idle-stop. idleMs > 0 enables it; stop signals a session’s dev-server process (wired to SessionService.stopPreview in index.ts). Absent = disabled.

idleMs: number

stop: (sessionId, signal) => void

string

Signals

void


pick: (ports, worktreePath) => Promise<number | null>

Defined in: src/poller.ts:69

Pick the primary dev port from a set of listening ports for a given worktree. Defaults to resolveDevPort, which honors the agent-declared .shepherd-preview hint (if listening + HTTP-live) and otherwise falls back to the primary-port heuristic.

number[]

string

Promise<number | null>


scan: (worktrees) => Map<string, number[]>

Defined in: src/poller.ts:65

Batched /proc scan: builds the inode→port map ONCE and resolves all worktrees. Defaults to the real scanListeningPortsByWorktree.

string[]

Map<string, number[]>


service: object

Defined in: src/poller.ts:53

converge(active): void

object[]

void

ensure(sessionId, devPort): number | null

string

number

number | null

optional idleSince(sessionId, now): number | null

Ms since last proxy activity for a bound session, null if unbound. Optional so existing fake service literals in tests still compile.

string

number

number | null

release(sessionId): void

string

void

snapshot(): Record<string, { previewPort: number | null; }>

Record<string, { previewPort: number | null; }>


sweepMs: number

Defined in: src/poller.ts:62