Space Works · Developers
Build an adapter in another repository
Vendor adapters (Bambu, Prusa, OctoPrint, Klipper, a laser or CNC controller, a shelf pointer, a door lock) never live in this repository. They speak only the contract in this folder.
Recommended layout
my-adapter/
adapter/ # your code: one module per vendor protocol
schemas/ # a copy of docs/device-adapters/schemas/*.json (validate before sending)
config.example.toml # SpaceWorks URL, device id, key path, bindings (external_ref -> vendor id)
tests/ # the conformance run below, in CI against a dev server
The loop
- Enroll once (authentication). Keep the private key on the bridge, readable by the adapter only.
helloon start with youradapter_kindand the capabilities you really implement. Readbindings.- Every
poll_seconds:POST statusfor each binding (state, progress, error codes),POST commands/leaseand execute what you get, thenPOST commands/{id}/ack. Sendeventsas things happen, with a freshoperation_idper event (retry the same one until it answers). - Re-read
GET bindingswhen theconfig_versionin a response changes. - Never decide on your own. Access and session decisions come from SpaceWorks (
access/authorize,sessions/start); adeniednever alters a running session; if the server is unreachable, fail closed. - Keep vendor credentials (printer API keys, door codes) on the bridge. SpaceWorks never asks for them.
Prove it: the conformance kit
backend/tests/adapter_conformance/ contains a signed client, a mock adapter and the checks (hello, bindings, status
idempotency and validation, event idempotency, undeclared-capability refusal, replay and stale-timestamp refusal,
command lease and ack) plus the contract rails in rails.py (unsigned and tampered requests, strict bodies, ids
that are not yours, typed refusals across the job, kiosk, media, session, usage and config routes). Against a dev
server:
# in the SpaceWorks repo, from backend/
python -I -m tests.adapter_conformance.run --url https://dev.example \
--device <device uuid> --key-version 1 --private-key <base64 raw key> --binding <binding uuid> --expect-command
Prepare the space: switch machines.integrations on, enroll an adapter (kind: "adapter"), bind a machine with
events and control, and (for --expect-command) queue one control/pause command from the console. Exit code 0
means every check passed. The kit imports only apps.devices.protocol and apps.ed25519 (stdlib and
cryptography); re-implement those few lines in your language from the protocol vectors.
Rules your adapter must keep
- Poses, locations and boxes are staff data; never show them to members.
- Never record or forward video unless a watch session is open; never persist frames.
- Treat
404as "not available",401as "re-sign",403as "stop".
From SpaceWorks/docs/device-adapters/build-an-adapter.md at c447a11, updated 2026-11-16. Suggest a change