robot-gate 0.2.1__tar.gz → 0.2.3__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 (66) hide show
  1. {robot_gate-0.2.1 → robot_gate-0.2.3}/PKG-INFO +2 -1
  2. {robot_gate-0.2.1 → robot_gate-0.2.3}/ci/run_ci_gate.py +6 -3
  3. {robot_gate-0.2.1 → robot_gate-0.2.3}/pyproject.toml +5 -1
  4. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/__init__.py +1 -1
  5. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/cli.py +230 -43
  6. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/compliance_pack.py +198 -11
  7. robot_gate-0.2.3/src/robot_gate/constants.py +17 -0
  8. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/gate.py +152 -38
  9. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/ros2_adapter.py +12 -1
  10. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/server.py +316 -22
  11. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/ui.py +1024 -17
  12. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_bob_live_controls.py +32 -10
  13. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_bounded_embodiment_bridge.py +3 -1
  14. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_cell_console.py +81 -10
  15. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_cli_e2e.py +87 -4
  16. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_compliance_and_ci.py +12 -2
  17. robot_gate-0.2.3/tests/test_gate_regression.py +218 -0
  18. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_intent_and_mcp.py +16 -3
  19. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_mcp_plugin_v05.py +25 -4
  20. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_microduck_mapper.py +12 -0
  21. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_mujoco_contact_gate.py +5 -3
  22. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_onboard_cli.py +3 -2
  23. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_p1_hardening.py +23 -4
  24. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_ros2_adapter.py +47 -6
  25. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_rust_kernel.py +20 -0
  26. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_server_hard_latch.py +306 -21
  27. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_skillpacks.py +4 -2
  28. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_ux_console_cli.py +100 -1
  29. robot_gate-0.2.1/tests/test_gate_regression.py +0 -104
  30. {robot_gate-0.2.1 → robot_gate-0.2.3}/.gitignore +0 -0
  31. {robot_gate-0.2.1 → robot_gate-0.2.3}/README.md +0 -0
  32. {robot_gate-0.2.1 → robot_gate-0.2.3}/ci/cloudflare-build.sh +0 -0
  33. {robot_gate-0.2.1 → robot_gate-0.2.3}/scripts/build_wheels.sh +0 -0
  34. {robot_gate-0.2.1 → robot_gate-0.2.3}/scripts/capture_bob_ev03_live.py +0 -0
  35. {robot_gate-0.2.1 → robot_gate-0.2.3}/scripts/launch_bob_console.py +0 -0
  36. {robot_gate-0.2.1 → robot_gate-0.2.3}/scripts/run_microduck_live.py +0 -0
  37. {robot_gate-0.2.1 → robot_gate-0.2.3}/scripts/run_set_live_bob.py +0 -0
  38. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/audit.py +0 -0
  39. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/bounded_bridge.py +0 -0
  40. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/device_discovery.py +0 -0
  41. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/fingerprint.py +0 -0
  42. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/intent.py +0 -0
  43. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/manifest.py +0 -0
  44. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/mcp_server.py +0 -0
  45. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/mechanics.py +0 -0
  46. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/microduck_mapper.py +0 -0
  47. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/onboard.py +0 -0
  48. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/semantic_guard.py +0 -0
  49. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/set_kit.py +0 -0
  50. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/shop_swarm.py +0 -0
  51. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/skillpacks.py +0 -0
  52. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/telemetry.py +0 -0
  53. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/trust.py +0 -0
  54. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/vault_client.py +0 -0
  55. {robot_gate-0.2.1 → robot_gate-0.2.3}/src/robot_gate/world_model.py +0 -0
  56. {robot_gate-0.2.1 → robot_gate-0.2.3}/systemd/robot-gate.service +0 -0
  57. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_device_discovery.py +0 -0
  58. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_end_effector_hal.py +0 -0
  59. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_manifest_and_signing.py +0 -0
  60. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_semantic_guard.py +0 -0
  61. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_set_kit.py +0 -0
  62. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_shop_swarm.py +0 -0
  63. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_telemetry_and_mjcf.py +0 -0
  64. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_trust_ladder.py +0 -0
  65. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_vault_client.py +0 -0
  66. {robot_gate-0.2.1 → robot_gate-0.2.3}/tests/test_world_model_fusion.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: robot-gate
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Deterministic on-robot deployment harness, ROS 2 pre-flight boundary interceptor, ISO 10218:2025 / EU 2023/1230 compliance pack generator, and change-triggered regression test gate.
5
5
  Project-URL: Homepage, https://graftrobotics.ai
6
6
  Project-URL: Documentation, https://graftrobotics.ai/docs/
@@ -29,6 +29,7 @@ Requires-Dist: cryptography>=41
29
29
  Requires-Dist: pyyaml>=6.0
30
30
  Provides-Extra: dev
31
31
  Requires-Dist: fastapi>=0.110; extra == 'dev'
32
+ Requires-Dist: graft-core>=0.1.0; extra == 'dev'
32
33
  Requires-Dist: httpx>=0.27; extra == 'dev'
33
34
  Requires-Dist: pillow>=10.0; extra == 'dev'
34
35
  Requires-Dist: pytest>=8.0; extra == 'dev'
@@ -105,7 +105,8 @@ def render_markdown_summary(result: CIGateResult) -> str:
105
105
 
106
106
  if result.stages:
107
107
  for st in result.stages:
108
- st_label = "PASS" if st.get("passed") else "FAIL"
108
+ raw_status = str(st.get("status") or ("PASS" if st.get("passed") else "FAIL")).upper()
109
+ st_label = "NOT_MEASURED (sim_only)" if raw_status == "NOT_MEASURED" else raw_status
109
110
  summary = str(st.get("summary", "")).replace("|", "\\|").replace("\n", " ")
110
111
  lines.append(f"| `{st.get('name', 'unknown')}` | **{st_label}** | {summary} |")
111
112
  else:
@@ -219,6 +220,7 @@ def run_ci_gate(
219
220
  result.stages = [
220
221
  {
221
222
  "name": s.name,
223
+ "status": s.status,
222
224
  "passed": s.passed,
223
225
  "summary": s.summary,
224
226
  "failures": list(s.failures),
@@ -277,7 +279,7 @@ def run_ci_gate(
277
279
  vault_ok = False
278
280
  result.errors.append(f"Fleet Vault push failed: {vault_res.error or vault_res.status}")
279
281
 
280
- result.passed = bool(receipt.passed and pack_ok and vault_ok and len(result.errors) == 0)
282
+ result.passed = bool(receipt.sim_only_passed and pack_ok and vault_ok and len(result.errors) == 0)
281
283
  return result
282
284
 
283
285
 
@@ -378,7 +380,8 @@ def main(argv: list[str] | None = None) -> int:
378
380
  f"fp={result.fingerprint[:12] or 'n/a'}"
379
381
  )
380
382
  for st in result.stages:
381
- mark = "PASS" if st["passed"] else "FAIL"
383
+ raw_status = str(st.get("status") or ("PASS" if st.get("passed") else "FAIL")).upper()
384
+ mark = "NOT_MEASURED" if raw_status == "NOT_MEASURED" else raw_status
382
385
  print(f" [{mark}] {st['name']}: {st['summary']}")
383
386
  for fail in st.get("failures") or []:
384
387
  print(f" -> {fail}")
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "robot-gate"
7
- version = "0.2.1"
7
+ version = "0.2.3"
8
8
  description = "Deterministic on-robot deployment harness, ROS 2 pre-flight boundary interceptor, ISO 10218:2025 / EU 2023/1230 compliance pack generator, and change-triggered regression test gate."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -72,6 +72,7 @@ dev = [
72
72
  "fastapi>=0.110",
73
73
  "uvicorn>=0.27",
74
74
  "Pillow>=10.0",
75
+ "graft-core>=0.1.0",
75
76
  ]
76
77
 
77
78
  [project.scripts]
@@ -100,3 +101,6 @@ exclude = [
100
101
  [tool.pytest.ini_options]
101
102
  testpaths = ["tests"]
102
103
  addopts = "-ra"
104
+ markers = [
105
+ "rust_kernel: requires compiled graft_core Rust PyO3 extension (enforced when GRAFT_REQUIRE_RUST_KERNEL=1)",
106
+ ]
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "0.2.1"
5
+ __version__ = "0.2.3"
6
6
 
7
7
  SAFETY_BOUNDARY_STATEMENT = (
8
8
  "robot-gate and robot-md-gateway provide a deterministic, default-deny software "
@@ -2,7 +2,7 @@
2
2
 
3
3
  Commands:
4
4
  robot-gate init Scaffold ROBOT.md, gate.yaml, optional Ed25519 keys, and baseline profile
5
- robot-gate connect 3-click LLM-to-Robot connect kit (connect-graft.sh, AI client config, ROBOT.md, FIRST_PROMPT.md)
5
+ robot-gate connect Generate MCP/ROS 2 client integration kit (connect-graft.sh, AI client config, ROBOT.md, FIRST_PROMPT.md)
6
6
  robot-gate onboard Guided offline self-serve onboarding wizard (6 personas incl. ros2, ROBOT.md v1.1, L0 self-test)
7
7
  robot-gate demo 1-command local demo (Graft Cell Console or `--ros2` zero-ROS-install ROS 2 + compliance demo)
8
8
  robot-gate set Safe L0_OBSERVE RoboCurve Six Easy Tasks (SET) verification & portable bundle export
@@ -23,6 +23,7 @@ from __future__ import annotations
23
23
 
24
24
  import argparse
25
25
  import json
26
+ import re
26
27
  import shlex
27
28
  import stat
28
29
  import sys
@@ -35,6 +36,14 @@ from pathlib import Path
35
36
 
36
37
  import yaml
37
38
 
39
+ from .constants import (
40
+ DEFAULT_CONSOLE_PORT,
41
+ DEFAULT_OLLAMA_MODEL,
42
+ DEFAULT_OLLAMA_PORT,
43
+ DEFAULT_WATCHDOG_PORT,
44
+ DOCS_DENY_CODE_BASE_URL,
45
+ )
46
+
38
47
 
39
48
  def _c(text: str, code: str) -> str:
40
49
  if not sys.stdout.isatty():
@@ -46,7 +55,7 @@ def _print_next_actions_footer(root: Path | str | None = None) -> None:
46
55
  """Print guided 3-step next-actions footer (strictly suppressed under --json)."""
47
56
  root_str = str(root) if root is not None else "."
48
57
  print("\nNext Actions:")
49
- print(f' 1. robot-gate serve --dir "{root_str}" --port 8785 --open')
58
+ print(f' 1. robot-gate serve --dir "{root_str}" --port {DEFAULT_CONSOLE_PORT} --open')
50
59
  print(" 2. robot-gate connect --client claude --robot ur5e --env industrial")
51
60
  print(
52
61
  " 3. https://graftrobotics.ai/vault/?demo=1 (1-click Demo Fleet) · "
@@ -86,12 +95,14 @@ from . import SAFETY_BOUNDARY_STATEMENT, __version__
86
95
  from .audit import verify_audit_chain
87
96
  from .bounded_bridge import (
88
97
  build_envelope_doc,
98
+ rust_kernel_active,
89
99
  sign_envelope_doc,
90
100
  validate_envelope_doc,
91
101
  verify_bounded_report_dir,
92
102
  )
93
103
  from .compliance_pack import (
94
104
  DEFAULT_ZIP_FILENAME,
105
+ explain_incomplete_controls,
95
106
  generate_compliance_pack,
96
107
  verify_compliance_pack,
97
108
  )
@@ -216,6 +227,22 @@ def _cmd_snapshot(args: argparse.Namespace) -> int:
216
227
  return 0
217
228
 
218
229
 
230
+ _KNOWN_REASON_CODE_RE = re.compile(
231
+ r"\b("
232
+ r"KEEPOUT_VIOLATION|WORKSPACE_VIOLATION|NON_FINITE_COMMAND|"
233
+ r"TWIST_LINEAR_VELOCITY_EXCEEDED|TWIST_ANGULAR_VELOCITY_EXCEEDED|"
234
+ r"FORCE_LIMIT_EXCEEDED|VELOCITY_LIMIT_EXCEEDED|JOINT_VELOCITY_EXCEEDED|"
235
+ r"L0_OBSERVE_SHADOW_DENY|SOFTWARE_ESTOP_LATCHED|FRAME_MISMATCH|"
236
+ r"TOOL_NOT_ALLOWED|EMPTY_TRAJECTORY|EMPTY_WAYPOINTS|FK_EVALUATION_FAILED|"
237
+ r"FK_REQUIRED|INVALID_ENVELOPE_BOX|INVALID_TRAJECTORY_TIMING|MALFORMED_TRAJECTORY"
238
+ r")\b"
239
+ )
240
+
241
+
242
+ def _docs_url_for_reason_code(reason_code: str) -> str:
243
+ return f"{DOCS_DENY_CODE_BASE_URL}{reason_code.strip()}"
244
+
245
+
219
246
  def _cmd_check(args: argparse.Namespace) -> int:
220
247
  t0 = time.perf_counter()
221
248
  root = Path(args.dir).resolve()
@@ -226,22 +253,42 @@ def _cmd_check(args: argparse.Namespace) -> int:
226
253
 
227
254
  receipt = run_gate_check(root, cfg, telemetry_provider=provider, sim_only=args.sim_only)
228
255
  elapsed_ms = int((time.perf_counter() - t0) * 1000)
256
+ ok_exit = receipt.sim_only_passed if args.sim_only else receipt.passed
229
257
 
230
258
  if args.json:
231
259
  print(json.dumps(receipt.to_dict(), indent=2))
232
260
  else:
233
- status = _c("PASS", "32;1") if receipt.passed else _c("FAIL", "31;1")
234
- print(
235
- f"robot-gate check: {status} "
236
- f"(embodiment={receipt.embodiment}, fp={receipt.fingerprint[:12]}, {elapsed_ms}ms)"
237
- )
261
+ if receipt.passed:
262
+ status = _c("PASS", "32;1")
263
+ print(
264
+ f"robot-gate check: {status} "
265
+ f"(embodiment={receipt.embodiment}, fp={receipt.fingerprint[:12]}, {elapsed_ms}ms)"
266
+ )
267
+ elif args.sim_only and receipt.sim_only_passed:
268
+ status = _c("PRE-FLIGHT SIM OK", "33;1")
269
+ print(
270
+ f"robot-gate check: {status} "
271
+ f"(Stage 2 hardware_drift: NOT_MEASURED — run with --live before arming physical actuators)"
272
+ )
273
+ print(f" (embodiment={receipt.embodiment}, fp={receipt.fingerprint[:12]}, {elapsed_ms}ms)")
274
+ else:
275
+ status = _c("FAIL", "31;1")
276
+ print(
277
+ f"robot-gate check: {status} "
278
+ f"(embodiment={receipt.embodiment}, fp={receipt.fingerprint[:12]}, {elapsed_ms}ms)"
279
+ )
238
280
  for s in receipt.stages:
239
- mark = _c("PASS", "32") if s.passed else _c("FAIL", "31")
281
+ if s.status == "PASS":
282
+ mark = _c("PASS", "32")
283
+ elif s.status == "NOT_MEASURED":
284
+ mark = _c("NOT_MEASURED", "33")
285
+ else:
286
+ mark = _c("FAIL", "31")
240
287
  print(f" [{mark}] {s.name:20s} — {s.summary}")
241
288
  for fail in s.failures:
242
289
  print(f" -> {_c(fail, '31')}")
243
290
  print(f"Receipt ({receipt.signature_alg}): {root / cfg.receipt_path}")
244
- return 0 if receipt.passed else 1
291
+ return 0 if ok_exit else 1
245
292
 
246
293
 
247
294
  def _cmd_why(args: argparse.Namespace) -> int:
@@ -252,22 +299,65 @@ def _cmd_why(args: argparse.Namespace) -> int:
252
299
  print("No gate_receipt.json found yet. Run `robot-gate check` first.", file=sys.stderr)
253
300
  return 1
254
301
  receipt = GateReceipt.load(receipt_path)
255
- print(f"Last receipt: {'PASS' if receipt.passed else 'FAIL'} at {receipt.ts_utc} (fp={receipt.fingerprint[:12]})")
302
+ if receipt.passed:
303
+ status_text = "PASS"
304
+ elif receipt.sim_only_passed:
305
+ status_text = "PRE-FLIGHT SIM OK (Stage 2 hardware_drift: NOT_MEASURED)"
306
+ else:
307
+ status_text = "FAIL"
308
+ print(f"Last receipt: {status_text} at {receipt.ts_utc} (fp={receipt.fingerprint[:12]})")
256
309
  diff = receipt.fingerprint_diff
257
310
  if any(diff.get(k) for k in ("added", "removed", "changed")):
258
311
  print("Changes since prior receipt:")
259
312
  for k in ("added", "changed", "removed"):
260
313
  if diff.get(k):
261
314
  print(f" {k}: {', '.join(diff[k])}")
262
- failed = [s for s in receipt.stages if not s.passed]
263
- if not failed:
315
+
316
+ hw_status = receipt.stage_status("hardware_drift")
317
+ if hw_status == "NOT_MEASURED":
318
+ print("Stage 2 hardware_drift: NOT_MEASURED — run with --live before arming physical hardware")
319
+
320
+ failed = [s for s in receipt.stages if s.status == "FAIL"]
321
+ if not failed and receipt.passed:
264
322
  print("All 4 gate stages passed.")
323
+ elif not failed and hw_status == "NOT_MEASURED":
324
+ print("Stages 1, 3, and 4 passed; hardware telemetry verification is still required before live actuation.")
265
325
  else:
266
326
  print("Blocking failures:")
267
327
  for s in failed:
268
328
  print(f" [{s.name}]")
269
329
  for f in s.failures:
270
- print(f" - {f}")
330
+ match = _KNOWN_REASON_CODE_RE.search(f)
331
+ if match:
332
+ code = match.group(1)
333
+ print(f" - {f} (Docs: {_docs_url_for_reason_code(code)})")
334
+ else:
335
+ print(f" - {f}")
336
+
337
+ # Inspect recent audit denials to surface reason_code + exact docs URL
338
+ audit_path = root / cfg.audit_path
339
+ if audit_path.is_file():
340
+ recent_denies: list[tuple[str, str, str]] = []
341
+ for line in audit_path.read_text(encoding="utf-8").splitlines()[-50:]:
342
+ if not line.strip():
343
+ continue
344
+ try:
345
+ rec = json.loads(line)
346
+ except json.JSONDecodeError:
347
+ continue
348
+ if str(rec.get("decision", "")).upper() != "DENY":
349
+ continue
350
+ details = rec.get("details") or {}
351
+ rc = str(details.get("reason_code") or "").strip()
352
+ if rc:
353
+ reason = str(details.get("reason") or rec.get("event") or "")
354
+ recent_denies.append((str(rec.get("ts", "")), rc, reason))
355
+ if recent_denies:
356
+ print("Recent denied commands:")
357
+ for ts, rc, reason in recent_denies[-5:]:
358
+ suffix = f" — {reason}" if reason else ""
359
+ print(f" [{ts}] {rc}{suffix} | Docs: {_docs_url_for_reason_code(rc)}")
360
+
271
361
  return 0 if receipt.passed else 1
272
362
 
273
363
 
@@ -347,6 +437,8 @@ def _render_systemd_unit(
347
437
  f"{user_line}"
348
438
  f"WorkingDirectory={ws_str}\n"
349
439
  "Environment=PYTHONDONTWRITEBYTECODE=1\n"
440
+ "# Optional isolated Ed25519 key custody (recommended in production, chmod 0400):\n"
441
+ "# Environment=GRAFT_SIGNING_KEY_PATH=/etc/robot-gate/keys/robot_gate.key.pem\n"
350
442
  "# Run 4-stage deterministic pre-flight gate before starting harness (fails closed on non-zero)\n"
351
443
  f'ExecStartPre=/usr/bin/env robot-gate check --dir "{ws_str}" --sim-only\n'
352
444
  f'ExecStart=/usr/bin/env robot-gate serve --dir "{ws_str}" --host {host} --port {int(port)}\n'
@@ -440,13 +532,17 @@ def _cmd_serve(args: argparse.Namespace) -> int:
440
532
  def _run_ros2_zero_install_demo(args: argparse.Namespace) -> int:
441
533
  """<10s zero-ROS-install demo: signed UR5e -> 4-stage gate -> ROS 2 stream -> compliance pack."""
442
534
  t0 = time.perf_counter()
443
- if args.dir:
535
+ if getattr(args, "tmp", False):
536
+ root = Path(tempfile.mkdtemp(prefix="graft-ros2-demo-")).resolve()
537
+ temp_created = True
538
+ elif args.dir:
444
539
  root = Path(args.dir).resolve()
445
540
  root.mkdir(parents=True, exist_ok=True)
446
541
  temp_created = False
447
542
  else:
448
- root = Path(tempfile.mkdtemp(prefix="graft-ros2-demo-")).resolve()
449
- temp_created = True
543
+ root = Path("./graft-demo").resolve()
544
+ root.mkdir(parents=True, exist_ok=True)
545
+ temp_created = False
450
546
 
451
547
  emb_name = "ur5e"
452
548
  organization = "Graft Robotics ROS 2 Demo"
@@ -523,11 +619,42 @@ def _run_ros2_zero_install_demo(args: argparse.Namespace) -> int:
523
619
  signed_env, _ = sign_envelope_doc(env_doc, priv)
524
620
  (root / "envelope.json").write_text(json.dumps(signed_env, indent=2) + "\n", encoding="utf-8")
525
621
 
622
+ # Scaffold minimal bounded YAML skill so ai_self_evolving_behavior_bounding is PASS (8/8 controls)
623
+ skills_dir = root / "skills"
624
+ skills_dir.mkdir(parents=True, exist_ok=True)
625
+ demo_skill_path = skills_dir / "demo_ur5e_vise_pick.yaml"
626
+ demo_skill_doc = {
627
+ "skill": "demo_ur5e_vise_pick",
628
+ "embodiment": emb_name,
629
+ "trust_level": "L1_ATOMIC_ASSIST",
630
+ "description": "Bounded UR5e vise pick demo skill clearing cnc_spindle_head and operator_front_aisle",
631
+ "steps": [
632
+ {
633
+ "name": "approach_vise_clear",
634
+ "tool": "arm.move_bounded",
635
+ "target_xyz_m": [0.10, 0.00, 0.35],
636
+ "velocity_mps": 0.12,
637
+ "force_n": 15.0,
638
+ },
639
+ {
640
+ "name": "grasp_workpiece",
641
+ "tool": "tool.grip",
642
+ "max_force_n": 25.0,
643
+ },
644
+ ],
645
+ }
646
+ demo_skill_path.write_text(yaml.safe_dump(demo_skill_doc, sort_keys=False), encoding="utf-8")
647
+
526
648
  # 2. Run 4-stage deterministic gate check (latches Ed25519-signed gate_receipt.json)
527
649
  receipt = run_gate_check(root, cfg, sim_only=True)
528
650
 
529
651
  # 3. Feed realistic ROS 2 mock command stream through ROS2BoundaryGate (ZERO rclpy required!)
530
- gate = ROS2BoundaryGate(root, embodiment=emb_name, expected_frame_id="base_link")
652
+ gate = ROS2BoundaryGate(
653
+ root,
654
+ embodiment=emb_name,
655
+ expected_frame_id="base_link",
656
+ allow_sim_only_receipt=True,
657
+ )
531
658
  stream_results: list[dict[str, object]] = []
532
659
 
533
660
  # 3a. L0_OBSERVE shadow block (cell starts safely at L0_OBSERVE: 0% physical republish)
@@ -675,7 +802,7 @@ def _run_ros2_zero_install_demo(args: argparse.Namespace) -> int:
675
802
  elapsed_ms = int((time.perf_counter() - t0) * 1000)
676
803
  stream_all_matched = all(bool(item["matched"]) for item in stream_results)
677
804
  overall_passed = bool(
678
- receipt.passed and promoted and stream_all_matched and audit_res.valid and verify_res.valid
805
+ receipt.sim_only_passed and promoted and stream_all_matched and audit_res.valid and verify_res.valid
679
806
  )
680
807
 
681
808
  payload: dict[str, object] = {
@@ -690,10 +817,12 @@ def _run_ros2_zero_install_demo(args: argparse.Namespace) -> int:
690
817
  "trust_promotion": {"promoted_to": "L1_ATOMIC_ASSIST", "ok": promoted, "detail": promo_msg},
691
818
  "gate_check": {
692
819
  "passed": receipt.passed,
820
+ "sim_only_passed": receipt.sim_only_passed,
693
821
  "fingerprint": receipt.fingerprint,
694
822
  "signature_alg": receipt.signature_alg,
695
823
  "stages": [
696
- {"name": s.name, "passed": s.passed, "summary": s.summary} for s in receipt.stages
824
+ {"name": s.name, "status": s.status, "passed": s.passed, "summary": s.summary}
825
+ for s in receipt.stages
697
826
  ],
698
827
  },
699
828
  "ros2_stream": stream_results,
@@ -712,33 +841,51 @@ def _run_ros2_zero_install_demo(args: argparse.Namespace) -> int:
712
841
  print(json.dumps(payload, indent=2))
713
842
  else:
714
843
  status_lbl = _c("PASS", "32;1") if overall_passed else _c("FAIL", "31;1")
844
+ gate_lbl = (
845
+ "PASS"
846
+ if receipt.passed
847
+ else ("PRE-FLIGHT SIM OK (Stage 2 hardware_drift: NOT_MEASURED)" if receipt.sim_only_passed else "FAIL")
848
+ )
715
849
  print("=" * 76)
716
850
  print(f" Graft Robotics — Zero-ROS-Install Demo (`robot-gate demo --ros2`): {status_lbl}")
717
851
  print(f" Workspace : {root} (UR5e, 0 ROS 2 / 0 hardware required, {elapsed_ms} ms)")
718
852
  print("=" * 76)
719
853
  print(
720
854
  f" [1/4] Signed ROBOT.md + envelope.json & 4-stage gate : "
721
- f"{'PASS' if receipt.passed else 'FAIL'} (fp={receipt.fingerprint[:12]}, {receipt.signature_alg})"
855
+ f"{gate_lbl} (fp={receipt.fingerprint[:12]}, {receipt.signature_alg})"
722
856
  )
723
857
  print(" [2/4] ROS 2 Mock Command Stream via ROS2BoundaryGate:")
724
858
  for item in stream_results:
725
859
  v = item["verdict"]
726
860
  assert isinstance(v, dict)
727
861
  mark = _c("OK", "32") if item["matched"] else _c("ERR", "31")
862
+ docs_suffix = (
863
+ f" | Docs: {_docs_url_for_reason_code(str(v['reason_code']))}"
864
+ if v.get("decision") == "DENY" and v.get("reason_code")
865
+ else ""
866
+ )
728
867
  print(
729
868
  f" [{mark}] {str(item['scenario']):28s} -> {v['decision']:5s} "
730
- f"({v['reason_code']}, republish={v['republish_allowed']}, kernel={v['kernel']})"
869
+ f"({v['reason_code']}, republish={v['republish_allowed']}, kernel={v['kernel']}){docs_suffix}"
731
870
  )
732
871
  print(
733
872
  f" [3/4] SHA-256 Audit Ledger Verification : "
734
873
  f"{'INTACT' if audit_res.valid else 'TAMPERED'} ({audit_res.record_count} records, head={audit_res.head_hash[:16]})"
735
874
  )
875
+ ev_label = str(pack.manifest.get("evidence_status_label", pack.overall_status))
736
876
  print(
737
877
  f" [4/4] ISO 10218:2025 / EU 2023/1230 Compliance Pack : "
738
- f"{'VERIFIED' if verify_res.valid else 'FAILED'} ({pack.overall_status} · {pack.readiness_score_pct}%, "
878
+ f"{'VERIFIED' if verify_res.valid else 'FAILED'} ({ev_label} · {pack.overall_status} · {pack.readiness_score_pct}%, "
739
879
  f"{verify_res.files_verified} files verified, 0 private keys)"
740
880
  )
881
+ incomplete = explain_incomplete_controls(pack.manifest)
882
+ for ctrl_name, ctrl_status, reason in incomplete:
883
+ print(f" [{ctrl_status}] {ctrl_name}: {reason}")
741
884
  print(f" ZIP archive : {pack.zip_path}")
885
+ if not rust_kernel_active():
886
+ print(
887
+ " Tip: run 'uvx --with graft-core robot-gate demo --ros2' to enable the 1.96 µs Rust slab kernel."
888
+ )
742
889
  print(f" Safety Boundary: {SAFETY_BOUNDARY_STATEMENT}")
743
890
  print("-" * 76)
744
891
  for line in _render_ros2_demo_workspace_map():
@@ -751,7 +898,7 @@ def _run_ros2_zero_install_demo(args: argparse.Namespace) -> int:
751
898
  argparse.Namespace(
752
899
  dir=str(root),
753
900
  host=getattr(args, "host", "127.0.0.1"),
754
- port=getattr(args, "port", 8785),
901
+ port=getattr(args, "port", DEFAULT_CONSOLE_PORT),
755
902
  open=bool(getattr(args, "open", False)),
756
903
  )
757
904
  )
@@ -1133,6 +1280,7 @@ def _cmd_ros2_bridge(args: argparse.Namespace) -> int:
1133
1280
  root,
1134
1281
  embodiment=args.embodiment,
1135
1282
  expected_frame_id=args.frame_id,
1283
+ allow_sim_only_receipt=True,
1136
1284
  )
1137
1285
  )
1138
1286
  emb_name = gate.active_robot_id
@@ -1205,11 +1353,14 @@ def _cmd_ros2_bridge(args: argparse.Namespace) -> int:
1205
1353
  import rclpy as _rclpy # type: ignore[import-not-found]
1206
1354
 
1207
1355
  if args.params is not None and Path(args.params).exists():
1208
- ros_cfg = load_ros2_gate_config_from_params(
1209
- args.params,
1210
- workspace_dir=root,
1211
- embodiment=args.embodiment,
1212
- expected_frame_id=args.frame_id,
1356
+ ros_cfg = replace(
1357
+ load_ros2_gate_config_from_params(
1358
+ args.params,
1359
+ workspace_dir=root,
1360
+ embodiment=args.embodiment,
1361
+ expected_frame_id=args.frame_id,
1362
+ ),
1363
+ allow_sim_only_receipt=True,
1213
1364
  )
1214
1365
  gate = ROS2BoundaryGate(root, ros_config=ros_cfg)
1215
1366
  else:
@@ -1217,6 +1368,7 @@ def _cmd_ros2_bridge(args: argparse.Namespace) -> int:
1217
1368
  root,
1218
1369
  embodiment=args.embodiment,
1219
1370
  expected_frame_id=args.frame_id,
1371
+ allow_sim_only_receipt=True,
1220
1372
  )
1221
1373
  _enforce_shadow_mode_on_gate(gate)
1222
1374
  _rclpy.init()
@@ -1292,10 +1444,16 @@ def _cmd_compliance_pack(args: argparse.Namespace) -> int:
1292
1444
  if args.json:
1293
1445
  print(json.dumps(pack.to_dict(), indent=2))
1294
1446
  else:
1447
+ ev_label = str(pack.manifest.get("evidence_status_label", pack.overall_status))
1295
1448
  print(
1296
1449
  f"Generated ISO 10218:2025 & EU 2023/1230 compliance pack "
1297
- f"[{pack.overall_status} · {pack.readiness_score_pct}%]"
1450
+ f"[{ev_label} · {pack.overall_status} · {pack.readiness_score_pct}%]"
1298
1451
  )
1452
+ incomplete = explain_incomplete_controls(pack.manifest)
1453
+ if incomplete:
1454
+ print(" Incomplete controls:")
1455
+ for ctrl_name, ctrl_status, reason in incomplete:
1456
+ print(f" [{ctrl_status}] {ctrl_name}: {reason}")
1299
1457
  print(f" ZIP archive : {pack.zip_path}")
1300
1458
  print(f" Manifest : {pack.manifest_path} ({pack.manifest_sha256})")
1301
1459
  print(f" HTML dossier: {pack.dossier_html_path}")
@@ -1522,7 +1680,7 @@ def _render_connect_client_config(
1522
1680
  "command": "robot-gate",
1523
1681
  "args": ["mcp", "--dir", ws_str],
1524
1682
  "env": {
1525
- "GRAFT_CELL_URL": "http://127.0.0.1:8785",
1683
+ "GRAFT_CELL_URL": f"http://127.0.0.1:{DEFAULT_CONSOLE_PORT}",
1526
1684
  "GRAFT_PLUGIN_VERSION": "0.5.0",
1527
1685
  "GRAFT_TRUST_START": "L0_OBSERVE",
1528
1686
  },
@@ -1575,9 +1733,12 @@ def _render_connect_client_config(
1575
1733
  "vault_disabled": True if airgapped else (not vault_enabled),
1576
1734
  "llm_backend": {
1577
1735
  "provider": "apple_silicon_mlx",
1578
- "base_url": "http://127.0.0.1:11434/v1",
1736
+ "base_url": f"http://127.0.0.1:{DEFAULT_OLLAMA_PORT}/v1",
1579
1737
  "model": "mlx-community/gemma-4-e4b-it-4bit",
1580
- "launch_command": "mlx_lm.server --model mlx-community/gemma-4-e4b-it-4bit --host 127.0.0.1 --port 11434",
1738
+ "launch_command": (
1739
+ f"mlx_lm.server --model mlx-community/gemma-4-e4b-it-4bit "
1740
+ f"--host 127.0.0.1 --port {DEFAULT_OLLAMA_PORT}"
1741
+ ),
1581
1742
  },
1582
1743
  "mcp_server": {
1583
1744
  "command": "robot-gate",
@@ -1596,7 +1757,7 @@ def _render_connect_client_config(
1596
1757
  "vault_disabled": True if airgapped else (not vault_enabled),
1597
1758
  "llm_backend": {
1598
1759
  "provider": "ollama_gemma4",
1599
- "base_url": "http://127.0.0.1:11434",
1760
+ "base_url": f"http://127.0.0.1:{DEFAULT_OLLAMA_PORT}",
1600
1761
  "model": "gemma4:e4b-it-qat",
1601
1762
  "launch_command": "ollama run gemma4:e4b-it-qat",
1602
1763
  },
@@ -1772,7 +1933,7 @@ def _render_first_prompt(
1772
1933
 
1773
1934
 
1774
1935
  def _cmd_connect(args: argparse.Namespace) -> int:
1775
- """3-click LLM-to-Robot connect kit generator (`robot-gate connect`)."""
1936
+ """Generate MCP/ROS 2 client integration kit (`robot-gate connect`)."""
1776
1937
  client = str(args.client)
1777
1938
  robot = str(args.robot)
1778
1939
  env_key = str(args.env)
@@ -1945,7 +2106,7 @@ def _cmd_connect(args: argparse.Namespace) -> int:
1945
2106
  prompt_path.write_text(prompt_text, encoding="utf-8")
1946
2107
 
1947
2108
  payload: dict[str, object] = {
1948
- "ok": bool(receipt.passed),
2109
+ "ok": bool(receipt.sim_only_passed),
1949
2110
  "client": client,
1950
2111
  "client_label": client_meta["label"],
1951
2112
  "robot": robot,
@@ -1958,6 +2119,7 @@ def _cmd_connect(args: argparse.Namespace) -> int:
1958
2119
  "vault_enabled": vault_enabled,
1959
2120
  "workspace": str(root),
1960
2121
  "gate_check_passed": receipt.passed,
2122
+ "gate_check_sim_only_passed": receipt.sim_only_passed,
1961
2123
  "files": {
1962
2124
  "connect_script": str(script_path),
1963
2125
  "client_config": str(config_path),
@@ -1972,6 +2134,11 @@ def _cmd_connect(args: argparse.Namespace) -> int:
1972
2134
  if args.json:
1973
2135
  print(json.dumps(payload, indent=2))
1974
2136
  else:
2137
+ gate_state = (
2138
+ "PASS"
2139
+ if receipt.passed
2140
+ else ("SIM_OK (Stage 2 NOT_MEASURED)" if receipt.sim_only_passed else "FAIL")
2141
+ )
1975
2142
  print(
1976
2143
  f"Generated Graft Connect Kit ({client_meta['label']} -> {robot_meta['label']} / {env_meta['label']})"
1977
2144
  )
@@ -1979,21 +2146,27 @@ def _cmd_connect(args: argparse.Namespace) -> int:
1979
2146
  print(f" Mode : {'ITAR / Air-Gapped LAN (zero cloud/vault)' if airgapped else ('Cloudflare Fleet Vault opt-in' if vault_enabled else '100% Offline Local Core')}")
1980
2147
  print(f" Connect script: {script_path} (executable)")
1981
2148
  print(f" Client config : {config_path}")
1982
- print(f" ROBOT.md : {manifest_path} (Ed25519 signed · gate={'PASS' if receipt.passed else 'FAIL'})")
2149
+ print(f" ROBOT.md : {manifest_path} (Ed25519 signed · gate={gate_state})")
1983
2150
  if ros2_files:
1984
2151
  print(f" ROS 2 bundle : {root / 'ros2'}")
1985
2152
  print(f" First prompt : {prompt_path}")
1986
2153
  print(f" Safety : {SAFETY_BOUNDARY_STATEMENT}")
1987
- return 0 if receipt.passed else 1
2154
+ return 0 if receipt.sim_only_passed else 1
1988
2155
 
1989
2156
 
1990
2157
  def build_parser() -> argparse.ArgumentParser:
1991
2158
  epilog = (
2159
+ "Command Groups (Non-Breaking Subcommands):\n"
2160
+ " Core Cell : init, check, why, serve, demo, snapshot, onboard, install-hook, install-systemd\n"
2161
+ " Evidence & Compliance: compliance-pack, verify-audit, verify-report, vault\n"
2162
+ " Integrations : connect, mcp, mcp-config, ros2-bridge, devices\n"
2163
+ " Labs : packs, set, plan\n"
2164
+ "\n"
1992
2165
  "Workflow Tracks (Offline by Default · 0 Phone-Home):\n"
1993
2166
  " 1. Quickstart & Local Cell Console\n"
1994
2167
  " robot-gate demo --ros2 <10s zero-ROS UR5e boundary + compliance demo\n"
1995
2168
  " robot-gate init --preset ur5e --sign Scaffold Ed25519-signed ROBOT.md & gate.yaml\n"
1996
- " robot-gate serve --dir . --port 8785 --open Launch local Graft Cell Console in browser\n"
2169
+ f" robot-gate serve --dir . --port {DEFAULT_CONSOLE_PORT} --open Launch local Graft Cell Console in browser\n"
1997
2170
  "\n"
1998
2171
  " 2. AI / MCP & ROS 2 Runtime Integration\n"
1999
2172
  " robot-gate connect --client claude --robot ur5e --env industrial\n"
@@ -2027,7 +2200,7 @@ def build_parser() -> argparse.ArgumentParser:
2027
2200
 
2028
2201
  p_conn = sub.add_parser(
2029
2202
  "connect",
2030
- help="3-click LLM-to-Robot connect kit (connect-graft.sh, AI client config, signed ROBOT.md, ROS 2 bundle, FIRST_PROMPT.md)",
2203
+ help="Generate MCP/ROS 2 client integration kit (connect-graft.sh, AI client config, signed ROBOT.md, ROS 2 bundle, FIRST_PROMPT.md)",
2031
2204
  )
2032
2205
  p_conn.add_argument(
2033
2206
  "--client",
@@ -2143,7 +2316,12 @@ def build_parser() -> argparse.ArgumentParser:
2143
2316
  help="Generate a clean parameterized systemd unit file for on-robot deployment",
2144
2317
  )
2145
2318
  p_sysd.add_argument("--dir", required=True, help="Target robot-gate workspace directory")
2146
- p_sysd.add_argument("--port", type=int, default=8785, help="Local listen port (default: 8785)")
2319
+ p_sysd.add_argument(
2320
+ "--port",
2321
+ type=int,
2322
+ default=DEFAULT_CONSOLE_PORT,
2323
+ help=f"Local listen port (default: {DEFAULT_CONSOLE_PORT})",
2324
+ )
2147
2325
  p_sysd.add_argument("--host", default="127.0.0.1", help="Bind host (default: 127.0.0.1)")
2148
2326
  p_sysd.add_argument("--user", default=None, help="Optional Linux service user (e.g. robot)")
2149
2327
  p_sysd.add_argument("--out", default=None, help="Write unit file to PATH (prints to stdout if omitted)")
@@ -2153,7 +2331,7 @@ def build_parser() -> argparse.ArgumentParser:
2153
2331
  p_srv = sub.add_parser("serve", help="Run offline on-robot FastAPI harness + Graft Cell Console")
2154
2332
  p_srv.add_argument("--dir", default=".")
2155
2333
  p_srv.add_argument("--host", default="127.0.0.1")
2156
- p_srv.add_argument("--port", type=int, default=8785)
2334
+ p_srv.add_argument("--port", type=int, default=DEFAULT_CONSOLE_PORT)
2157
2335
  p_srv.add_argument(
2158
2336
  "--open",
2159
2337
  action="store_true",
@@ -2165,10 +2343,19 @@ def build_parser() -> argparse.ArgumentParser:
2165
2343
  "demo",
2166
2344
  help="Initialize a signed cell, run gate, and open Graft Cell Console (or `--ros2` zero-ROS demo)",
2167
2345
  )
2168
- p_demo.add_argument("--dir", default=None, help="Target workspace directory (defaults to temp dir with --ros2, or ./.robot-gate-demo otherwise)")
2346
+ p_demo.add_argument(
2347
+ "--dir",
2348
+ default=None,
2349
+ help="Target workspace directory (defaults to ./graft-demo with --ros2, or ./.robot-gate-demo otherwise)",
2350
+ )
2351
+ p_demo.add_argument(
2352
+ "--tmp",
2353
+ action="store_true",
2354
+ help="Use an ephemeral temporary directory in /tmp instead of ./graft-demo (for `--ros2`)",
2355
+ )
2169
2356
  p_demo.add_argument("--preset", choices=sorted(PRESET_EMBODIMENTS), default="fairino-fr5")
2170
2357
  p_demo.add_argument("--host", default="127.0.0.1")
2171
- p_demo.add_argument("--port", type=int, default=8785)
2358
+ p_demo.add_argument("--port", type=int, default=DEFAULT_CONSOLE_PORT)
2172
2359
  p_demo.add_argument(
2173
2360
  "--open",
2174
2361
  action="store_true",