schrodinger.application.bunsen.ipc_client module

Maestro instance registry for Bunsen discovery.

Maintains a SQLite database in ~/.schrodinger/ that tracks running Maestro instances so that Bunsen can discover them. Each Maestro process registers itself on startup, heartbeats periodically, and deregisters on exit. The heartbeat also watches for a per-instance Unix socket (or Windows named pipe) that Bunsen creates when it wants to connect to a specific Maestro instance.

schrodinger.application.bunsen.ipc_client.get_registry_path(hostname: str | None = None) str

Return the path to the Maestro instance registry database.

schrodinger.application.bunsen.ipc_client.generate_instance_id() str
schrodinger.application.bunsen.ipc_client.get_project_path() str | None

Return the current Maestro project directory, or None.

class schrodinger.application.bunsen.ipc_client.BunsenIPCClient(db_path: str | None = None, instance_id: str | None = None, parent=None)

Bases: QObject

Registers this Maestro in the instance registry and heartbeats.

On each heartbeat tick the registry row is updated, stale entries from other processes are cleaned up, and a per-instance socket is checked. When Bunsen wants to connect it creates that socket; Maestro connects to it, reads the session info, and emits sessionDiscovered.

The socket stays open after sessionDiscovered so the service can, if the session needs auth and no valid token is available, ask the desktop app to broker a PAT: requestPat writes REQUEST_PAT and the reply (PAT <token> or PAT_ERROR <message>) drives patReceived / patRequestFailed. The service calls finishExchange to close the socket once the handshake is done.

sessionDiscovered

A pyqtSignal emitted by instances of the class.

patReceived

A pyqtSignal emitted by instances of the class.

patRequestFailed

A pyqtSignal emitted by instances of the class.

__init__(db_path: str | None = None, instance_id: str | None = None, parent=None)
start()

Register this instance and begin heartbeating.

stop()

Deregister this instance and stop heartbeating.

requestPat()

Ask the desktop app to broker a PAT over the open socket.

Emits patReceived on success or patRequestFailed if the desktop app cannot mint one (or does not answer in time).

finishExchange()

Close the desktop socket once the session/PAT handshake is done.