# Wiring Runtime Contract

Wiring configs remain the L0 `wiring_configs` contract described by
`protocol/schemas/wiring-config.schema.json`. The L3 patch-panel runtime applies
one active config and owns cross-box signal propagation.

## Runtime Config

`hwlab-patch-panel` loads a runtime config from `HWLAB_WIRING_CONFIG_PATH` when
the variable is set. The file contains:

- `wiringConfig`: an L0 wiring config object.
- `endpointMap`: an object keyed by `resourceId` with HTTP base URLs for
  writable `hwlab-box-simu` instances.

The service also supports:

- `GET /wiring` for the applied wiring config.
- `GET /status` for L0 patch-panel status plus config/evidence summary.
- `GET /diagnostics` for readable config, endpoint, and sync diagnostics.
- `POST /wiring/apply` to apply an inline runtime config.
- `POST /wiring/reload` to reload `body.path` or `HWLAB_WIRING_CONFIG_PATH`.
- `POST /signals/route` to route one source signal.
- `POST /sync/tick` to route a batch of source signals.

## Supported Sync Families

The minimal L3 runtime supports these directed signal families:

| Source | Target | Value |
| --- | --- | --- |
| `DO*` | `DI*` | boolean |
| `AO*` | `AI*` | number |
| `FREQ_OUT*` | `FREQ_IN*` | number |

Typed signal wiring is directional. For example, `DI1 -> DO1` is rejected with
`source_port_not_output`, and `AO1 -> DI1` is rejected with
`unsupported_signal_wiring`.

Untyped legacy MVP fixture ports such as `uart0` and `gpio0` may still be routed
as recorded deliveries for M1 compatibility, but they are not part of the L3
sync loop.

## Evidence Boundary

This runtime records only config application and evidence summary fields in
`/status` and `/diagnostics`. It does not write tick audit records. Live DEV or
PROD deployment is outside this local runtime contract.
