# Along Dashboard UI (`@along/dashboard-ui`) - Full Documentation Context

> The Along Dashboard UI is the internal web interface for inspecting repository entities, dependency DAGs, issues, decisions, and system diagnostics. It is served by `/along-dash` (FastAPI backend).

---

## Document: README.md (Overview)

# Along Dashboard UI (`@along/dashboard-ui`)

The Along Dashboard UI is the internal web interface for inspecting repository entities, dependency DAGs, issues, decisions, and system diagnostics. It is served by `/along-dash` (FastAPI backend).

---

## Overview

The dashboard frontend is built strictly on the ActDim component and messaging ecosystem:

- **`@actdim/dynstruct`**: Structure-first component definition via `ComponentStruct` with explicit `props`, `actions`, `children`, `events`, and `effects`. Zero React boilerplate; all state lives in observable models.
- **`@actdim/dynstruct-mui`**: Material UI components adapted as Dynstruct hook-constructors (`useButton`, `useDrawer`, `useCard`, etc.).
- **`@actdim/msgmesh`**: Type-safe async messaging mesh for API communication and inter-component signaling.
- **`@actdim/utico`**: Foundation type utilities (`KeysOf`, `ToMsgChannelPrefix`, `ToMsgStruct`).

---

## Documentation & Conventions

Detailed technical specifications, coding conventions, and architectural contracts live in the Knowledge Base:

- **[Knowledge Base Index](./docs/INDEX.md)**: Documentation catalog and topic graph.
- **[System Architecture & Flow](./docs/topic--architecture.md)**: System topology, backend integration, and UI Core delta.
- **[Domain Model & Entity Ecosystem](./docs/topic--domain-model.md)**: Entity schemas and DAG relationships.
- **[Setup & Workflow](./docs/topic--setup-and-workflow.md)**: Developer setup and verification lifecycle.
- **UI & Frontend Standards**: Governed exclusively by `@actdim/ui-core` ([Developer Guide](./node_modules/@actdim/ui-core/docs/topic--developer-guide.md)).

---

## Quick Start & Verification

### Scripts

- `pnpm run dev`: Start local Vite development server.
- `pnpm run build`: Production typecheck and bundle build (`tsc --noEmit && vite build`).
- `pnpm run generate:api`: Generate TypeScript client from FastAPI OpenAPI schema via NSwag.
- `pnpm run typecheck`: Run strict TypeScript validation (`tsc --noEmit`).
- `pnpm test`: Execute automated test suite via Vitest (`vitest run`).

---

## Document: AGENTS.md (Agent Conventions & Protocol)

<!-- BEGIN ALONG-PROTOCOL ref=../../AGENTS.md (managed by along-init - do not edit by hand) -->
This folder belongs to a repository that uses the ALONG structure. The full working
guidance + agent-context protocol live once in the nearest ancestor `AGENTS.md` (`../../AGENTS.md`) -
read it there. This folder keeps its OWN `.along/` state; use the nearest one.
Only this folder's specifics follow.
<!-- END ALONG-PROTOCOL -->

# Agent Context: Along Dashboard UI (`@along/dashboard-ui`)

This document defines the local agent context boundary and engineering rules for `packages/dashboard-ui/`.

## Nearest Context Boundary

When working on the dashboard frontend:
- **UI & Frontend Invariants**: All UI guidelines, component models, design tokens, adaptive layout tiers, and overlay rules are governed exclusively by `@actdim/ui-core` (`node_modules/@actdim/ui-core/docs/INDEX.md`). Application-specific architecture is defined in `docs/topic--architecture.md`.
- Never use untyped casting (`any` or `as ...`). Maintain 100% strict TypeScript typing.
- Never write manual `fetch` calls or manual API channel maps. Use NSwag client generator (`pnpm run generate:api`) and dynamic bus adapters (`@actdim/msgmesh/adapters`).
- Sanitize all rendered Markdown using DOMPurify and enforce strict CSP on Mermaid diagrams.

## Verification & Quality Gates

Run the following checks before concluding any change in this package:
```bash
pnpm run typecheck
pnpm test
pnpm run build
```

## Project specifics

<!-- BEGIN ALONG-RULES -->
See the following engineering guidelines:
- `[languages/typescript.md](../../.along/rules/languages/typescript.md)`
- `[platforms/web.md](../../.along/rules/platforms/web.md)`
<!-- END ALONG-RULES -->

---

## Document: docs/topic--architecture.md (Dashboard UI System Architecture & Flow)

# Dashboard UI System Architecture & Flow

The Along Dashboard UI (`@along/dashboard-ui`) is the executive visualization web client for repository memory, entity graphs, and agent sessions. It is implemented with the Dynstruct component model, MsgMesh bus communication, and `@actdim/ui-core` styling foundations.

---

## Topology

The application topology connects the web client to the local Along daemon or static server:

```mermaid
flowchart TD
    API["Along Backend API / Daemon (:4040)"]
    SSE["SSE Event Stream (/api/events)"]
    SWAGGER["NSwag Client (src/api/client.ts)"]
    SVC["DashboardApiService (src/services/apiService.ts)"]
    BUS["MsgMesh App Bus (src/bus.ts)"]
    APP["DashboardApp (src/App.tsx)"]
    
    API --> SWAGGER
    SSE --> BUS
    SWAGGER --> SVC
    SVC --> BUS
    BUS <--> APP
    
    subgraph UIViews["Feature Views (src/components/)"]
        APP --> OVERVIEW["OverviewView"]
        APP --> KANBAN["IssuesKanbanView"]
        APP --> GRAPH["DAGGraphView (Cytoscape)"]
        APP --> KB["KBExplorerView"]
        APP --> SESSIONS["SessionsDecisionsView"]
        APP --> DRAWER["EntityDrawer"]
        APP --> SEARCH["SearchModal"]
    end
```

---

## Core Components

1. **`DashboardApp` (`src/App.tsx`)**:
   Top-level shell coordinating top navigation header, tabs bar (`@actdim/dynstruct-mui/Tabs`), active view switcher, sliding `EntityDrawer`, and command palette `SearchModal`.
2. **`DashboardApiService` (`src/services/apiService.ts`)**:
   Encapsulates NSwag-generated HTTP client invocations and translates raw JSON responses into typed domain entities dispatched over the `c.msgBus`.
3. **`OverviewView` (`src/components/OverviewView.tsx`)**:
   Executive health summary cards, active milestones, recent sessions, and protocol alerts.
4. **`IssuesKanbanView` (`src/components/IssuesKanbanView.tsx`)**:
   Multi-column status board (`in-progress`, `open`, `done`, `blocked`) with fast text filtering and entity selection.
5. **`DAGGraphView` (`src/components/DAGGraphView.tsx`)**:
   Interactive topological dependency graph rendered with Cytoscape.js, depicting issue blockers, parents, and milestone targets.
6. **`KBExplorerView` (`src/components/KBExplorerView.tsx`)**:
   Knowledge Base documentation browser with split-pane markdown viewer sanitized via DOMPurify.
7. **`SessionsDecisionsView` (`src/components/SessionsDecisionsView.tsx`)**:
   Audit log of agent execution sessions and architectural decision records (ADRs).

---

## Data Flow

1. **Initial Bootstrap**:
   - `main.tsx` mounts `DashboardApp` inside `#root`.
   - `DashboardApp` action `loadData` invokes `API.DASHBOARD.GETFULLDATA` via `DashboardApiService`.
   - On completion, `APP.DATA.UPDATED` payload sets reactive model state `m.props.data`.
2. **Live Synchronization**:
   - A Server-Sent Events (SSE) listener receives incremental updates from the repository daemon.
   - Updates publish `APP.DATA.UPDATED` to refresh the active views without full page reloads.
3. **User Navigation & Selection**:
   - Tab changes dispatch `APP.TAB.SET` with the destination view key.
   - Clicking an entity card or graph node dispatches `APP.ENTITY.SELECT` with the canonical entity slug.
   - `EntityDrawer` observes `m.props.selectedEntityId` via two-way binding and slides in from the right.

---

## Invariants

1. **Dynstruct Component Boundary**:
   Every visual component is a Dynstruct struct. Raw React state hooks (`useState`, `useEffect`, `useMemo`) are prohibited in UI components; reactive properties belong exclusively to model `props`.
2. **Strict Prop-less JSX**:
   Child components declared in `def.children` are rendered without inline props: `<c.children.Name />`.
3. **Bus-First Decoupling**:
   Feature views never pass callback props (`onSelect`, `onClose`) between components. Coordination is mediated by typed MsgMesh channels defined in `src/bus.ts`.
4. **Strict Typing**:
   Zero `any` or `as ...` casting allowed. All API responses conform to NSwag generated types.
5. **Markdown Sanitization & CSP**:
   All rendered markdown is sanitized with DOMPurify with strict HTML tag filtering.

---

## UI Core Integration & Application Delta

Following the `@actdim/ui-core` Theme Extension Policy (`@actdim/ui-core/docs/topic--developer-guide.md`):

1. **Foundational Token Governance**:
   All core palettes, typography scales, spacing units, and overlay primitives are governed exclusively by `@actdim/ui-core` via `@import "@actdim/ui-core/theme.css"` in `src/index.css`.
2. **Direct Library Imports (Zero-Bridge Architecture)**:
   Components import design utilities, overlay primitives, and layout hooks directly from `@actdim/ui-core/theme`, `@actdim/ui-core/components`, and `@actdim/ui-core/layout` without local wrapper shims or re-export bridges.
3. **Application Delta (Permitted Extensions)**:
   - **Third-Party Plugins**: `@plugin "@iconify/tailwind4"` in `src/index.css` for Lucide icon rendering.
   - **Scrollbar Styling**: Webkit custom scrollbars configured in `src/index.css`.
   - **Markdown Typography**: `.markdown-body` selector styles for rendered documentation.

---

## Document: docs/topic--dependencies.md (Dependencies & AI Documentation for @along/dashboard-ui)

# Dependencies & AI Documentation for `@along/dashboard-ui`

> [!NOTE]
> This document maintains a localized registry of internal workspace dependencies and third-party libraries for `@along/dashboard-ui`.
> Consult linked guidelines when developing, refactoring, or integrating components.

## Internal Workspace Dependencies

No internal workspace dependencies detected for this module.

## Declared External Dependencies with AI Guidelines

| Package | Ecosystem | Version | AI Guidelines / Instructions |
| :--- | :--- | :--- | :--- |
| **`@actdim/dynstruct`** | `npm` | `1.12.2` | [AGENTS.md](../node_modules/.pnpm/@actdim+dynstruct@1.12.2_@a_9cc227333c0ecf4368f7602292dd8c27/node_modules/@actdim/dynstruct/AGENTS.md) <br> [CLAUDE.md](../node_modules/.pnpm/@actdim+dynstruct@1.12.2_@a_9cc227333c0ecf4368f7602292dd8c27/node_modules/@actdim/dynstruct/CLAUDE.md) <br> [llms-full.txt](../node_modules/.pnpm/@actdim+dynstruct@1.12.2_@a_9cc227333c0ecf4368f7602292dd8c27/node_modules/@actdim/dynstruct/llms-full.txt) <br> [llms.txt](../node_modules/.pnpm/@actdim+dynstruct@1.12.2_@a_9cc227333c0ecf4368f7602292dd8c27/node_modules/@actdim/dynstruct/llms.txt) <br> [docs/](../node_modules/.pnpm/@actdim+dynstruct@1.12.2_@a_9cc227333c0ecf4368f7602292dd8c27/node_modules/@actdim/dynstruct/docs) <br> manifest metadata (`ai`) |
| **`@actdim/dynstruct-mui`** | `npm` | `1.12.2` | [AGENTS.md](../node_modules/.pnpm/@actdim+dynstruct-mui@1.12._dbfecc25c230812454a35b7fc03c90af/node_modules/@actdim/dynstruct-mui/AGENTS.md) <br> [CLAUDE.md](../node_modules/.pnpm/@actdim+dynstruct-mui@1.12._dbfecc25c230812454a35b7fc03c90af/node_modules/@actdim/dynstruct-mui/CLAUDE.md) <br> [llms-full.txt](../node_modules/.pnpm/@actdim+dynstruct-mui@1.12._dbfecc25c230812454a35b7fc03c90af/node_modules/@actdim/dynstruct-mui/llms-full.txt) <br> [llms.txt](../node_modules/.pnpm/@actdim+dynstruct-mui@1.12._dbfecc25c230812454a35b7fc03c90af/node_modules/@actdim/dynstruct-mui/llms.txt) <br> [docs/](../node_modules/.pnpm/@actdim+dynstruct-mui@1.12._dbfecc25c230812454a35b7fc03c90af/node_modules/@actdim/dynstruct-mui/docs) <br> manifest metadata (`ai`) |
| **`@actdim/msgmesh`** | `npm` | `1.12.2` | [AGENTS.md](../node_modules/.pnpm/@actdim+msgmesh@1.12.2_@act_ada671f90b40be71a7baed66a398f37c/node_modules/@actdim/msgmesh/AGENTS.md) <br> [CLAUDE.md](../node_modules/.pnpm/@actdim+msgmesh@1.12.2_@act_ada671f90b40be71a7baed66a398f37c/node_modules/@actdim/msgmesh/CLAUDE.md) <br> [llms-full.txt](../node_modules/.pnpm/@actdim+msgmesh@1.12.2_@act_ada671f90b40be71a7baed66a398f37c/node_modules/@actdim/msgmesh/llms-full.txt) <br> [llms.txt](../node_modules/.pnpm/@actdim+msgmesh@1.12.2_@act_ada671f90b40be71a7baed66a398f37c/node_modules/@actdim/msgmesh/llms.txt) <br> [docs/](../node_modules/.pnpm/@actdim+msgmesh@1.12.2_@act_ada671f90b40be71a7baed66a398f37c/node_modules/@actdim/msgmesh/docs) <br> manifest metadata (`ai`) |
| **`@actdim/ui-core`** | `npm` | `1.12.2` | [AGENTS.md](../node_modules/.pnpm/@actdim+ui-core@1.12.2_cf596066e6c8cf207f71129b8d105d17/node_modules/@actdim/ui-core/AGENTS.md) <br> [CLAUDE.md](../node_modules/.pnpm/@actdim+ui-core@1.12.2_cf596066e6c8cf207f71129b8d105d17/node_modules/@actdim/ui-core/CLAUDE.md) <br> [llms-full.txt](../node_modules/.pnpm/@actdim+ui-core@1.12.2_cf596066e6c8cf207f71129b8d105d17/node_modules/@actdim/ui-core/llms-full.txt) <br> [llms.txt](../node_modules/.pnpm/@actdim+ui-core@1.12.2_cf596066e6c8cf207f71129b8d105d17/node_modules/@actdim/ui-core/llms.txt) <br> [docs/](../node_modules/.pnpm/@actdim+ui-core@1.12.2_cf596066e6c8cf207f71129b8d105d17/node_modules/@actdim/ui-core/docs) <br> manifest metadata (`ai`) |
| **`@actdim/utico`** | `npm` | `1.12.2` | [AGENTS.md](../node_modules/.pnpm/@actdim+utico@1.12.2_dexie@4.4.5_luxon@3.7.2_uuid@13.0.2/node_modules/@actdim/utico/AGENTS.md) <br> [CLAUDE.md](../node_modules/.pnpm/@actdim+utico@1.12.2_dexie@4.4.5_luxon@3.7.2_uuid@13.0.2/node_modules/@actdim/utico/CLAUDE.md) <br> [llms-full.txt](../node_modules/.pnpm/@actdim+utico@1.12.2_dexie@4.4.5_luxon@3.7.2_uuid@13.0.2/node_modules/@actdim/utico/llms-full.txt) <br> [llms.txt](../node_modules/.pnpm/@actdim+utico@1.12.2_dexie@4.4.5_luxon@3.7.2_uuid@13.0.2/node_modules/@actdim/utico/llms.txt) <br> [docs/](../node_modules/.pnpm/@actdim+utico@1.12.2_dexie@4.4.5_luxon@3.7.2_uuid@13.0.2/node_modules/@actdim/utico/docs) <br> manifest metadata (`ai`) |
| **`@mui/material`** | `npm` | `9.5.0` | [docs/](../node_modules/.pnpm/@mui+material@9.5.0_@emotio_cc6eaba2e86bbe5501d47201a463fa74/node_modules/@mui/material/docs) |
| **`cytoscape`** | `npm` | `3.34.2` | [AGENTS.md](../node_modules/.pnpm/cytoscape@3.34.2/node_modules/cytoscape/AGENTS.md) |
| **`react-router`** | `npm` | `7.18.2` | [docs/](../node_modules/.pnpm/react-router@7.18.2_react-d_ebd9f6aaf916bfadf05eff1070ce6f8a/node_modules/react-router/docs) |

## Transitive Dependency Guidelines & Invariants

No exported invariants detected across current dependencies.

## Usage in Agent Sessions
When working on features involving any of the modules or external libraries above:
1. **Internal Submodules**: Follow conventions in the linked package `AGENTS.md` or package `docs/`.
2. **Third-Party Libraries**: Read the linked instruction files directly for framework-specific patterns and best practices.

---

## Document: docs/topic--domain-model.md (Dashboard UI Domain Model & Visualized Entities)

# Dashboard UI Domain Model & Visualized Entities

The Along Dashboard UI models and visualizes the provider-agnostic entity graph stored in `.along/`.

---

## Entity Taxonomy

The dashboard renders the following core Along entities:

1. **Issues (`feat`, `bug`, `debt`, `task`, `docs`, `spike`)**:
   Units of engineering work stored in `.along/ISSUES/<type>--<slug>.md`. Categorized into Kanban columns based on `status: open | in-progress | blocked | done`. A risk or blocker is an issue tagged `risk`.
2. **Decisions (ADRs)**:
   Architectural decision records stored in `.along/DECISIONS/ADR-YYYY-MM-DD--<slug>.md`. Tracked by status (`accepted`, `superseded`, `deprecated`).
3. **Milestones**:
   Sprint and release targets stored in `.along/MILESTONES/vX.Y.Z--<slug>.md`. Aggregates target issue completion ratios.
4. **Sessions**:
   Historical agent execution summaries stored in `.along/SESSIONS/<YYYY>/<date>--<slug>.md`.

---

## Front-Matter Schemas

Entities ingested by `DashboardApiService` share a common YAML front-matter envelope:

```yaml
---
protocol: along
protocol_version: "4.4.16"
slug: <kebab-slug>
title: "<Human Readable Title>"
type: feat | bug | debt | task | docs
status: open | in-progress | blocked | done
priority: high | medium | low
created: YYYY-MM-DD
updated: YYYY-MM-DD
agent: antigravity
tags: [tag1, tag2]
parent: <optional-parent-key>
blocked_by: [<dependency-key>]
related: [<related-key>]
---
```

### Visual Model Mapping
The dashboard maps entity front-matter into `FullDashboardData`:
- `id`: canonical key `<type>--<slug>`.
- `title`, `status`, `priority`: rendered in Kanban cards and header badges.
- `blocked_by`, `parent`: transformed into directed graph edges for Cytoscape.

---

## Graph Relationships

The DAG Graph view (`DAGGraphView.tsx`) visualizes dependency topologies:

```mermaid
flowchart TD
    MILESTONE["Milestone (target_issues)"]
    PARENT["Parent Umbrella Issue"]
    CHILD1["Child Issue 1"]
    CHILD2["Child Issue 2"]
    BLOCKER["Blocker Issue"]
    
    PARENT --> CHILD1
    PARENT --> CHILD2
    BLOCKER -.->|blocks| CHILD2
    MILESTONE --> PARENT
    MILESTONE --> CHILD1
    MILESTONE --> CHILD2
```

1. **Parent-Child Hierarchy (`parent`)**: Solid arrows connecting subproject or child tasks to their enclosing umbrella issue.
2. **Blocking Dependencies (`blocked_by`)**: Dashed red arrows representing critical path bottlenecks preventing issue advancement.
3. **Milestone Targets (`target_issues`)**: Enclosing clusters grouping issues scheduled for a release.

---

## Document: docs/topic--setup-and-workflow.md (Dashboard UI Setup, Installation & Developer Workflow)

# Dashboard UI Setup, Installation & Developer Workflow

This guide details the development environment setup, execution commands, and verification gates for `@along/dashboard-ui`.

---

## Prerequisites

To build and run the Dashboard UI package:

- **Node.js**: Version 20 LTS or higher (`node -v >= 20.0.0`).
- **Package Manager**: `pnpm` version 10.x (`pnpm -v >= 10.0.0`).
- **Dependencies**: All packages listed in `package.json`, including `@actdim/ui-core@^1.9.1` and `@actdim/dynstruct@^1.9.1`.
- **Along CLI**: `along` command available on `PATH` for running protocol gates and KB sync.

---

## Runner Commands

All scripts are executed from the `packages/dashboard-ui` working directory:

### Development Server
Starts the Vite dev server with hot module replacement (HMR):
```bash
pnpm run dev
```

### Static Build
Compiles TypeScript types and produces optimized production bundles in `dist/`:
```bash
pnpm run build
```

### Type Checking
Performs strict TypeScript verification without emitting javascript files:
```bash
pnpm run typecheck
```

### Automated Unit Tests
Runs the test suite using Vitest with Happy-DOM:
```bash
pnpm test
```

### API Client Generation
Re-generates typed TypeScript API clients from `openapi.json` using NSwag:
```bash
pnpm run generate:api
```

---

## Quality Gates

Before submitting changes or closing tasks in `packages/dashboard-ui`, all of the following quality checks must pass:

1. **Type Safety (`typecheck`)**:
   `pnpm run typecheck` must finish with 0 compiler errors. No `any` or `as` type casts.
2. **Test Suite (`test`)**:
   `pnpm test` must achieve a 100% pass rate.
3. **Production Build (`build`)**:
   `pnpm run build` must produce clean Vite output without bundling warnings.
4. **Clean ASCII Gate (`along sanitize`)**:
   `along sanitize --check` must detect 0 prohibited typographic or invisible characters.
5. **Knowledge Base Integrity (`along kb-sync`)**:
   `along kb-sync` must verify 0 broken relative Markdown links across topic files.
