← Commit history

Publish 1.4.7

Colby Knox ·7d19532cc3 · ·parent becb6ab
4 files changed +62−4
adom-context+27−2
@@ -80,6 +80,31 @@ def probe_identity():     return {"username": user["username"], "name": user.get("displayName"), "orgs": orgs}  +def machine_state(t):+    """How one `adom-bridge targets` row reads to the AI. Only an explicit+    reachable:false is "offline". Older CLIs send no reachable field at all, and+    every row targets lists came from the relay's live connections, so a missing+    value falls back to connected, relayConnected and connectedAt, and is never+    printed as offline."""+    r = t.get("reachable")+    if r is True:+        return "reachable"+    if r is False:+        return "offline"+    if r == "mesh":+        return "mesh, dials on demand"+    if isinstance(r, str) and r:+        return r+    for key in ("connected", "relayConnected"):+        if t.get(key) is True:+            return "reachable"+    if t.get("connected") is False and t.get("relayConnected") is not True:+        return "offline"+    if t.get("connectedAt"):+        return "reachable"+    return f"status unknown, check with `adom-bridge --target {t.get('name') or '<name>'} status`"++ def probe_targets():     d = run_json("adom-bridge", "targets")     if not d or d.get("status") != "ok":@@ -87,7 +112,7 @@ def probe_targets():     return {         "primary": d.get("primaryMachine"),         "machines": [-            {"name": t.get("name"), "os": t.get("os"), "reachable": t.get("reachable"),+            {"name": t.get("name"), "os": t.get("os"), "reachable": machine_state(t),              "primary": bool(t.get("primary"))}             for t in d.get("targets") or []         ],@@ -174,7 +199,7 @@ def render(c):         # is the very machine the user is sitting at.         here = w["host"].lower() if w["kind"] == "hydrogen-local" else None         names = "; ".join(-            f"{t['name']} ({t['os']}, {'reachable' if t['reachable'] is True else t['reachable'] or 'offline'}"+            f"{t['name']} ({t['os']}, {t['reachable']}"             f"{', primary' if t['primary'] else ''}{', this PC' if (t['name'] or '').lower() == here else ''})"             for t in m["machines"]) or "none"         lines.append(f"- Adom Bridge machines: {names}.")
package.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "hook",-  "version": "1.4.6",+  "version": "1.4.7",   "type": "app",   "org": "adom",   "bundled": true,
page.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "hook",-  "version": "1.4.6",+  "version": "1.4.7",   "type": "app",   "org": "adom",   "bundled": true,
tests/test_start_here.py+33
@@ -108,6 +108,39 @@ class StartHereTest(unittest.TestCase):         self.assertIn("- Where:", p.stdout)         self.assertIn("Adom sign-in: unknown", p.stdout) +    def machines_line(self, targets):+        # A stand-in adom-bridge that answers `targets` with the given rows.+        fakebin = self.home / "bridgebin"+        fakebin.mkdir(exist_ok=True)+        (fakebin / "adom-bridge").write_text("#!/bin/sh\ncat <<'JSON'\n"+            + json.dumps({"status": "ok", "targets": targets}) + "\nJSON\n")+        (fakebin / "adom-bridge").chmod(0o755)+        p = subprocess.run(["python3", str(PKG / "adom-context")],+                           env=dict(self.env, PATH=f"{fakebin}:/usr/bin:/bin", ADOM_HD_CONTROL_URL=""),+                           capture_output=True, text=True, timeout=10)+        self.assertEqual(p.returncode, 0, p.stderr)+        return next(l for l in p.stdout.splitlines() if "Adom Bridge machines" in l)++    def test_missing_reachable_is_not_offline(self):+        # A 1.9.x CLI: no reachable field, only connectedAt (adom/hook#7).+        line = self.machines_line([{"name": "mac", "os": "macOS", "connectedAt": "2026-12-04T10:00:00Z", "version": "1.9.234"}])+        self.assertIn("mac (macOS, reachable)", line)+        self.assertNotIn("offline", line)++    def test_machine_states(self):+        line = self.machines_line([+            {"name": "a", "os": "Windows", "reachable": True},+            {"name": "b", "os": "Windows", "reachable": False},+            {"name": "c", "os": "Linux", "reachable": "mesh"},+            {"name": "d", "os": "macOS", "connected": True},+            {"name": "e", "os": "macOS"},+        ])+        self.assertIn("a (Windows, reachable)", line)+        self.assertIn("b (Windows, offline)", line)+        self.assertIn("c (Linux, mesh, dials on demand)", line)+        self.assertIn("d (macOS, reachable)", line)+        self.assertIn("e (macOS, status unknown, check with `adom-bridge --target e status`)", line)+  if __name__ == "__main__":     unittest.main()