lockwire 0.2.6__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. {lockwire-0.2.6 → lockwire-0.2.8}/PKG-INFO +17 -15
  2. {lockwire-0.2.6 → lockwire-0.2.8}/README.md +10 -5
  3. {lockwire-0.2.6 → lockwire-0.2.8}/pyproject.toml +18 -53
  4. lockwire-0.2.8/src/lockwire/__init__.py +46 -0
  5. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/__main__.py +2 -2
  6. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/agent_setup.py +30 -10
  7. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/api.py +23 -4
  8. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/api_payload.py +52 -0
  9. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/catalog.py +110 -7
  10. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/catalog_robots.yaml +48 -0
  11. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/catalog_seed.yaml +206 -0
  12. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/checks.py +1301 -173
  13. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/cli.py +460 -64
  14. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/edit.py +25 -6
  15. lockwire-0.2.8/src/lockwire/examples/arm/contract.yaml +335 -0
  16. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/humanoid/contract.yaml +643 -643
  17. lockwire-0.2.8/src/lockwire/examples/quadruped/contract.yaml +490 -0
  18. lockwire-0.2.8/src/lockwire/examples/rover/contract.yaml +322 -0
  19. lockwire-0.2.8/src/lockwire/examples/servo-bench.yaml +156 -0
  20. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/hook_check.py +7 -3
  21. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/mcp_server.py +135 -15
  22. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/mesh_simple.py +3 -1
  23. lockwire-0.2.8/src/lockwire/mjcf.py +153 -0
  24. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/page.py +17 -5
  25. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/parts_list.py +12 -2
  26. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/plan.py +1 -1
  27. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/plan_payload.py +2 -0
  28. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/plugins.py +11 -0
  29. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/report.py +20 -17
  30. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/report_html.py +1 -1
  31. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/report_json.py +12 -2
  32. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/scene_urdf.py +13 -5
  33. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/schema.py +192 -15
  34. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/serve.py +89 -3
  35. lockwire-0.2.8/src/lockwire/servo_bus.py +240 -0
  36. lockwire-0.2.8/src/lockwire/servo_bus_dxl.py +135 -0
  37. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/start_operation.py +128 -11
  38. lockwire-0.2.8/src/lockwire/swap.py +382 -0
  39. lockwire-0.2.8/src/lockwire/thrust.py +77 -0
  40. lockwire-0.2.8/src/lockwire/thrust_tables.yaml +133 -0
  41. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/urdf.py +157 -33
  42. lockwire-0.2.6/src/lockwire/__init__.py +0 -21
  43. lockwire-0.2.6/src/lockwire/examples/arm/contract.yaml +0 -335
  44. lockwire-0.2.6/src/lockwire/examples/quadruped/contract.yaml +0 -490
  45. lockwire-0.2.6/src/lockwire/examples/rover/contract.yaml +0 -322
  46. lockwire-0.2.6/src/lockwire/examples/servo-bench.yaml +0 -113
  47. lockwire-0.2.6/src/lockwire_pro/__init__.py +0 -0
  48. lockwire-0.2.6/src/lockwire_pro/_ccx_owner.py +0 -72
  49. lockwire-0.2.6/src/lockwire_pro/actuator_case.py +0 -517
  50. lockwire-0.2.6/src/lockwire_pro/analysis.py +0 -4142
  51. lockwire-0.2.6/src/lockwire_pro/api_payload_pro.py +0 -576
  52. lockwire-0.2.6/src/lockwire_pro/api_pro.py +0 -747
  53. lockwire-0.2.6/src/lockwire_pro/baseline.py +0 -1496
  54. lockwire-0.2.6/src/lockwire_pro/cli_pro.py +0 -1243
  55. lockwire-0.2.6/src/lockwire_pro/command_record.py +0 -413
  56. lockwire-0.2.6/src/lockwire_pro/health.py +0 -1441
  57. lockwire-0.2.6/src/lockwire_pro/jobs.py +0 -1713
  58. lockwire-0.2.6/src/lockwire_pro/motion-admission.json +0 -5
  59. lockwire-0.2.6/src/lockwire_pro/observation_bridge.py +0 -284
  60. lockwire-0.2.6/src/lockwire_pro/page_pro.py +0 -166
  61. lockwire-0.2.6/src/lockwire_pro/paid_checks.py +0 -1536
  62. lockwire-0.2.6/src/lockwire_pro/plugin.py +0 -28
  63. lockwire-0.2.6/src/lockwire_pro/preflight/__init__.py +0 -33
  64. lockwire-0.2.6/src/lockwire_pro/preflight/envelopes.py +0 -62
  65. lockwire-0.2.6/src/lockwire_pro/preflight/report.py +0 -53
  66. lockwire-0.2.6/src/lockwire_pro/preflight/report_html.py +0 -280
  67. lockwire-0.2.6/src/lockwire_pro/preflight/runner.py +0 -503
  68. lockwire-0.2.6/src/lockwire_pro/preflight/source.py +0 -613
  69. lockwire-0.2.6/src/lockwire_pro/preflight/stages/__init__.py +0 -6
  70. lockwire-0.2.6/src/lockwire_pro/preflight/stages/command_motion.py +0 -126
  71. lockwire-0.2.6/src/lockwire_pro/preflight/stages/commands.py +0 -323
  72. lockwire-0.2.6/src/lockwire_pro/preflight/stages/coverage.py +0 -62
  73. lockwire-0.2.6/src/lockwire_pro/preflight/stages/cross_record.py +0 -348
  74. lockwire-0.2.6/src/lockwire_pro/preflight/stages/cross_signal.py +0 -321
  75. lockwire-0.2.6/src/lockwire_pro/preflight/stages/enumeration.py +0 -95
  76. lockwire-0.2.6/src/lockwire_pro/preflight/stages/flow.py +0 -759
  77. lockwire-0.2.6/src/lockwire_pro/preflight/stages/liveness.py +0 -132
  78. lockwire-0.2.6/src/lockwire_pro/preflight/stages/sanity.py +0 -484
  79. lockwire-0.2.6/src/lockwire_pro/recording.py +0 -541
  80. lockwire-0.2.6/src/lockwire_pro/ros2bag.py +0 -342
  81. lockwire-0.2.6/src/lockwire_pro/ros2bag_example.py +0 -146
  82. lockwire-0.2.6/src/lockwire_pro/ros2bag_example.yaml +0 -43
  83. lockwire-0.2.6/src/lockwire_pro/sample_local.py +0 -365
  84. lockwire-0.2.6/src/lockwire_pro/sample_remote.py +0 -385
  85. lockwire-0.2.6/src/lockwire_pro/serve_pro.py +0 -597
  86. lockwire-0.2.6/src/lockwire_pro/stats/__init__.py +0 -14
  87. lockwire-0.2.6/src/lockwire_pro/stats/clusters.py +0 -135
  88. lockwire-0.2.6/src/lockwire_pro/stats/cusum.py +0 -218
  89. lockwire-0.2.6/src/lockwire_pro/stats/neff.py +0 -94
  90. lockwire-0.2.6/src/lockwire_pro/stats/wilks.py +0 -215
  91. lockwire-0.2.6/src/lockwire_pro/ulog.py +0 -312
  92. {lockwire-0.2.6 → lockwire-0.2.8}/LICENSE +0 -0
  93. {lockwire-0.2.6 → lockwire-0.2.8}/NOTICE +0 -0
  94. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/_filelock.py +0 -0
  95. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/advice.py +0 -0
  96. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/bench.py +0 -0
  97. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/blame.py +0 -0
  98. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/check_sim.py +0 -0
  99. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/cli_line.py +0 -0
  100. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/confine.py +0 -0
  101. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/constraints.py +0 -0
  102. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/copy.py +0 -0
  103. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/describe.py +0 -0
  104. {lockwire-0.2.6/src/lockwire_pro/stats → lockwire-0.2.8/src/lockwire}/drift.py +0 -0
  105. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/emit_ts.py +0 -0
  106. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/arm/LICENSE +0 -0
  107. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/arm/NOTICE +0 -0
  108. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/arm/plan.yaml +0 -0
  109. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/arm/scene.glb +0 -0
  110. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/arm/starter.json +0 -0
  111. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/drone/contract.yaml +0 -0
  112. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/drone/plan.yaml +0 -0
  113. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/drone/scene.glb +0 -0
  114. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/drone/starter.json +0 -0
  115. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/humanoid/NOTICE +0 -0
  116. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/humanoid/plan.yaml +0 -0
  117. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/humanoid/scene.glb +0 -0
  118. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/humanoid/starter.json +0 -0
  119. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/quadruped/NOTICE +0 -0
  120. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/quadruped/plan.yaml +0 -0
  121. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/quadruped/scene.glb +0 -0
  122. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/quadruped/starter.json +0 -0
  123. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/rover/NOTICE +0 -0
  124. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/rover/plan.yaml +0 -0
  125. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/rover/scene.glb +0 -0
  126. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/examples/rover/starter.json +0 -0
  127. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/export_mhs.py +0 -0
  128. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/factdiff.py +0 -0
  129. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/fieldpath.py +0 -0
  130. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/forces.py +0 -0
  131. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/gitref.py +0 -0
  132. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/hw.py +0 -0
  133. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/mechanism.py +0 -0
  134. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/mesh_dae.py +0 -0
  135. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/review_draft.py +0 -0
  136. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/scan.py +0 -0
  137. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/scene.py +0 -0
  138. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/scene_import.py +0 -0
  139. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/scene_view.py +0 -0
  140. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/sdf.py +0 -0
  141. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/statics.py +0 -0
  142. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/units.py +0 -0
  143. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/vcs.py +0 -0
  144. {lockwire-0.2.6 → lockwire-0.2.8}/src/lockwire/whatif.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lockwire
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: The physical-assumption contract for robots: checks that a robot's declared parts (power, weight, bus, torque) add up
5
5
  Keywords: robotics,urdf,ros,preflight,lockfile,ci,hardware,drone
6
6
  Author: Shivansh
@@ -16,28 +16,25 @@ Classifier: Topic :: Scientific/Engineering
16
16
  Classifier: Topic :: Software Development :: Quality Assurance
17
17
  Classifier: Topic :: Software Development :: Testing
18
18
  Requires-Dist: numpy>=2.5.1
19
- Requires-Dist: pydantic>=2.13.4
19
+ Requires-Dist: pydantic>=2.13.4,<3
20
20
  Requires-Dist: rich>=15.0.0
21
- Requires-Dist: ruamel-yaml>=0.19.1
22
- Requires-Dist: typer>=0.26.8
21
+ Requires-Dist: ruamel-yaml>=0.19.1,<0.20
22
+ Requires-Dist: typer>=0.26.8,<0.29
23
23
  Requires-Dist: xacro>=2.1.1
24
- Requires-Dist: pymavlink==2.4.50 ; extra == 'mavlink'
25
- Requires-Dist: mcp>=2.2.0 ; extra == 'mcp'
24
+ Requires-Dist: pyserial>=3.5 ; extra == 'bus'
25
+ Requires-Dist: mcp>=2.2.0,<3 ; extra == 'mcp'
26
26
  Requires-Dist: pyjwt>=2.15 ; extra == 'mcp'
27
27
  Requires-Dist: robot-descriptions>=3.3.0,<4 ; extra == 'robots'
28
28
  Requires-Dist: xacrodoc>=2.0.1 ; extra == 'robots'
29
- Requires-Dist: mcap>=1.4.0 ; extra == 'ros2bag'
30
- Requires-Dist: mcap-ros2-support>=0.5.7 ; extra == 'ros2bag'
31
29
  Requires-Dist: fastapi>=0.141.1 ; extra == 'serve'
32
30
  Requires-Dist: uvicorn>=0.52.4 ; extra == 'serve'
33
31
  Requires-Python: >=3.12
34
32
  Project-URL: Homepage, https://github.com/Shivansh2703/lockwire
35
33
  Project-URL: Repository, https://github.com/Shivansh2703/lockwire
36
34
  Project-URL: Issues, https://github.com/Shivansh2703/lockwire/issues
37
- Provides-Extra: mavlink
35
+ Provides-Extra: bus
38
36
  Provides-Extra: mcp
39
37
  Provides-Extra: robots
40
- Provides-Extra: ros2bag
41
38
  Provides-Extra: serve
42
39
  Description-Content-Type: text/markdown
43
40
 
@@ -120,15 +117,19 @@ Cursor, Claude Desktop and other agents: [docs/guides/agents.md](docs/guides/age
120
117
 
121
118
  ## No robot file? Try an example
122
119
 
123
- servo-bench is built to fail: a 5 V rail overloaded on purpose, so you can see what a catch looks like.
120
+ servo-bench is built to fail: a 5 V rail overloaded and a wrist servo too weak, on purpose, so you can see what a catch looks like.
124
121
 
125
122
  ```console
126
123
  $ uvx lockwire start --example servo-bench
127
- wrote lockwire.yaml — example servo-bench (built to fail: a 5 V rail overloaded on purpose, so you can see what a catch looks like). Next: uvx lockwire check lockwire.yaml
124
+ wrote lockwire.yaml — example servo-bench (built to fail: a 5 V rail overloaded and a wrist servo too weak, on purpose, so you can see what a catch looks like). Next: uvx lockwire check lockwire.yaml
128
125
  $ uvx lockwire check
126
+ VIOLATION model/joints/wrist/limits/effort — observed 0.40 N*m joint effort limit, expected <= 0.226 N*m, the feetech.scs0009
127
+ stall torque (Δ 1.8x the stall torque)
128
+ ...
129
+ action: ... or find a stronger servo: lockwire swap lockwire.yaml wrist
129
130
  VIOLATION budgets/bud.power.servo-5v — observed 32.10 W, expected <= 15.00 W (Δ +17.10 W (+114%))
130
131
  ...
131
- NO-GO — 1 violation(s), 0 warning(s)
132
+ NO-GO — 2 violation(s), 0 warning(s)
132
133
  ```
133
134
 
134
135
  The five robots (`--example drone`, `rover`, `arm`, `quadruped`, `humanoid`) are clean
@@ -141,8 +142,9 @@ starting points; try your own robot for the catch.
141
142
  - **CI:** the same check on every push, with pull-request annotations and an HTML report.
142
143
  - **Agents:** your AI coding agent runs the same check before it changes the robot.
143
144
 
144
- Everything else (datasheet comparisons, power, torque and bus budgets, ROS 2 bags, the
145
- powered-on preflight gate, the Python library): [the guides](docs/guides/index.md).
145
+ Everything else (datasheet comparisons, power, torque and bus budgets, part swap, the servo
146
+ recorder, drift on a single robot, the Python library): [the guides](docs/guides/index.md). The powered-on
147
+ preflight gate, ROS 2 bags and the drift ledger across units are Lockwire Pro, waitlist only: https://lockwirerobotics.com.
146
148
 
147
149
  ## Download the app
148
150
 
@@ -77,15 +77,19 @@ Cursor, Claude Desktop and other agents: [docs/guides/agents.md](docs/guides/age
77
77
 
78
78
  ## No robot file? Try an example
79
79
 
80
- servo-bench is built to fail: a 5 V rail overloaded on purpose, so you can see what a catch looks like.
80
+ servo-bench is built to fail: a 5 V rail overloaded and a wrist servo too weak, on purpose, so you can see what a catch looks like.
81
81
 
82
82
  ```console
83
83
  $ uvx lockwire start --example servo-bench
84
- wrote lockwire.yaml — example servo-bench (built to fail: a 5 V rail overloaded on purpose, so you can see what a catch looks like). Next: uvx lockwire check lockwire.yaml
84
+ wrote lockwire.yaml — example servo-bench (built to fail: a 5 V rail overloaded and a wrist servo too weak, on purpose, so you can see what a catch looks like). Next: uvx lockwire check lockwire.yaml
85
85
  $ uvx lockwire check
86
+ VIOLATION model/joints/wrist/limits/effort — observed 0.40 N*m joint effort limit, expected <= 0.226 N*m, the feetech.scs0009
87
+ stall torque (Δ 1.8x the stall torque)
88
+ ...
89
+ action: ... or find a stronger servo: lockwire swap lockwire.yaml wrist
86
90
  VIOLATION budgets/bud.power.servo-5v — observed 32.10 W, expected <= 15.00 W (Δ +17.10 W (+114%))
87
91
  ...
88
- NO-GO — 1 violation(s), 0 warning(s)
92
+ NO-GO — 2 violation(s), 0 warning(s)
89
93
  ```
90
94
 
91
95
  The five robots (`--example drone`, `rover`, `arm`, `quadruped`, `humanoid`) are clean
@@ -98,8 +102,9 @@ starting points; try your own robot for the catch.
98
102
  - **CI:** the same check on every push, with pull-request annotations and an HTML report.
99
103
  - **Agents:** your AI coding agent runs the same check before it changes the robot.
100
104
 
101
- Everything else (datasheet comparisons, power, torque and bus budgets, ROS 2 bags, the
102
- powered-on preflight gate, the Python library): [the guides](docs/guides/index.md).
105
+ Everything else (datasheet comparisons, power, torque and bus budgets, part swap, the servo
106
+ recorder, drift on a single robot, the Python library): [the guides](docs/guides/index.md). The powered-on
107
+ preflight gate, ROS 2 bags and the drift ledger across units are Lockwire Pro, waitlist only: https://lockwirerobotics.com.
103
108
 
104
109
  ## Download the app
105
110
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lockwire"
3
- version = "0.2.6"
3
+ version = "0.2.8"
4
4
  description = "The physical-assumption contract for robots: checks that a robot's declared parts (power, weight, bus, torque) add up"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -23,40 +23,26 @@ classifiers = [
23
23
  ]
24
24
  dependencies = [
25
25
  "numpy>=2.5.1",
26
- "pydantic>=2.13.4",
26
+ "pydantic>=2.13.4,<3",
27
27
  "rich>=15.0.0",
28
- "ruamel-yaml>=0.19.1",
29
- "typer>=0.26.8",
28
+ "ruamel-yaml>=0.19.1,<0.20", # 0.x: a minor bump may break the round-trip API
29
+ # typer 0.29 breaks click Argument handling (AttributeError: TyperArgument has no attribute type); lift the cap once the code is fixed
30
+ "typer>=0.26.8,<0.29",
30
31
  "xacro>=2.1.1",
31
32
  ]
32
33
 
33
34
  [project.optional-dependencies]
34
- # Reading real ROS 2 bags. Optional on purpose: a plain install must stay lean
35
- # (the check path deliberately has no scipy), and a team that never touches
36
- # rosbag2 should not carry a decoder.
37
- #
38
- # The load-bearing property is that these need **no ROS installation**:
39
- # `mcap-ros2-support` depends only on `mcap`, which depends only on lz4 and
40
- # zstandard. So `preflight --from run.mcap` works in a bare venv on macOS, which
41
- # is what lets someone try lockwire against a bag they already have without
42
- # installing ROS first.
43
- ros2bag = [
44
- "mcap>=1.4.0",
45
- "mcap-ros2-support>=0.5.7",
35
+ # Reading a Feetech STS/SCS servo bus (`lockwire record-servos`); read-only.
36
+ bus = [
37
+ "pyserial>=3.5",
46
38
  ]
47
- # Protocol admission for observed MAVLink v2 common-dialect frames. The core
48
- # check/CLI path does not import it; field command mapping remains separate.
49
- mavlink = [
50
- "pymavlink==2.4.50",
51
- ]
52
- # Serving lockwire over MCP to an agent. Optional for the same reason as `ros2bag`:
53
- # a plain install must stay lean, and the SDK is only needed by `lockwire mcp`.
39
+ # Serving lockwire over MCP to an agent. Optional: a plain install must stay lean, and the SDK is only needed by `lockwire mcp`.
54
40
  mcp = [
55
- "mcp>=2.2.0",
41
+ "mcp>=2.2.0,<3",
56
42
  "pyjwt>=2.15", # direct floor: a fresh lock must not resolve below the fixed release
57
43
  ]
58
44
  # The Electron app's sidecar: `lockwire serve` over local HTTP. Optional for the
59
- # same reason as `desktop`/`ros2bag`/`mcp` — a plain CLI install stays lean; only the
45
+ # same reason as `mcp` — a plain CLI install stays lean; only the
60
46
  # packaged app build and anyone running the sidecar by hand need these. Versions are
61
47
  # today's PyPI current stable (measured, E1-a).
62
48
  serve = [
@@ -81,31 +67,21 @@ Issues = "https://github.com/Shivansh2703/lockwire/issues"
81
67
  [project.scripts]
82
68
  lockwire = "lockwire:main"
83
69
 
84
- [project.entry-points."lockwire.plugins"]
85
- pro = "lockwire_pro.plugin:register"
86
-
87
70
  [build-system]
88
71
  requires = ["uv_build>=0.11.26,<0.12.0"]
89
72
  build-backend = "uv_build"
90
73
 
91
- # One distribution, two importable packages: the core `lockwire` and `lockwire_pro`, the
92
74
  # plugin with the recording commands (preflight, baseline, health...), loaded via its entry point.
93
75
  [tool.uv.build-backend]
94
- module-name = ["lockwire", "lockwire_pro"]
76
+ module-name = "lockwire"
95
77
 
96
78
  [dependency-groups]
97
79
  dev = [
98
- "mcp>=2.2.0",
99
- # tests/test_ros2bag.py and tests/test_live_samples.py importorskip on this
100
- # decoder. CI's `test` job runs a plain `uv sync --dev` (no extras), so
101
- # without it here those tests silently never ran. Dev-only: the runtime
102
- # `ros2bag` extra above stays optional so a plain install stays lean.
103
- "mcap>=1.4.0",
104
- "mcap-ros2-support>=0.5.7",
105
- # Tests must exercise CRC/dialect admission instead of silently skipping it.
106
- "pymavlink==2.4.50",
80
+ "mcp>=2.2.0,<3",
81
+ # The packaging gate claims `serial` (bus extra); dev env must import it.
82
+ "pyserial>=3.5",
107
83
  # tests/test_serve.py needs the sidecar (`lockwire serve`) importable and
108
- # runnable as a subprocess. Same reasoning as `mcp`/`mcap` above: CI's
84
+ # runnable as a subprocess. Same reasoning as `mcp` above: CI's
109
85
  # `test` job runs a plain `uv sync --dev`, so without these here that
110
86
  # whole test file would silently never run. Dev-only: the runtime `serve`
111
87
  # extra above stays optional so a plain install stays lean.
@@ -140,19 +116,8 @@ line-length = 100
140
116
  "scripts/measure_stacked_gate.py" = ["E402"]
141
117
 
142
118
  [tool.pytest.ini_options]
143
- # `ros/lockwire_ros` is on the path so the ROS package's ROS-free halves
144
- # (`lockwire_ros.core`, `lockwire_ros.diagnostics`) are covered by the ordinary
145
- # suite on any machine. Those two modules hold the fail-closed decision and the
146
- # severity mapping — the parts with judgement in them — and leaving them
147
- # testable only inside a container would mean they were usually untested.
148
- pythonpath = [".", "ros/lockwire_ros"]
149
- # The ROS package's tests live in the ROS package, not in `tests/`, and the
150
- # reason is load-bearing rather than tidiness: they must also run inside a
151
- # Humble container where `lockwire` is deliberately NOT installed, and
152
- # `tests/conftest.py` imports it at collection time. Kept on testpaths so the
153
- # ordinary suite still covers them here. Cases needing rclpy `importorskip` it,
154
- # so they skip off-robot instead of erroring.
155
- testpaths = ["tests", "ros/lockwire_ros/test"]
119
+ pythonpath = ["."]
120
+ testpaths = ["tests"]
156
121
  # chrome: drives real headless Chrome (subprocess spawn). scripts/pytest_slot.sh
157
122
  # excludes this marker from every non-exclusive (targeted) run so workers' test
158
123
  # runs never spawn Chrome processes; the cadence Check (--exclusive) still runs
@@ -0,0 +1,46 @@
1
+ """Lockwire — the physical-assumption contract for robots, enforced in CI and at preflight."""
2
+
3
+ __version__ = "0.2.8"
4
+
5
+
6
+ def main() -> None:
7
+ import sys
8
+
9
+ from lockwire.catalog import PrivatePartsError
10
+ from lockwire.cli import app
11
+ from lockwire.schema import ContractError
12
+
13
+ for stream in (sys.stdout, sys.stderr): # a cp1252 Windows console cannot print Δ, →, ✓
14
+ if hasattr(stream, "reconfigure"):
15
+ stream.reconfigure(errors="replace")
16
+ try:
17
+ app()
18
+ except PrivatePartsError as error: # one line, not a traceback
19
+ from rich.console import Console
20
+ from rich.markup import escape
21
+
22
+ Console(stderr=True).print(f"[red]private parts file broken:[/] {escape(str(error))}")
23
+ sys.exit(2)
24
+ except ContractError as error: # the user's lockfile, not a bug: plain lines, no traceback
25
+ from rich.console import Console
26
+ from rich.markup import escape
27
+
28
+ Console(stderr=True).print(escape(str(error)), soft_wrap=True, highlight=False)
29
+ sys.exit(2)
30
+ except OSError as error: # a file-system problem, not a lockwire bug: one plain line
31
+ from rich.console import Console
32
+ from rich.markup import escape
33
+
34
+ from lockwire.cli import plain_os_error
35
+
36
+ Console(stderr=True).print(escape(plain_os_error(error)), soft_wrap=True, highlight=False)
37
+ sys.exit(2)
38
+ except Exception as error: # a crash is a bug, never a verdict: REFUSED (2), not NO-GO (1)
39
+ from rich.console import Console
40
+ from rich.markup import escape
41
+
42
+ Console(stderr=True).print(
43
+ f"[red]lockwire stopped: {type(error).__name__}: {escape(str(error))} "
44
+ "— this is a bug in lockwire, not a verdict[/]"
45
+ )
46
+ sys.exit(2)
@@ -4,6 +4,6 @@ Exists so ``jobs.py`` can start a run as an argv list against ``sys.executable``
4
4
  without depending on a console script being on PATH.
5
5
  """
6
6
 
7
- from lockwire.cli import app
7
+ import lockwire
8
8
 
9
- app()
9
+ lockwire.main()
@@ -28,7 +28,7 @@ def rules() -> str:
28
28
 
29
29
 
30
30
  PRE_COMMIT = r""" - repo: https://github.com/Shivansh2703/lockwire
31
- rev: v0.2.6
31
+ rev: v0.2.7
32
32
  hooks:
33
33
  - id: lockwire-check
34
34
  files: (?i)(\.(urdf|xacro|sdf)|(^|/)lockwire\.ya?ml)$
@@ -45,15 +45,27 @@ jobs:
45
45
  contract: lockwire.yaml
46
46
  """
47
47
  # $0 is the interpreter. Same gate as plugin/hooks/hook-check.sh: model files only, any case.
48
- GUARD = (
48
+ _GATE = (
49
49
  'p=$(cat); case $(printf %s "$p" | tr "[:upper:]" "[:lower:]") in'
50
50
  ' *.urdf\\"* | *.sdf\\"* | *.xacro\\"* | *lockwire.yaml\\"*) ;; *) exit 0 ;; esac;'
51
- ' [ -x "$0" ] || { echo "lockwire: hook interpreter is gone; re-run lockwire agent-setup'
52
- ' --claude" >&2; exit 2; };'
53
- ' printf %s "$p" | "$0" -m lockwire hook-check && exit 0;'
51
+ )
52
+ _CRASH = (
54
53
  ' [ $? = 2 ] || echo "lockwire hook-check crashed (see above); re-run lockwire agent-setup'
55
54
  ' --claude" >&2; exit 2'
56
55
  )
56
+ GUARD = (
57
+ _GATE
58
+ + ' [ -x "$0" ] || { echo "lockwire: hook interpreter is gone; re-run lockwire agent-setup'
59
+ ' --claude" >&2; exit 2; };'
60
+ ' printf %s "$p" | "$0" -m lockwire hook-check && exit 0;' + _CRASH
61
+ )
62
+ # An interpreter inside uv's cache (uvx) is gone after a cache clean or on a teammate's machine,
63
+ # so name the command instead: `lockwire` on PATH, else `uvx lockwire`.
64
+ GUARD_PORTABLE = (
65
+ _GATE + ' if command -v lockwire >/dev/null; then printf %s "$p" | lockwire hook-check;'
66
+ ' elif command -v uvx >/dev/null; then printf %s "$p" | uvx lockwire hook-check;'
67
+ ' else echo "lockwire: neither lockwire nor uvx is on PATH" >&2; exit 2; fi && exit 0;' + _CRASH
68
+ )
57
69
 
58
70
 
59
71
  def agent_setup(root: Path, *, ci_only: bool = False) -> list[str]:
@@ -63,12 +75,14 @@ def agent_setup(root: Path, *, ci_only: bool = False) -> list[str]:
63
75
  def put(name: str, text: str, *, append: bool = False, head: str = "") -> None:
64
76
  # ponytail: fixed names under root, so no `confine` (it refuses .yaml targets by design).
65
77
  path = root / name
66
- old = path.read_text() if path.exists() else None
78
+ old = path.read_text(encoding="utf-8") if path.exists() else None
67
79
  if old is not None and (not append or text.split("\n")[0] in old):
68
80
  lines.append(f"kept {name}")
69
81
  return
70
82
  path.parent.mkdir(parents=True, exist_ok=True)
71
- path.write_text(head + text if old is None else old.rstrip("\n") + "\n\n" + text)
83
+ path.write_text(
84
+ head + text if old is None else old.rstrip("\n") + "\n\n" + text, encoding="utf-8"
85
+ )
72
86
  lines.append(f"wrote {name}")
73
87
 
74
88
  for name in () if ci_only else ("CLAUDE.md", "AGENTS.md"):
@@ -87,9 +101,15 @@ def claude_hook(root: Path) -> str:
87
101
  install there exits 1, and Claude Code lets an edit through on any exit but 2. GUARD passes
88
102
  other files untouched and turns a gone interpreter (a cleaned uvx cache) or a crash into 2.
89
103
  """
90
- command = cli_line("sh", "-c", GUARD, sys.executable)
104
+ uvx = any(
105
+ p.startswith(("archive-v", "environments-v", "builds-v"))
106
+ for p in Path(sys.executable).parts
107
+ )
108
+ command = (
109
+ cli_line("sh", "-c", GUARD_PORTABLE) if uvx else cli_line("sh", "-c", GUARD, sys.executable)
110
+ )
91
111
  path = root / ".claude" / "settings.json"
92
- settings = json.loads(path.read_text()) if path.exists() else {}
112
+ settings = json.loads(path.read_text(encoding="utf-8")) if path.exists() else {}
93
113
  groups = settings.setdefault("hooks", {}).setdefault("PreToolUse", [])
94
114
  ours = [
95
115
  h
@@ -106,7 +126,7 @@ def claude_hook(root: Path) -> str:
106
126
  {"matcher": "Edit|Write|MultiEdit", "hooks": [{"type": "command", "command": command}]}
107
127
  )
108
128
  path.parent.mkdir(parents=True, exist_ok=True)
109
- path.write_text(json.dumps(settings, indent=2) + "\n")
129
+ path.write_text(json.dumps(settings, indent=2) + "\n", encoding="utf-8")
110
130
  return (
111
131
  f"wrote .claude/settings.json (edit hook: {command}; to remove it, delete the "
112
132
  "PreToolUse entry whose command contains `lockwire hook-check`)"
@@ -76,6 +76,7 @@ from lockwire.report_json import (
76
76
  from lockwire.schema import (
77
77
  ArtifactRef,
78
78
  Contract,
79
+ RobotInfo,
79
80
  UnsupportedSchemaVersion,
80
81
  load_contract,
81
82
  load_contract_bytes,
@@ -563,6 +564,16 @@ def _actuator_check_context(
563
564
  return actuator_evidence, Path(evidence_root), revision
564
565
 
565
566
 
567
+ def defect_document(model_file: Path, error: Exception) -> dict[str, Any]:
568
+ """The check document for a model file with a dup/missing link or joint: NO-GO."""
569
+ from lockwire.start_operation import defect_report # noqa: PLC0415
570
+ from lockwire.urdf import robot_name # noqa: PLC0415
571
+
572
+ return check_document(
573
+ Contract(robot=RobotInfo(name=robot_name(model_file))), defect_report(error)
574
+ )
575
+
576
+
566
577
  def check(
567
578
  contract: Path | str | Contract,
568
579
  *,
@@ -574,6 +585,7 @@ def check(
574
585
  model: str | None = None,
575
586
  model_file: Path | None = None,
576
587
  mass: str | None = None,
588
+ warnings: Iterable[str] = (),
577
589
  ) -> dict[str, Any]:
578
590
  """Record-level checks: the document ``lockwire check --json`` writes.
579
591
 
@@ -609,10 +621,17 @@ def check(
609
621
 
610
622
  rerun_command(findings, rerun)
611
623
  if model_file is not None and path is not None:
612
- from lockwire.start_operation import drop_same_figure, typed_paths # noqa: PLC0415
624
+ from lockwire.start_operation import ( # noqa: PLC0415
625
+ drop_same_figure,
626
+ typed_paths,
627
+ warning_findings,
628
+ zero_if_nothing_compared,
629
+ )
613
630
 
631
+ findings += warning_findings(list(warnings))
614
632
  typed_paths(findings, path, model_file)
615
633
  drop_same_figure(findings, mass)
634
+ zero_if_nothing_compared(findings)
616
635
  return check_document(
617
636
  loaded,
618
637
  findings,
@@ -1175,9 +1194,9 @@ def upgrade(
1175
1194
  if hashlib.sha256(raw).hexdigest() != expected_revision:
1176
1195
  raise ValueError("legacy contract changed since its revision was selected")
1177
1196
  upgraded = upgrade_contract_text(raw.decode("utf-8")).encode("utf-8")
1178
- legacy = load_contract_bytes(raw)
1179
- if legacy.schema_version not in {"0.2", "0.3", "0.4"}:
1180
- raise ValueError("upgrade requires an explicit legacy schema_version 0.2, 0.3 or 0.4")
1197
+ legacy = load_contract_bytes(raw, upgrading=True, name=contract_path.name)
1198
+ if legacy.schema_version not in {"0.2", "0.3", "0.4", "0.5"}:
1199
+ raise ValueError("upgrade requires an explicit legacy schema_version 0.2, 0.3, 0.4 or 0.5")
1181
1200
  load_contract_bytes(upgraded)
1182
1201
  if contract_path.read_bytes() != raw:
1183
1202
  raise ValueError("legacy contract changed during upgrade")
@@ -242,6 +242,15 @@ NUMBER_KINDS: dict[str, dict[str, str]] = {
242
242
  "Counts.not_scored": _build_kind_declaration("derived", "report.verdict"),
243
243
  "MeshGap.missing": _build_kind_declaration("derived", "start_operation._find_meshes"),
244
244
  "MeshGap.total": _build_kind_declaration("derived", "start_operation._find_meshes"),
245
+ # --- Part Swap (the app's swap-preview): catalog servo figures, gravity loads and ratios
246
+ "SwapCandidate.stall_nm": _build_kind_declaration("catalog", "swap.preview", mark="catalog"),
247
+ "SwapCandidate.mass_g": _build_kind_declaration("catalog", "swap.preview", mark="catalog"),
248
+ "SwapCandidate.ratio": _build_kind_declaration("derived", "swap.status"),
249
+ "SwapKnockOn.before_nm": _build_kind_declaration("derived", "checks.gravity_loads"),
250
+ "SwapKnockOn.after_nm": _build_kind_declaration("derived", "checks.gravity_loads"),
251
+ "SwapKnockOn.ratio": _build_kind_declaration("derived", "swap.status"),
252
+ "SwapPreviewPayload.load_nm": _build_kind_declaration("derived", "checks.gravity_loads"),
253
+ "SwapPreviewPayload.delta_g": _build_kind_declaration("derived", "swap.preview"),
245
254
  # --- the Add part picker: a catalog number; its own `kind` field says datasheet or assumed
246
255
  "AddPartNumber.value": _build_kind_declaration(
247
256
  "catalog", "catalog.SourcedNumber", mark="catalog"
@@ -870,6 +879,48 @@ class StartersPayload(_Strict):
870
879
  starters: list[Starter]
871
880
 
872
881
 
882
+ SwapStatus = Literal["fit", "tight", "too weak"]
883
+
884
+
885
+ class SwapCandidate(_Strict):
886
+ """One catalog servo ranked for a joint; ``ratio`` is stall/load, capped at 100."""
887
+
888
+ id: str
889
+ name: str
890
+ label: Literal["cited", "unverified"]
891
+ status: SwapStatus
892
+ stall_nm: float
893
+ ratio: float
894
+ mass_g: float
895
+ flags: list[str]
896
+
897
+
898
+ class SwapKnockOn(_Strict):
899
+ """One joint above the swapped one: load before -> after; no status when its servo
900
+ has no stall torque, no loads when the gravity walk did not score it."""
901
+
902
+ joint: str
903
+ before_nm: float | None
904
+ after_nm: float | None
905
+ status: SwapStatus | None
906
+ was: SwapStatus | None
907
+ ratio: float | None
908
+ dropped: bool
909
+
910
+
911
+ class SwapPreviewPayload(_Strict):
912
+ """The sidecar's ``swap-preview``: ``swap.preview`` for one joint, the knock-on for ``chosen``."""
913
+
914
+ joint: str
915
+ current: str | None
916
+ load_nm: float
917
+ chosen: str | None
918
+ delta_g: float
919
+ candidates: list[SwapCandidate]
920
+ knock_on: list[SwapKnockOn]
921
+ notes: list[str]
922
+
923
+
873
924
  class AcceptedRow(_Strict):
874
925
  """A finding the lockfile accepted on record: the Check panel's muted Accepted rows."""
875
926
 
@@ -1012,6 +1063,7 @@ ALL_MEMBERS: tuple[type[BaseModel], ...] = (
1012
1063
  DeclareFormPayload,
1013
1064
  StartPayload,
1014
1065
  StartersPayload,
1066
+ SwapPreviewPayload,
1015
1067
  )
1016
1068
 
1017
1069