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
20 changes: 18 additions & 2 deletions assets/sourceos/bin/turtle-mesh-serve
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ def _searxng_alive() -> bool:
return False


def _k3s_tunnel_alive() -> bool:
pid_file = Path.home() / ".local" / "state" / "sourceos" / "k3s-tunnel.pid"
try:
pid = int(pid_file.read_text().strip())
os.kill(pid, 0)
return True
except Exception:
return False


def gather_state() -> dict:
mesh = load_jsonl_tail(MESH_DIR / "context.jsonl", 60)
active = load_json(MESH_DIR / "active.json")
Expand Down Expand Up @@ -130,8 +140,9 @@ def gather_state() -> dict:
"board": board,
"bb_cands": bb_cands,
"notes": notes,
"searxng_ok": searxng_ok,
"runbooks": runbooks,
"searxng_ok": searxng_ok,
"k3s_tunnel_up": _k3s_tunnel_alive(),
"runbooks": runbooks,
}


Expand Down Expand Up @@ -270,6 +281,7 @@ h2{font-size:12px;color:var(--dim);text-transform:uppercase;letter-spacing:.08em
<span id="ci-badge">CI —</span>
<span id="pr-badge">PRs —</span>
<span id="board-badge">Board —</span>
<span id="k3s-badge"><span class="dot dot-yellow pulse"></span>k3s …</span>
<span id="ts-badge" style="margin-left:auto;color:var(--dim)">—</span>
</div>

Expand Down Expand Up @@ -335,6 +347,10 @@ function render(state) {
document.getElementById('board-badge').innerHTML = bd.score !== undefined
? `Board <span class="badge badge-green">${Number(bd.score).toFixed(1)}%</span>` : 'Board —'

document.getElementById('k3s-badge').innerHTML = state.k3s_tunnel_up
? `<span class="dot dot-green"></span>k3s <span class="badge badge-green">up</span>`
: `<span class="dot dot-red"></span>k3s <span class="badge badge-red">down</span>`

document.getElementById('ts-badge').textContent = new Date(state.ts).toLocaleTimeString()

// Active focus
Expand Down
Loading
Loading