{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Pi Dashboard",
    "quality_profile": "showcase"
  },
  "components": [
    {
      "id": "ext",
      "type": "backend",
      "label": "dashboard.ts",
      "sublabel": "pi extension",
      "pos": [
        40,
        140
      ]
    },
    {
      "id": "sf",
      "type": "database",
      "label": "state files",
      "sublabel": "~/.pi/agent/dashboard",
      "pos": [
        260,
        140
      ]
    },
    {
      "id": "st",
      "type": "backend",
      "label": "state.go",
      "sublabel": "read + liveness",
      "pos": [
        480,
        140
      ]
    },
    {
      "id": "main",
      "type": "backend",
      "label": "main.go",
      "sublabel": "bubbletea TUI",
      "pos": [
        700,
        140
      ]
    },
    {
      "id": "ui",
      "type": "frontend",
      "label": "Table + Detail",
      "sublabel": "views",
      "pos": [
        920,
        140
      ]
    },
    {
      "id": "cfg",
      "type": "backend",
      "label": "pi-dashboard.yaml",
      "sublabel": "config",
      "pos": [
        700,
        40
      ]
    },
    {
      "id": "rem",
      "type": "external",
      "label": "remotes .13 .51",
      "sublabel": "ssh cat *.json",
      "pos": [
        40,
        340
      ]
    },
    {
      "id": "at",
      "type": "external",
      "label": "tmux / zellij",
      "sublabel": "attach",
      "pos": [
        1180,
        540
      ]
    },
    {
      "id": "hk",
      "type": "external",
      "label": "hunk",
      "sublabel": "diff review",
      "pos": [
        1180,
        390
      ]
    },
    {
      "id": "tx",
      "type": "external",
      "label": "tuxedo",
      "sublabel": "todo.txt",
      "pos": [
        1180,
        240
      ]
    }
  ],
  "boundaries": [
    {
      "kind": "region",
      "label": "pi-dashboard (Go)",
      "wraps": [
        "st",
        "main",
        "ui",
        "cfg"
      ]
    },
    {
      "kind": "region",
      "label": "data sources",
      "wraps": [
        "ext",
        "sf",
        "rem"
      ]
    }
  ],
  "connections": [
    {
      "id": "ext-to-sf",
      "from": "ext",
      "to": "sf",
      "label": "writes JSON"
    },
    {
      "id": "rem-to-st",
      "from": "rem",
      "to": "st",
      "label": "ssh"
    },
    {
      "id": "sf-to-st",
      "from": "sf",
      "to": "st",
      "label": "readLocalStates"
    },
    {
      "id": "st-to-main",
      "from": "st",
      "to": "main",
      "label": "AgentState",
      "labelAt": [
        620,
        215
      ]
    },
    {
      "id": "cfg-to-main",
      "from": "cfg",
      "to": "main",
      "label": "loadConfig",
      "labelAt": [
        760,
        114
      ]
    },
    {
      "id": "main-to-st",
      "from": "main",
      "to": "st",
      "label": "2s poll tick",
      "fromSide": "bottom",
      "toSide": "bottom"
    },
    {
      "id": "main-to-ui",
      "from": "main",
      "to": "ui",
      "label": "model"
    },
    {
      "id": "ui-to-at",
      "from": "ui",
      "to": "at",
      "label": "Enter",
      "labelAt": [
        1060,
        480
      ]
    },
    {
      "id": "ui-to-hk",
      "from": "ui",
      "to": "hk",
      "label": "d",
      "labelAt": [
        1060,
        360
      ]
    },
    {
      "id": "ui-to-tx",
      "from": "ui",
      "to": "tx",
      "label": "Tab",
      "labelAt": [
        1060,
        240
      ]
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "Source of truth",
      "items": [
        "dashboard.ts extension writes session JSON per machine",
        "state.go: heartbeat/staleness (45s window, legacy 30m)",
        "remote reads: ssh cat *.json, 5s hard timeout + cooldown"
      ]
    },
    {
      "dot": "emerald",
      "title": "UI actions",
      "items": [
        "Enter: tmux / zellij attach (local or ssh -t)",
        "d: hunk diff in the agent's folder",
        "Tab: tuxedo task board (<cwd>/todo.txt)",
        "Del: remove closed/lost state file (local or ssh)"
      ]
    }
  ]
}