Files
MeshTerm/meshterm/tools/atlas.py
T
Jean-Pierre MartineauandClaude Opus 4.8 34a3b0a01d Atlas redesigned: walk the mesh from a focus node
The whole-graph radar view drew every node on concentric hop rings at
once — a hairball past a dozen nodes, its pan/zoom camera unable to fix
what was fundamentally overplotted. The atlas is now a graph walker:

* One node holds the focus (you, to open). The canvas draws only that
  neighbourhood — focus centred, direct neighbours fanned around it,
  braille edges coloured by SNR and faded by evidence age — and sizes
  itself to the crowd, so a two-node link is a tight six rows while a
  hub earns the full fan. The node the trail came from anchors due
  west: walking reads as moving right, backing up as moving left.
* Beneath it the links list the same neighbours as selectable rows,
  strongest first: glyph, name (palette hue, you in white), hash in the
  shared hash widget, SNR with a quality bar, samples, source tags,
  age, and how many links continue onward. The highlighted row's marker
  lights white on the canvas.
* Enter walks (the breadcrumb trail grows across the top), ⌫ steps
  back, walking into the trail-back row retraces instead of ping-pong
  growing, Home refocuses you. Typing finds any node in the graph —
  nearest first, islands flagged — and Enter teleports there, the
  trail restarting since the walk never crossed the gap. ^R rebuilds
  from storage and keeps whatever of the trail survives.

The per-node details dialog is gone (focusing a node is its details),
and the ring-relaxation layout service with it — the fan needs no
global relaxation. PgUp/PgDn page the highlight, dashboard-style.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 04:17:03 -04:00

78 lines
2.9 KiB
Python

"""The ``atlas`` tool: the mesh's observed shape, explored one node at a time.
Opens the full-screen Mesh atlas (see :mod:`meshterm.ui.atlas_screen`): a walkable
browser over the evidence graph — trace walks, firmware routes, overheard relay
chains, repeater neighbour tables. One node holds the focus, its neighbourhood draws
as SNR-coloured braille edges on a small clean canvas, and its links list beneath as
rows with quality bars and evidence; Enter walks the graph, ⌫ backtracks along the
breadcrumb trail, and typing finds any node (islands included). The geographic map
answers *where* the mesh is; the atlas answers *how it hangs together*.
Menu-only: the atlas is an interactive reading of stored evidence (and transmits
nothing), so there is no scripted one-shot to register — ``trace``-family commands
already print path evidence in scripted runs.
"""
from __future__ import annotations
from typing import Any, Optional
import typer
from ..context import AppContext
from .base import Tool, ToolResult, register
@register
class AtlasTool(Tool):
"""See how the mesh hangs together: the observed link graph, walkable."""
name = "atlas"
title = "Mesh atlas"
# A single-codepoint emoji (like every other tool icon), not a VS16 sequence: the
# emoji-width calibration strips VS16 on terminals that render it narrow, which would
# measure a 🕸️ one cell short of how it paints and drift this row's help text right of
# the column the others align to. The wireframe globe reads as the logical topology,
# the geographic map's 🌍 counterpart.
icon = "🌐"
help = "Walk the mesh's observed topology — links, SNR, evidence"
category = "Mesh"
order = 32 # beside Map: the logical shape next to the geographic one
async def prompt_params(self, ctx: AppContext) -> Optional[dict[str, Any]]:
"""Run the atlas; there are never parameters to collect.
The screen presents everything itself and returns when dismissed, so
returning ``None`` tells the menu the invocation is complete (the same
pattern as the ``dashboard`` tool).
Args:
ctx: Shared application context.
Returns:
Always ``None``.
"""
from ..ui.atlas_screen import open_atlas
await open_atlas(ctx)
return None
async def run(self, ctx: AppContext, params: dict[str, Any]) -> ToolResult:
"""Nothing runs here: the atlas lives inside :meth:`prompt_params`.
Args:
ctx: Shared application context.
params: Unused.
Returns:
An empty :class:`ToolResult` (only reachable from a scripted call).
"""
return ToolResult(summary={})
def register_cli(self, app: typer.Typer) -> None:
"""Register no CLI command — the atlas is an interactive, menu-only screen.
Args:
app: The Typer application (untouched).
"""