<< All versions
Skill v1.0.1
currentAutomated scan100/100lichtblick-suite/lichtblick/panel-user-scripts
+3 new
──Details
PublishedAugust 18, 2026 at 11:06 PM
Content Hashsha256:d4a2ba2de8ad60f1...
Git SHA355014d99402
Bump Typepatch
──Files
Files (1 file, 3.1 KB)
SKILL.md3.1 KBactive
SKILL.md · 92 lines · 3.1 KB
version: "1.0.1" name: "panel-user-scripts" description: "Deep UserScripts panel knowledge: Monaco editor integration, UserScriptPlayer wrapper, TypeScript compilation in the transformer Worker, sandboxed runtime Worker execution, diagnostics, and the script API."
Panel User Scripts Skill
The in-app TypeScript editor that lets users write custom message transformations.
Architecture
UserScripts Panel (Monaco editor)│▼UserScriptPlayer (wraps the base Player)│├── Transformer Worker (compiles + reports diagnostics)│ └── TypeScript compiler (in-Worker)│└── Runtime Worker (sandboxed script execution)└── user code runs here (isolated)
Core Components
| File | Role | |
|---|---|---|
panels/UserScriptEditor/ | Monaco editor UI, diagnostics display | |
players/UserScriptPlayer/index.ts | Player wrapper, Worker pool management | |
players/UserScriptPlayer/transformerWorker/ | TypeScript compilation in a Worker | |
players/UserScriptPlayer/runtimeWorker/ | Sandboxed script execution |
Script Lifecycle
- User writes TypeScript in Monaco
- On save: code is sent to the Transformer Worker for compilation
- Transformer compiles TS → JS and reports diagnostics (errors/warnings)
- On success: the JS bundle is sent to the Runtime Worker
- During playback: messages on input topics → Runtime Worker → output messages
- Output messages are injected into
PlayerStateas additional topics
Worker Naming Pattern
typescript
// unique name per instance — isolates workers per tab (no cross-tab sharing)new SharedWorker(new URL("./transformerWorker/index", import.meta.url), {name: uuidv4(),});
SharedWorkeris the worker type, but cross-tab instance reuse is disabled by unique naming.- Within a single player lifetime, runtime workers are reused/pooled where possible.
- Each active script processor maps to an isolated runtime execution context.
Monaco Integration
- Full TypeScript language service (autocomplete, errors, hover)
- Custom Lichtblick script-API type definitions injected
- Diagnostics shown inline and in a panel below the editor
Script API
typescript
export const inputs = ["/camera/image"];export const output = "/processed_image";export default function transform(event: MessageEvent): OutputMessage {return {/* processed data */};}
Performance Notes
- Script execution never blocks the main thread (Worker isolation)
- Unchanged scripts don't recompile (compilation caching)
- Only subscribed input topics are forwarded to the Worker
- Runtime errors in user code are contained — they don't crash the app
- Each Runtime Worker has its own heap (no cross-script interference)
Key Files
packages/suite-base/src/panels/UserScriptEditor/packages/suite-base/src/players/UserScriptPlayer/index.tspackages/suite-base/src/players/UserScriptPlayer/transformerWorker/packages/suite-base/src/players/UserScriptPlayer/runtimeWorker/
Skills Reference
- For SharedWorker patterns: load
web-workersskill