Skip to content

Agent district map: visual-friendly API endpoint returning district unlock state as GeoJSON-like structure #306

Description

@leocagli

Context

Issue #300 adds district unlock progress tracking. This companion issue adds a map-oriented endpoint that returns all districts in a format suitable for visualization — UI clients can render a map of unlocked vs locked districts per agent.

What to implement

Route: GET /api/agents/[id]/districts/map

Response (GeoJSON-like, renderer-agnostic):

{
  "agentId": "bot-1",
  "districts": [
    {
      "id": "sector-alpha",
      "label": "Sector Alpha",
      "status": "unlocked",
      "unlockedAt": 1719432000000,
      "xpRequired": 500,
      "xpAtUnlock": 531
    },
    {
      "id": "sector-beta",
      "label": "Sector Beta",
      "status": "locked",
      "xpRequired": 1500,
      "xpCurrent": 531,
      "progressPct": 35
    }
  ]
}

Static district metadata (lib/districts/district-registry.ts)

Labels and any future display metadata (color, icon slug) live here. Separate from unlock logic.

Acceptance criteria

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions