Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

**A sovereign, local-first compute fabric for trusted devices.**

[![Tests](https://img.shields.io/badge/tests-185%20passing-00FF88?style=flat-square&labelColor=06090F)](./tests/test_sovereign_mesh.py)
[![Tests](https://img.shields.io/badge/tests-187%20passing-00FF88?style=flat-square&labelColor=06090F)](./tests/test_sovereign_mesh.py)
[![Release](https://img.shields.io/badge/release-v0.1.4-F6C177?style=flat-square&labelColor=06090F)](./README.md#current-status)
[![Version](https://img.shields.io/badge/wire%20version-sovereign--mesh%2Fv1-00D4FF?style=flat-square&labelColor=06090F)](./docs/OCP_STATUS.md)
[![Status](https://img.shields.io/badge/status-active%20development-C8A96E?style=flat-square&labelColor=06090F)](./docs/OCP_MASTER_PLAN.md)
Expand Down Expand Up @@ -131,7 +131,7 @@ Some devices are powerful. Some are private. Some are fragile. Some are approval
| `server_control_page.py` | Extracted control-deck renderer for the advanced operator surface |
| `server_http_handlers.py` | Grouped HTTP route handlers so `server.py` stays a thin transport host |
| `docs/` | Protocol notes, status, and roadmap |
| `tests/test_sovereign_mesh.py` | Regression suite — 185 tests |
| `tests/test_sovereign_mesh.py` | Regression suite — 187 tests |

**Key runtime concepts:**

Expand Down Expand Up @@ -282,7 +282,7 @@ python3 -m unittest tests.test_sovereign_mesh
python3 server.py --help
```

Current baseline: **185 tests passing.**
Current baseline: **187 tests passing.**

---

Expand All @@ -296,7 +296,7 @@ Current baseline: **185 tests passing.**
- Private artifact content fetches now require operator auth unless the artifact policy is public.
- Runtime execution now defaults to explicit environment inheritance, with `inherit_env_allowlist` for deliberate host env pass-through.
- The signed envelope implementation now uses dependency-free Ed25519 helpers under `ed25519-sha512-v1`.
- The protocol-kernel refactor and mission-continuity/treaty foundation from v0.1.3 remain intact, with the full regression suite green at 185 tests.
- The protocol-kernel refactor and mission-continuity/treaty foundation from v0.1.3 remain intact, with the full regression suite green at 187 tests.

**Implemented in the current runtime**

Expand Down
2 changes: 1 addition & 1 deletion docs/OCP_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,4 @@ python3 -m unittest tests.test_sovereign_mesh
```

Current standalone baseline:
- `tests.test_sovereign_mesh`: 185 tests passing
- `tests.test_sovereign_mesh`: 187 tests passing
38 changes: 19 additions & 19 deletions mesh_autonomy/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,42 +715,42 @@ def activate(
result["diagnostics"] = diagnostics
self._action(
actions,
"diagnostics",
"setup_checked",
"ok",
diagnostics.get("share_advice") or "Checked local IPs and shareable URLs.",
details={"sharing_mode": diagnostics.get("sharing_mode"), "lan_urls": diagnostics.get("lan_urls") or []},
request_id=request_token,
)
except Exception as exc:
self._action(actions, "diagnostics", "warning", f"Connectivity diagnostics failed: {exc}", details={"error": str(exc)}, request_id=request_token)
self._action(actions, "fix_needed", "warning", f"Connectivity diagnostics failed: {exc}", details={"error": str(exc)}, request_id=request_token)

try:
scan = self.mesh.scan_local_peers(timeout=scan_timeout, limit=limit, trust_tier="trusted")
result["scan"] = scan
self._action(
actions,
"scan",
"peer_scan",
"ok",
f"Scanned nearby routes: {scan.get('reachable', scan.get('discovered', 0))} candidate(s) surfaced.",
details={"discovered": scan.get("discovered"), "errors": scan.get("errors")},
request_id=request_token,
)
except Exception as exc:
self._action(actions, "scan", "warning", f"Nearby scan could not complete: {exc}", details={"error": str(exc)}, request_id=request_token)
self._action(actions, "fix_needed", "warning", f"Nearby scan could not complete: {exc}", details={"error": str(exc)}, request_id=request_token)

try:
connected = self.mesh.connect_all_devices(timeout=timeout, scan_timeout=scan_timeout, limit=limit, trust_tier="trusted")
result["connect"] = connected
self._action(
actions,
"connect",
"setup_checked",
"ok",
connected.get("operator_summary") or f"Connected {connected.get('connected', 0)} peer(s).",
details={"connected": connected.get("connected"), "already_connected": connected.get("already_connected"), "errors": connected.get("errors")},
request_id=request_token,
)
except Exception as exc:
self._action(actions, "connect", "warning", f"Connect pass had trouble: {exc}", details={"error": str(exc)}, request_id=request_token)
self._action(actions, "fix_needed", "warning", f"Connect pass had trouble: {exc}", details={"error": str(exc)}, request_id=request_token)

peer_rows = list(self.mesh.list_peers(limit=max(24, int(limit or 24) * 2)).get("peers") or [])
peer_ids = [str(peer.get("peer_id") or "").strip() for peer in peer_rows if str(peer.get("peer_id") or "").strip()]
Expand All @@ -760,7 +760,7 @@ def activate(
route_probes.append(probe)
self._action(
actions,
"route_probe",
"route_verified" if int(probe.get("reachable") or 0) else "fix_needed",
"ok" if int(probe.get("reachable") or 0) else "warning",
probe.get("operator_summary") or f"Probed routes for {peer_id}.",
peer_id=peer_id,
Expand All @@ -787,29 +787,29 @@ def activate(
mission_status = str(mission.get("status") or proof.get("status") or "unknown")
self._action(
actions,
"whole_mesh_proof",
"proof_completed" if mission_status in {"completed", "planned", "accepted"} else "fix_needed",
"ok" if mission_status in {"completed", "planned", "accepted"} else "warning",
f"Whole-mesh proof launched with status {mission_status}.",
details={"mission_id": mission.get("id"), "mission_status": mission_status},
request_id=request_token,
)
if repair and self._proof_failed_due_transport(proof):
self._action(actions, "route_repair", "running", "Proof hit a transport timeout; probing routes once before retry.", request_id=request_token)
self._action(actions, "fix_needed", "running", "Proof hit a transport timeout; probing routes once before retry.", request_id=request_token)
result["repairs"] = self._repair_routes(peer_ids, timeout=timeout, request_id=request_token, actions=actions)
proof = self._run_whole_mesh_proof(include_local=True, limit=limit, request_id=f"{request_token}-proof-retry")
result["proof_retry"] = proof
retry_mission = dict(proof.get("mission") or {})
self._action(
actions,
"whole_mesh_proof_retry",
"proof_completed",
"ok",
f"Retried whole-mesh proof with status {retry_mission.get('status') or proof.get('status') or 'unknown'}.",
details={"mission_id": retry_mission.get("id"), "mission_status": retry_mission.get("status")},
request_id=request_token,
)
except Exception as exc:
result["proof_error"] = str(exc)
self._action(actions, "whole_mesh_proof", "warning", f"Whole-mesh proof needs attention: {exc}", details={"error": str(exc)}, request_id=request_token)
self._action(actions, "fix_needed", "warning", f"Whole-mesh proof needs attention: {exc}", details={"error": str(exc)}, request_id=request_token)

status, summary = self._activation_outcome(result, actions)
run = self._record_run(
Expand Down Expand Up @@ -872,15 +872,15 @@ def _evaluate_and_enlist_helpers(
limit=max(1, int(max_enlist or 2)) * 3,
)
except Exception as exc:
self._action(actions, "helper_plan", "warning", f"Helper planning failed: {exc}", details={"error": str(exc)}, request_id=request_id)
self._action(actions, "fix_needed", "warning", f"Helper planning failed: {exc}", details={"error": str(exc)}, request_id=request_id)
return {"status": "error", "error": str(exc), "plan": {}, "enlisted": [], "approvals": [], "skipped": []}

enlisted = []
approvals = []
skipped = []
self._action(
actions,
"helper_plan",
"helper_ready",
"ok",
f"Evaluated {plan.get('candidate_count', 0)} helper candidate(s).",
details={"candidate_count": plan.get("candidate_count")},
Expand Down Expand Up @@ -928,14 +928,14 @@ def _evaluate_and_enlist_helpers(
peer = self.mesh._row_to_peer(self.mesh._get_peer_row(peer_id)) or {}
if not self._route_is_usable(peer):
skipped.append({"peer_id": peer_id, "reason": "route_not_usable"})
self._action(actions, "helper_skipped", "warning", f"Did not enlist {peer_id} because no fresh working route is proven.", peer_id=peer_id, request_id=request_id)
self._action(actions, "fix_needed", "warning", f"Did not enlist {peer_id} because no fresh working route is proven.", peer_id=peer_id, request_id=request_id)
continue
trust = self._normalize_trust_tier(candidate.get("trust_tier") or "trusted")
device_class = str(candidate.get("device_class") or "full").strip().lower()
role = "gpu_helper" if dict(candidate.get("compute_profile") or {}).get("gpu_capable") else "helper"
if str((candidate.get("enlistment") or {}).get("state") or "").strip().lower() == "enlisted":
skipped.append({"peer_id": peer_id, "reason": "already_enlisted"})
self._action(actions, "helper_reuse", "ok", f"{candidate.get('display_name') or peer_id} is already enlisted.", peer_id=peer_id, request_id=request_id)
self._action(actions, "helper_ready", "ok", f"{candidate.get('display_name') or peer_id} is already enlisted.", peer_id=peer_id, request_id=request_id)
continue
if len(enlisted) >= max(0, int(max_enlist or 0)):
skipped.append({"peer_id": peer_id, "reason": "max_enlist_reached"})
Expand All @@ -944,10 +944,10 @@ def _evaluate_and_enlist_helpers(
try:
state = self.mesh.enlist_helper(peer_id, mode="on_demand", role=role, reason="autonomic_mesh_activation", source="autonomy")
enlisted.append({"peer_id": peer_id, "state": state})
self._action(actions, "helper_enlisted", "ok", f"Enlisted {candidate.get('display_name') or peer_id} as a safe helper.", peer_id=peer_id, details={"role": role}, request_id=request_id)
self._action(actions, "helper_ready", "ok", f"Enlisted {candidate.get('display_name') or peer_id} as a safe helper.", peer_id=peer_id, details={"role": role}, request_id=request_id)
except Exception as exc:
skipped.append({"peer_id": peer_id, "reason": str(exc)})
self._action(actions, "helper_enlist_failed", "warning", f"Could not enlist {peer_id}: {exc}", peer_id=peer_id, details={"error": str(exc)}, request_id=request_id)
self._action(actions, "fix_needed", "warning", f"Could not enlist {peer_id}: {exc}", peer_id=peer_id, details={"error": str(exc)}, request_id=request_id)
elif trust == "partner":
approval = self.mesh.create_approval_request(
title=f"Allow {candidate.get('display_name') or peer_id} to help this mesh?",
Expand All @@ -973,10 +973,10 @@ def _evaluate_and_enlist_helpers(
},
)
approvals.append(approval)
self._action(actions, "helper_approval_requested", "approval_required", f"Asked before using partner peer {candidate.get('display_name') or peer_id}.", peer_id=peer_id, details={"approval": approval}, request_id=request_id)
self._action(actions, "helper_ready", "approval_required", f"Asked before using partner peer {candidate.get('display_name') or peer_id}.", peer_id=peer_id, details={"approval": approval}, request_id=request_id)
else:
skipped.append({"peer_id": peer_id, "reason": f"trust_tier_{trust}_not_auto_enlisted"})
self._action(actions, "helper_skipped", "blocked", f"Did not auto-enlist {peer_id} because trust tier is {trust}.", peer_id=peer_id, request_id=request_id)
self._action(actions, "fix_needed", "blocked", f"Did not auto-enlist {peer_id} because trust tier is {trust}.", peer_id=peer_id, request_id=request_id)
return {
"status": "ok",
"plan": plan,
Expand Down
15 changes: 15 additions & 0 deletions mesh_protocol/conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,21 @@ def build_protocol_conformance_snapshot() -> dict[str, Any]:
"healthy_routes": 1,
"operator_summary": "Mesh is strong.",
},
"setup": {
"status": "strong",
"label": "Mesh strong",
"primary_action": "activate_mesh",
"bind_mode": "lan",
"phone_url": "http://192.168.1.10:8421/app",
"token_status": "configured",
"known_peer_count": 1,
"healthy_route_count": 1,
"route_count": 1,
"latest_proof_status": "completed",
"blocking_issue": "",
"next_fix": "No fix needed. The current mesh proof completed.",
"operator_summary": "Mesh is strong. Devices have proven routes and the latest proof completed.",
},
"autonomy": {"status": "ok", "mode": "assisted", "operator_summary": "Mesh is strong."},
"route_health": {
"status": "ok",
Expand Down
20 changes: 19 additions & 1 deletion mesh_protocol/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
"AppStatus": {
"type": "object",
"description": "Operator-facing compact status for the installable OCP app home.",
"required": ["status", "node", "app_urls", "mesh_quality", "next_actions"],
"required": ["status", "node", "app_urls", "mesh_quality", "setup", "next_actions"],
"properties": {
"status": {"type": "string"},
"node": {"type": "object"},
Expand Down Expand Up @@ -440,6 +440,24 @@
"operator_summary": {"type": "string"},
},
},
"setup": {
"type": "object",
"properties": {
"status": {"type": "string"},
"label": {"type": "string"},
"primary_action": {"type": "string"},
"bind_mode": {"type": "string"},
"phone_url": {"type": "string"},
"token_status": {"type": "string"},
"known_peer_count": {"type": "integer"},
"healthy_route_count": {"type": "integer"},
"route_count": {"type": "integer"},
"latest_proof_status": {"type": "string"},
"blocking_issue": {"type": "string"},
"next_fix": {"type": "string"},
"operator_summary": {"type": "string"},
},
},
"autonomy": {"type": "object"},
"route_health": {"$ref": "#/schemas/RouteHealthList"},
"latest_proof": {"type": "object"},
Expand Down
Loading
Loading