Lichtblick

repository·develop·Indexed 21 days ago

https://github.com/lichtblick-suite/lichtblick

An integrated visualization and diagnosis tool for robotics, available as a web browser application or a desktop application for Linux, Windows, and macOS. The suite includes core components for data playback, 3D rendering, and a specialized AI Agent System for development using GitHub Copilot, featuring domain-specific agents, skills, and MCP server integrations.

Tokens
80.6K
Snippets
241
Records
363
Agent score
76%

What's inside lichtblick

  1. Use Page Object Models (POMs) for E2E tests

    develop

    Lichtblick uses Page Object Models (POMs) located in e2e/page-objects/ to encapsulate UI interactions. This allows tests to focus on behavior rather than brittle selectors.

    When to use POMs: Use them for common, repeated interactions like dismissing dialogs, navigating sidebars, or controlling playback. When to use direct selectors: Use direct selectors only for one-off, test-specific elements that do not appear across multiple tests.

    Available POMs

    POMPurposeKey Methods
    DataSourceDialogData source dialog interactionsclose(), openConnection(), isVisible(), getLocator()
    SidebarLeft/right sidebar tabsopenLayoutsTab(), openTopicsTab(), toggleLeftSidebar(), getLeftSidebar(), getPanelSettingsTab()
    PlayerControlsPlayback controlsplay(), pause(), seekForward(), setSpeed(), getTimestampValue(), getPlayButton(), getSlider()
    LayoutManagerLayout CRUDopenDefaultLayout(), createNewLayout(), selectPanel(), revertLayout(), getLayoutListItem()
    ExtensionManagerExtension workflowsopen(), search(), findExtension(), uninstall(), getSearchBar()
    AppMenuApp menu navigationopenFile(), openViewMenu(), importLayoutFromMenu(), getMenuButton()
    PanelsPanel operationsaddPanel(), addPanelFromSearch(), setTopicPath(), splitPanelDown(), getAddPanelButton(), getLogPanelRoot()
    import { test, expect } from "../../../fixtures/electron";
    import { DataSourceDialog, Sidebar, LayoutManager } from "../../../page-objects";
    
    test("create a new layout", async ({ mainWindow }) => {
      const dialog = new DataSourceDialog(mainWindow);
      const sidebar = new Sidebar(mainWindow);
      const layout = new LayoutManager(mainWindow);
    
      // Given
      await dialog.close();
      await sidebar.openLayoutsTab();
    
      // When
      await layout.openDefaultLayout();
      await layout.createNewLayout();
      await layout.selectPanel("Diagnostics – Detail (ROS)");
    
      // Then
      await expect(mainWindow.getByText("Unnamed layout").nth(0)).toBeVisible();
    });
  2. How the Lichtblick AI Agent System works

    develop

    The Lichtblick AI Agent System is designed to assist with development tasks via GitHub Copilot using a structured hierarchy of agents, skills, and instructions.

    Core Abstractions

    • Agents: Domain-specific specialists invoked by name (e.g., @lb-player). Each agent is defined in .github/agents/ using a .agent.md file containing YAML frontmatter with a description and tools field. They contain embedded domain knowledge and allowed tools.
    • Skills: Deep-dive knowledge modules located in .github/skills/ (defined by SKILL.md). Agents load these on-demand by referencing them by name (e.g., "load player-internals skill") to access implementation details.
    • Instructions: Coding conventions located in .github/instructions/ (defined by .instructions.md). These are applied automatically to any file matching their applyTo glob pattern, ensuring consistent code style without manual invocation.
    • Prompts: Reusable workflow prompts located in .github/prompts/ (defined by .prompt.md).

    Directory Structure

    .github/
    ├── agents/          # Domain-specific agent definitions (.agent.md)
    ├── skills/          # Deep-dive knowledge modules (SKILL.md)
    ├── prompts/         # Reusable workflow prompts (.prompt.md)
    └── instructions/    # Auto-applied coding conventions (.instructions.md)
    <!-- Example of how an agent is invoked in a developer workflow -->
    @lb-player help me implement a new data source lifecycle step
  3. How useMessageReducer state management works

    develop

    The useMessageReducer hook manages a state of type T using two primary lifecycle functions:

    1. The restore function

    • Initialization: Called with undefined when the panel first renders or when the user seeks to a different playback time (which clears state across all panels).
    • Parameter Changes: Called with the previous state when the restore or addMessage/addMessages functions change. This allows you to reuse existing data when updating logic (e.g., changing a filter) instead of waiting for new messages to arrive.

    2. The addMessages function

    • Update: Called whenever new messages arrive on the subscribed topics.
    • Batching: Unlike the deprecated addMessage, addMessages provides an array of all messages received since the last call, making it more efficient for high-frequency data.

    Note: You must provide either addMessages or addMessage, but not both. Providing neither or both will result in an error.

  4. Understand the Lichtblick AI Agent System Skills

    develop

    Lichtblick uses a system of 'Skills' to provide AI agents with deep implementation knowledge. Skills are stored as Markdown files in .github/skills/<name>/SKILL.md and use YAML frontmatter with a description field. Agents load these skills on demand to perform specialized tasks.

    Key skill areas include:

    • Rendering & Graphics: 3d-rendering (THREE.js, WebGL), panel-image (WorkerImageDecoder).
    • Data & Protocols: mcap-format (MCAP specification), deserialization (schema parsing), websocket-connection (Foxglove protocol).
    • System Internals: electron-internals, extensions-internals, layouts-internals, message-pipeline.
    • Infrastructure: web-workers (Comlink), remote-caching (HTTP-layer caching), performance (profiling/optimization).
    • Testing: unit-testing, test-conventions, e2e-playwright-mcp.
  5. Configure and use MCP Servers for AI Agents

    develop

    Lichtblick uses the Model Context Protocol (MCP) to expose external tools to AI agents (e.g., VS Code Copilot, Claude Code, Cursor). Configuration is located in .mcp.json at the repository root.

    Available Servers

    • github (Type: HTTP): Allows agents to read/create GitHub Issues and Pull Requests. Authenticated automatically via GitHub Copilot.
    • playwright (Type: stdio/npx): Drives Chrome for web app exploration and E2E test scaffold generation.

    Usage Pattern

    Agents reference tools using the server name as a namespace prefix:

    • github/get_issue
    • github/create_pull_request

    Note: The playwright server only automates the web app. It cannot automate the Electron desktop app; desktop tests rely on source reading to discover selectors.

    // .mcp.json (conceptual structure)
    {
      "mcpServers": {
        "github": { ... },
        "playwright": { ... }
      }
    }
  6. Run Lichtblick via Docker

    develop

    To quickly run Lichtblick without local installation, use the official Docker image. This will host the application and make it available in your browser.

    1. Run the container: docker run --rm -p 8080:8080 ghcr.io/lichtblick-suite/lichtblick:latest
    2. Access the app at: http://localhost:8080/
    docker run --rm -p 8080:8080 ghcr.io/lichtblick-suite/lichtblick:latest
  7. Analyze E2E test performance

    develop

    To identify performance bottlenecks, you can generate a summary report of test execution times. This report includes overall statistics (passed/failed/skipped), the top 10 slowest tests, a list of failed tests with retry information, and total/average execution times.

    Run the following commands to execute tests and generate the summary:

    # Run desktop tests and generate summary
    yarn test:e2e:desktop
    yarn test:e2e:summary
    yarn test:e2e:desktop
    yarn test:e2e:summary
  8. Add a new Skill

    develop

    To add a new Skill (providing deep knowledge to agents), create a directory at .github/skills/<name>/ and place a SKILL.md file inside it. The file requires a YAML frontmatter block with a description.

    Example structure:

    ---
    description: "Brief description of the deep knowledge this skill provides."
    ---
    
    # Skill Name
    
    ## Implementation Details
    
    ...
  9. Run Lichtblick Benchmarks

    develop

    Lichtblick Benchmarks consist of specific combinations of layout and synthetic data playback. To run a benchmark, you must first start a development or production build of the application, then navigate to a benchmark URL listed in the benchmarks.txt file. Upon opening a benchmark URL, playback starts automatically, and summary results are printed to the developer console.

    # To start the benchmark development build
    yarn benchmark:serve
    
    # To run the production build
    yarn benchmark:build:prod
    npx serve -p 8080 benchmark/.webpack
  10. Quick start with @lichtblick/suite-base

    develop

    The @lichtblick/suite-base package provides core components for the Lichtblick ecosystem. When contributing to the codebase, you can import core types and utilities either from the top-level package entry point or from specific sub-paths for utilities.

    Commonly used exports include ExtensionInfo, ExtensionLoaderContext, and IExtensionLoader for extension management, as well as fuzzyFilter for utility functions.

    import { ExtensionInfo, ExtensionLoaderContext, IExtensionLoader } from "@lichtblick/suite-base";
    import fuzzyFilter from "@lichtblick/suite-base/util/fuzzyFilter";
  11. AI-Assisted Test Authoring with Playwright MCP

    develop

    The project integrates the Playwright MCP server to allow AI agents (like GitHub Copilot or Claude) to assist in E2E test development. The server provides structured accessibility snapshots (ARIA roles, names, test IDs) instead of screenshots, allowing LLMs to generate reliable selectors.

    Workflow

    1. Start the web app: yarn web:serve.
    2. Open VS Code agent mode (Copilot Chat) and invoke @lb-e2e-test.
    3. The MCP server starts and opens a Chromium browser.
    4. Ask the agent to navigate to http://localhost:8080 and explore the UI.
    5. Use the agent to capture accessibility snapshots and generate test scaffolds following project conventions.

    Prerequisites

    • VS Code with GitHub Copilot extension.
    • Copilot agent mode enabled (VS Code 1.99+).
    • The .mcp.json file at the repo root must be present.

    Limitations

    • The MCP server controls Chromium (web version), not Electron directly. Use it for selector discovery and scaffolding, but use custom fixtures for Electron-specific behavior.
    • It is a development-time tool and does not affect CI/CD.