Metadata-Version: 2.4
Name: conductor-lab
Version: 0.1.2
Summary: Standalone Conductor jump-host agent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: cryptography==50.0.1
Requires-Dist: pydantic==2.12.5
Requires-Dist: grpcio<2,>=1.81.1
Requires-Dist: protobuf<7,>=6.33.5
Requires-Dist: pyyaml<7,>=6.0.3
Requires-Dist: keyring<26,>=25.6
Requires-Dist: websockets<16,>=15
Requires-Dist: qubic-queue==0.1.0

# Conductor lab client

Conductor is the lightweight jump-host client for Control's lab-agent API. Lab
forwards come from the lab configuration loaded in Control. The agent sends
heartbeats, connects to those configured endpoints when authorized by a signed
job grant, and reports read-only endpoint health. It does not enumerate
instruments or change lab configuration.

The client uses Python 3.12, standard-library HTTP/TCP clients, PyYAML, and the
maintained adapter packages; it does not install Control's scientific stack.

For installation, device-code approval, and
troubleshooting, follow the [lab client setup guide](../docs/lab-client-setup.md).
See [lab access](../docs/lab-access.md) for ownership and the coordinated
schema/client cutover, and [instrument connections](../docs/instrument-connections.md)
for worker routing.

## Install and log in

Install the approved tag with its dependency constraints using the
[release installation guide](../docs/release-pipeline.md#install-and-upgrade-the-tagged-cli),
then authenticate in the browser:

```shell
conductor login
```

The default target is production at
`https://control.conductorquantum.com`. Login enrolls the lab on the queue
transport and starts the agent in the foreground. On a headless host, open
the printed URL on another device. If `conductor` is not on `PATH`, run
`uv tool update-shell` and reopen the terminal.

## Commands

| Command | Purpose |
| --- | --- |
| `conductor lab` / `login --profile lab` | Open browser enrollment, choose configuration, and automatically install/start its services |
| `conductor logout` | Clear the saved login |
| `conductor lab connect` | Connect this computer to a lab |
| `conductor lab status` | Send one heartbeat and display lab status |
| `conductor lab switch` | Authenticate to a lab and start the agent |
| `conductor lab gateway-credential set CONNECTION` | Store a queue lab's OPX gateway credential in the OS keychain, read without echo from a prompt or standard input |
| `conductor start` | Run the lab heartbeat and configured-forward agent |
| `conductor connections` | List the lab's configured forwards and the ID that `lab gateway-credential set` takes |

Use `conductor COMMAND --help` for options. Select a production, staging, or
local target with the corresponding executable or `--target`. The separate
user profile is available with `--profile user`; lab and user credentials are
stored independently.

## Agent behavior

Heartbeats contain the local hostname and Conductor version. At each forwards
refresh, the agent lists the lab's configured forwards, reconciles grant-gated
TCP listeners, and checks the configured endpoints in a bounded background
worker. Health reports contain only the forward ID, health value, a short
health message, and the port the forward listens on (null when it has none).
A forward listens on its instrument's port. When Linux refuses a port below 1024
to a non-root agent, the forward listens on the port plus 10000 instead and
reports that port, which the server checks before the worker dials it. Probes are read-only and never update forward or configuration
data. If a lab has no configured forwards, Conductor logs:

```text
No connections are configured for this lab; load a configuration in Control.
```

Keep the foreground terminal open, or use service supervision for unattended
operation. `Ctrl-C` shuts down listeners and preserves the login.

## Development and verification

From `conductor/`:

```shell
uv sync
uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run pytest
```

The package is also covered by the repository's Bazel targets:
`//conductor:pytest`, `//conductor:ruff`, `//conductor:format`, and
`//conductor:mypy`.

Configured endpoints carry one stable YAML `connection_id`. Use `connections`
to list them. `instruments forwards`, `start --private-network`, the `network` command
and the `--network-client`/`--network-socket` options are rejected. `lab connect`,
`lab status` and `lab switch` retain their connection/profile behavior.

## Maintained instrument packages

`conductor lab` or `conductor login --profile lab` opens browser enrollment. Choose the
configuration and approve applying it; Conductor verifies, installs, starts and supervises its
private gRPC services automatically. Fresh health reports turn configured sources green.
Slow installation runs separately from heartbeats and grant checks. One connection's
installation failure does not stop another healthy service. Busy health is reported
as unknown and does not restart a live child or interrupt its authorized streams.
`packages plan`, `packages approve` and `packages sync` remain advanced diagnostics; the
normal enrollment flow requires no package commands. Signed job grants remain required. See the
[package delivery guide](../docs/instrument-packages.md) for host requirements, release trust,
upgrade/rollback and hardware acceptance.

For customer development and production handoff, follow
[customer lab onboarding](../docs/customer-lab-onboarding.md). It covers adapter
development over tailnet SSH, installing CLI wheels for the lab profile, automatic adapter delivery, release promotion,
lab invitations and calibration developers' separate user profiles.

Family metadata is generated from the [Control registrations](../control/src/control/config/families/README.md) and packaged as `conductor_lab/families.json`.
