exlab_wizard.window.main#

exlab-wizard-window console_scripts entry point. Backend Spec §15.3.2.

Reads <state_dir>/server.json written by the tray’s ServerRunner, validates the recorded PID is alive, and hands off to pywebview_app.

Stale state file – prints a one-line message to stderr and exits with status 2 (the tray’s WindowLauncher interprets this as “tray died; restart from scratch”; Backend §4.3.2).

Functions

is_pid_alive(pid)

Cross-platform "is this PID a live process?" check.

main([argv, state_dir, handoff, pid_alive])

Entry point.

read_server_handshake(state_dir)

Read and validate <state_dir>/server.json.

Classes

ServerHandshake(*, port, pid, started_at)

Resolved server.json contents: port / pid / started_at.

class exlab_wizard.window.main.ServerHandshake(*, port, pid, started_at)[source]#

Bases: object

Resolved server.json contents: port / pid / started_at.

Parameters:
pid#
port#
started_at#
exlab_wizard.window.main.main(argv=None, *, state_dir=None, handoff=None, pid_alive=None)[source]#

Entry point. Backend Spec §15.3.2.

argv is ignored at this phase (the spec lists --debug as a debug-build-only flag; release artifacts read the EXLAB_DEBUG env var instead).

state_dir, handoff, and pid_alive are dependency injection hooks for tests.

Parameters:
Return type:

int

exlab_wizard.window.main.read_server_handshake(state_dir)[source]#

Read and validate <state_dir>/server.json.

Returns the handshake on success, None if the file is missing or malformed. Validation is intentionally minimal – if the file exists, the PID is alive, and the port parses, we proceed; deeper health checks happen on the first HTTP call inside pywebview.

Parameters:

state_dir (Path)

Return type:

ServerHandshake | None