TransponderDevice contractv1

Build an activity light

Give an agent a physical indicator. When the agent starts working, the lamp lights up. A second indicator shows when a reply is waiting. This first device needs two Bluetooth characteristics and one negotiated capability.

On this page
Your deviceDrives the lights
TransponderPairs and relays state
Selected agentWorks and replies
The phone owns the agent account. The device receives the state of the conversation selected for it.

Before you start

Use a contract-aware Transponder app and a BLE peripheral that supports authenticated LE Secure Connections. Public S3 firmware v27 uses the older handshake. The example below runs on your computer even without either device. Check release compatibility.

Download the builder skill

Unzip transponder-device into your agent’s skills directory. The skill includes the offline guide and test packets.

Download the Embedded Swift library and firmware

The indicator imports TransponderDevice on ESP32-S3 (CESPIDF Xtensa) and ESP32-C6 (Swift.org RISC-V). Includes wiring, build instructions and tests.

Run the first exchange

Download indicator.py and vectors.json into the same folder. Run the example with Python 3. It answers a HELLO, receives a SNAPSHOT across three fragments, and rejects a changed conversation under the same epoch.

python3 indicator.py
Passed identity, negotiation, indicators and malformed-envelope checks.

In the snapshot, the first payload byte is 03. Bit 0 turns on the working light. Bit 1 turns on the unread light. The third fragment completes the message. Before that fragment arrives, neither light should change.

Wire it to a peripheral

  1. Advertise the service. Expose a protected Control read/write characteristic and a notifying Status characteristic. Use a stable eight-byte device ID and a new nonzero nonce on each boot. Copy the UUIDs and properties.
  2. Pair with the owner. Open Add device in Transponder. Let the owner compare the number and confirm the bond using a trusted display and input on the peripheral, or an equivalent authenticated arrangement supported by both ends. A lamp can use a small setup display and button. A blink alone cannot confirm a six-digit comparison.
  3. Connect the callbacks. Return identity() on an authenticated Control read. After the host enables Status notifications, pass each protected Control write to receive(). Split its WELCOME with status_fragments(welcome, value_limit) and notify on Status as your stack allows. The limit is the maximum characteristic value in bytes (usually ATT MTU minus three). On subscription loss or disconnect, call disconnect() and clear the lights. Keep one instance per peer.
  4. Drive the output. After a complete valid snapshot, assign working and unread to your two outputs. Ask the selected agent a question from the app. Watch for the working indication and then the unread reply. Only a text-capable device sends a READ receipt. The lamp follows subsequent snapshots. A fast reply can arrive before the app relays an intermediate working state.

What to look for on the link

  1. App reads deviceControl identity
    16 bytes. The device sets bit 0x10 and offers contract version 1.
  2. App writes ControlHELLO
    The host opens an epoch and offers features for this conversation.
  3. Device notifies StatusWELCOME
    Echo the epoch and context. Return the boot nonce and the agreed presentation bit.
  4. App writes ControlSNAPSHOT
    Assemble the entire payload, check its revision, then update both lights together.
Starting a BLE connection and establishing a usable contract session are separate events. A captured WELCOME with the expected boot nonce and epoch is your first session checkpoint.

If the lamp stays dark

  • No identity read. Check the service UUID, bond and access permissions.
  • HELLO without WELCOME. Confirm the Status subscription, the version intersection and room for the 20-byte header plus data. At ATT MTU 23 the notification value has just 20 bytes. Check framing and fragment size.
  • WELCOME without an indication. Check presentation in the agreed mask, the selected context, and whether a complete current-epoch snapshot arrived.

Choose what to build next

  • A message displayDifferentiate unread replies, agent activity and relay availability. Open a message or browse history.
  • A voice accessoryAdd a microphone, a speaker or both. Follow one turn from button press to delivery.
  • An image displayValidate an attachment before showing it.
  • A changeable faceAccept a small artwork package and preserve the last working face.

For exact packet layouts, dependencies and version rules, use the session reference. For power telemetry and signed firmware, see maintenance and upgrades.