Agent Skillslichtblick-suite/lichtblick › message-pipeline

message-pipeline

GitHub

MessagePipeline是连接Player与Panel的核心数据总线,基于Zustand和React Context实现。涵盖状态流转、订阅合并、选择器通知及性能优化机制,为面板提供细粒度渲染支持。

.github/skills/message-pipeline/SKILL.md lichtblick-suite/lichtblick

触发场景

理解或修改消息管道架构 排查Panel数据同步问题 优化Zustand订阅性能

安装

npx skills add lichtblick-suite/lichtblick --skill message-pipeline -g -y
更多选项

非标准路径

npx skills add https://github.com/lichtblick-suite/lichtblick/tree/develop/.github/skills/message-pipeline -g -y

不安装直接使用

npx skills use lichtblick-suite/lichtblick@message-pipeline

指定 Agent (Claude Code)

npx skills add lichtblick-suite/lichtblick --skill message-pipeline -a claude-code -g -y

安装 repo 全部 skill

npx skills add lichtblick-suite/lichtblick --all -g -y

预览 repo 内 skill

npx skills add lichtblick-suite/lichtblick --list

SKILL.md

Frontmatter
{
    "name": "message-pipeline",
    "description": "Deep MessagePipeline implementation knowledge: zustand store shape, React context provider, subscription merging\/memoization, render-state flow, and the Player→panel data bus."
}

Message Pipeline Skill

The MessagePipeline is the central data bus connecting Players to Panels.

Data Flow

Player (emits PlayerState)
    │  playerListener callback
    ▼
MessagePipeline (zustand store + React context)
    │  selector-based notifications
    ▼
PanelExtensionAdapter (per-panel bridge)
    │
    ▼
Panel (receives RenderState)

Core Files

File Role
packages/suite-base/src/components/MessagePipeline/index.tsx React context provider; creates the zustand store and connects to the Player
packages/suite-base/src/components/MessagePipeline/store.ts MessagePipelineInternalState + dispatch actions
packages/suite-base/src/components/MessagePipeline/types.ts MessagePipelineContext — the interface panels see
packages/suite-base/src/components/MessagePipeline/subscriptions.ts Subscription merging + memoization
packages/suite-base/src/components/MessagePipeline/selectors.ts Selector helpers for fine-grained subscriptions

Store Update Flow

  1. Player emits state → the playerListener callback fires
  2. Store dispatch → the "update" action merges the new PlayerState into internal state
  3. Selectors react → zustand subscribers (panels) are notified via selector equality checks
  4. Render state builtPanelExtensionAdapter incrementally builds RenderState per panel

Internal Store Actions

  • "update" — new PlayerState received from the player listener
  • "set-subscriptions" — a panel's subscriptions changed
  • "playback-seek" — user seeks to a new time
  • "set-playback-speed" — playback rate changed

Subscription System

Panels declare the topics they need:

context.subscribe([{ topic: "/camera/image" }]);

The pipeline:

  1. Collects subscriptions from all active panels
  2. Merges overlapping subscriptions (deduplicates topics)
  3. Forwards the merged set to the Player via player.setSubscriptions()
  4. The Player only iterates topics that are actually subscribed

Subscription Memoization

  • subscriptions.ts uses reference equality to avoid recomputing the merged subscription set
  • A Player update is only triggered when the effective topic set changes

MessagePipelineContext (what panels access)

  • playerState — current player status (playing, paused, error)
  • activeData — messages, currentTime, startTime, endTime, topics, datatypes
  • messagesByTopicMap<topic, messages> for the current frame
  • sortedTopics — alphabetically sorted topic list
  • subscriptions — currently active subscriptions
  • seekPlayback(time) — seek to a specific time
  • setPlaybackSpeed(speed) — change playback rate

Performance Notes

  • Zustand selectors enable per-panel, fine-grained updates (no full re-renders)
  • messagesByTopic is rebuilt only when new messages arrive (not every frame)
  • Subscription merging prevents redundant data iteration in the Player
  • Render state is built incrementally — only changed fields are recomputed

Skills Reference

  • For the panel-side bridge and RenderState contract: load panel-extension-api skill
  • For Player internals upstream of the pipeline: load player-internals skill

版本历史

  • 6435710 当前 2026-08-16 02:35
  • cab9317 2026-07-24 12:17

同 Skill 集合

.github/skills/3d-rendering/SKILL.md
.github/skills/caching-internals/SKILL.md
.github/skills/deserialization/SKILL.md
.github/skills/e2e-playwright-mcp/SKILL.md
.github/skills/electron-internals/SKILL.md
.github/skills/extensions-internals/SKILL.md
.github/skills/layouts-internals/SKILL.md
.github/skills/mcap-format/SKILL.md
.github/skills/message-path/SKILL.md
.github/skills/panel-extension-api/SKILL.md
.github/skills/panel-image/SKILL.md
.github/skills/panel-log/SKILL.md
.github/skills/panel-map/SKILL.md
.github/skills/panel-raw-messages/SKILL.md
.github/skills/panel-state-transitions/SKILL.md
.github/skills/panel-user-scripts/SKILL.md
.github/skills/performance/SKILL.md
.github/skills/player-internals/SKILL.md
.github/skills/plot-internals/SKILL.md
.github/skills/release-process/SKILL.md
.github/skills/remote-caching/SKILL.md
.github/skills/test-conventions/SKILL.md
.github/skills/theme/SKILL.md
.github/skills/unit-testing/SKILL.md
.github/skills/web-workers/SKILL.md
.github/skills/websocket-connection/SKILL.md

元信息

文件数
0
版本
355014d
Hash
595110b6
收录时间
2026-07-24 12:17

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-30 15:27
浙ICP备14020137号-1 $访客地图$