Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AMAP ML SkillClaw Dashboard App JS

From Leeroopedia
Knowledge Sources
Domains Dashboard, Frontend, Skill_Evolution
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete single-page JavaScript application for the SkillClaw dashboard, providing interactive browsing of skills, sessions, validation jobs, and version history with bilingual (Chinese/English) support.

Description

The app.js file is a vanilla JavaScript SPA served as a static asset by `dashboard_server.py`. It manages five views (Overview, My Skills, Candidate Pool, Final Pool, Sessions) through a central `state` object and a `dom` reference map. The app fetches data from the dashboard REST API (`/api/v1/overview`, `/api/v1/skills`, `/api/v1/sessions`, `/api/v1/validation/jobs`, `/api/v1/evolve/status`), renders it through template-string HTML generation, and supports operations like sync, push, pull, session export, skill version activation, and validation review submission. Key features include: locale persistence via `localStorage`, skill version comparison with side-by-side document viewing, pipeline event timeline, candidate stage tracking, and session turn-by-turn inspection.

Usage

Use this frontend when you need to:

  • Serve the SkillClaw dashboard UI via `dashboard_server.py` (automatically mounted at `/assets/app.js`)
  • Inspect local vs shared skill sync status visually
  • Track candidate validation progress through the pipeline stages
  • Compare skill versions side-by-side (local current vs shared history)
  • Browse session transcripts with injected/read/modified skill annotations
  • Trigger evolve server operations (sync, push, pull) from the browser

Code Reference

Source Location

  • Repository: SkillClaw
  • File: `skillclaw/dashboard_assets/app.js:L1-2643`

Signature

// Global state object
const state = {
  activeView: "overview",   // Current view: overview|local|candidate|final|sessions
  loading: false,
  locale: "zh",             // "zh" or "en"
  overview: null,           // /api/v1/overview response
  evolve: null,             // /api/v1/evolve/status response
  skills: [],               // /api/v1/skills response
  sessions: [],             // /api/v1/sessions response
  validationJobs: [],       // /api/v1/validation/jobs response
  skillDetails: {},         // Cached skill detail by ID
  sessionDetails: {},       // Cached session detail by ID
  compareSelections: {},    // Version comparison selections
  selectedLocalSkillId: "",
  selectedCandidateJobId: "",
  selectedFinalSkillId: "",
  selectedSessionId: "",
}

// Core functions
function l(zh, en, vars = {}) { /* i18n template substitution */ }
function refreshData({ notice, preserveMessage } = {}) { /* fetch all API endpoints */ }
function renderAll() { /* render all views */ }
async function init() { /* bind events, load data */ }

Import

<!-- Served as static asset by dashboard_server.py -->
<script src="/assets/app.js"></script>

I/O Contract

Inputs

Name Type Required Description
/api/v1/overview JSON Yes Dashboard overview metrics and meta
/api/v1/skills JSON Yes Skill list with local/remote sync status
/api/v1/sessions JSON Yes Session list with skill links
/api/v1/validation/jobs JSON Yes Validation job queue with results
/api/v1/evolve/status JSON Yes Evolve server health and status
/api/v1/skills/{id} JSON No Skill detail (lazy-loaded on selection)
/api/v1/sessions/{id} JSON No Session detail with turns (lazy-loaded)
/api/v1/sync POST No Rebuild dashboard snapshot
/api/v1/ops/pull POST No Pull skills from shared pool
/api/v1/ops/push POST No Push skills to shared pool
/api/v1/ops/trigger-evolve POST No Trigger evolve server cycle
/api/v1/skills/{id}/activate POST No Activate a skill version locally
/api/v1/validation/jobs/{id}/review POST No Submit validation review

Outputs

Name Type Description
DOM updates HTML Rendered skill cards, session cards, validation details, version timelines
API calls fetch() Triggers sync, push, pull, evolve, activate, review operations
locale persistence localStorage Stores locale preference ("en" or "zh")

Usage Examples

Basic Dashboard Serving

# The dashboard server automatically serves app.js as a static asset
from skillclaw.dashboard_server import serve_dashboard
from skillclaw.config import SkillClawConfig

config = SkillClawConfig.from_env()
serve_dashboard(config)
# Dashboard available at http://127.0.0.1:3788/
# app.js loaded automatically by index.html

Triggering Operations from Dashboard

// Inside the dashboard, user clicks trigger buttons:
// "Rebuild Snapshot" → POST /api/v1/sync
// "Refresh" → refetches all API endpoints
// Skill version "Activate" → POST /api/v1/skills/{id}/activate

// Example: refreshData fetches all endpoints in parallel
async function refreshData({ notice = "", preserveMessage = false } = {}) {
  const [overview, skills, sessions, validation, evolve] = await Promise.all([
    getJson("/api/v1/overview"),
    getJson("/api/v1/skills?limit=500"),
    getJson("/api/v1/sessions?limit=500"),
    getJson("/api/v1/validation/jobs?limit=500"),
    getJson("/api/v1/evolve/status"),
  ])
  // state updated, renderAll() called
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment