Skip to main content

Crate lm_provision_protocol

Crate lm_provision_protocol 

Source
Expand description

§lm-provision-protocol

The types that cross the license boundary, and nothing else.

The workspace has two sides. The engine — lm-provision, lm-provision-cli, lm-provision-driver, lm-provision-mcp — is dual-licensed MIT / Apache-2.0 and stays that way. The control plane — lm-provision-host, the TTL-enforcement daemon — is AGPL-3.0-or-later. Both sides read and write the same rows, so the vocabulary they share cannot live on either one: a permissive caller may not link the AGPL crate, and moving the AGPL crate’s types into the permissive ones would relicense them by the back door. It lives here, permissive, depended on from both directions.

The license boundary is the crate boundary. That is the only line a compiler can check, which is why the split was cut before the host implementation exists rather than after — relicensing code that has already taken outside contributions needs a CLA or DCO from every contributor.

The shared vocabulary is rows a driver appends and the host will take custody of: the apply-ledger row schema and its JSON Lines encoding (ledger); the acquisitions record (acquisition) — one row per machine bought, one per machine given back, which is what a TTL sweep on either side of the boundary reads to know what is still running; the forwards record (forward) — the detached tunnels this host opened and which of them still exist; and the price record (price) — one row per (platform, model, instant) saying what a token costs there, appended by a sync or by hand, read by the endpoint inventory to put a price beside each endpoint it lists.

Modules§

acquisition
Append-only acquisitions record (09-apply-report-and-ledger.md §Acquisitions record): one row per machine the driver created, in the same JSON Lines shape and with the same discipline as crate::ledger.
forward
The forwards record (09-apply-report-and-ledger.md §Forwards record): what port-forward --detach left running, one row per detached ssh, so that a tunnel handed to the operator as a pid is not lost the moment the terminal that printed it closes.
ledger
Append-only apply ledger (09-apply-report-and-ledger.md §Ledger): one row per driver-collected apply invocation, physically encoded as newline-delimited JSON (JSON Lines) — the ledger owner’s internal choice (09 §Stability: “Ledger physical encoding: internal”, which leaves it open). A dependency-free flat file was chosen over an embedded SQLite table: the row shape is fixed and tiny (four fields, one verbatim JSON blob), the only access patterns are “append one row” and “read every row back”, and a SQL engine buys nothing over that for either.
price
The price record: what one token costs on one (platform, model), as of one instant. Appended by machine prices sync and by hand; read by the endpoint inventory, which joins a row’s price onto the endpoint that serves that model on that platform. (09 §Price record.)