[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XCCG41M994JJEX6VN52PEP":3,"skill-same:01M6XCCG41M994JJEX6VN52PEP":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":13,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference",null,"Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"worldmonitor reference","worldmonitor","reference","hierarchy","css","source","for","layer","extracting","panel","patterns","edge functions","integrations","open","api","data","scheduler","architecture","dashboard","typescript","2026-11-10 10:12:30",false,"---\nname: worldmonitor-reference\ndescription: Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.\n---\n\n# WorldMonitor Architecture Reference\n\nWorldMonitor is a real-time global intelligence dashboard built with vanilla TypeScript (no framework). This skill provides a curated index of its architecture, organized by the patterns most relevant to building a personal daily monitor.\n\n## When to Use\n\n- You are creating a new dashboard panel and need to follow WorldMonitor conventions\n- You need to understand how a specific pattern works before adapting it\n- You are deciding which WorldMonitor patterns to adopt vs. simplify for a personal project\n\n## Project Overview\n\n| Aspect | Detail |\n|--------|--------|\n| **Language** | TypeScript (strict), vanilla DOM — no React\u002FVue\u002FAngular |\n| **Bundler** | Vite |\n| **Deployment** | Vercel (60+ Edge Functions) + Railway (WebSocket relay) |\n| **Desktop** | Tauri 2 (Rust) with Node.js sidecar |\n| **Map engines** | globe.gl + Three.js (3D), deck.gl + MapLibre GL (2D) |\n| **CSS** | Custom properties, dark\u002Flight themes, responsive grid |\n| **API contracts** | Protocol Buffers (92 proto files, 22 services) |\n| **Data sources** | 435+ RSS feeds, 45 data layers, 30+ live video streams |\n\n## Directory Structure\n\n```\nworldmonitor\u002F\n├── src\u002F\n│   ├── main.ts                    # Entry point: Sentry, analytics, App bootstrap\n│   ├── App.ts                     # Root application class\n│   ├── components\u002F                # All UI panel classes (80+ files)\n│   │   ├── Panel.ts               # *** BASE CLASS — most important file ***\n│   │   ├── VirtualList.ts         # Virtual scrolling for large lists\n│   │   ├── NewsPanel.ts           # News with clustering, NER, summaries\n│   │   ├── MarketPanel.ts         # Stock market with sparklines\n│   │   ├── SearchModal.ts         # Cmd+K command palette\n│   │   ├── InsightsPanel.ts       # AI briefing + metrics\n│   │   ├── WorldClockPanel.ts     # Multi-timezone clock\n│   │   └── ...                    # 70+ more panels\n│   ├── services\u002F                  # Data layer (117 files)\n│   │   ├── runtime.ts             # SmartPollLoop, desktop detection, fetch routing\n│   │   ├── bootstrap.ts           # Initial data hydration from Redis\n│   │   ├── rss.ts                 # RSS feed aggregation\n│   │   ├── news\u002Findex.ts          # News fetching + processing\n│   │   ├── market\u002Findex.ts        # Market data (Yahoo Finance, Finnhub)\n│   │   ├── i18n.ts                # 21-language internationalization\n│   │   ├── threat-classifier.ts   # 3-stage threat classification\n│   │   ├── clustering.ts          # News headline clustering\n│   │   └── ...                    # 100+ more services\n│   ├── config\u002F                    # Static configuration\n│   │   ├── variant.ts             # Multi-variant (world\u002Ftech\u002Ffinance\u002Fcommodity\u002Fhappy)\n│   │   ├── feeds.ts               # 435+ RSS feed definitions\n│   │   ├── panels.ts              # Panel enable\u002Fdisable config\n│   │   ├── markets.ts             # Stock symbol lists\n│   │   └── ...\n│   ├── app\u002F                       # Application-level modules\n│   │   ├── app-context.ts         # Shared state (inFlight, isDestroyed)\n│   │   ├── refresh-scheduler.ts   # *** REFRESH PATTERN ***\n│   │   ├── panel-layout.ts        # Grid layout management\n│   │   ├── search-manager.ts      # Command palette logic\n│   │   └── event-handlers.ts      # Global keyboard\u002Fvisibility events\n│   ├── utils\u002F                     # Utilities (22 files)\n│   │   ├── dom-utils.ts           # h(), fragment(), replaceChildren() — JSX-free helpers\n│   │   ├── sanitize.ts            # escapeHtml(), sanitizeUrl() — XSS prevention\n│   │   ├── index.ts               # formatTime, formatNumber, etc.\n│   │   └── ...\n│   ├── styles\u002F                    # CSS\n│   │   ├── main.css               # *** THEME VARIABLES + GRID LAYOUT ***\n│   │   ├── panels.css             # Panel-specific styles (tabs, rows, badges)\n│   │   ├── base-layer.css         # Foundation layer\n│   │   └── ...\n│   └── generated\u002F                 # Auto-generated from .proto files\n│       ├── client\u002F                # TypeScript API clients\n│       └── server\u002F                # TypeScript API handlers\n├── api\u002F                           # Vercel Edge Functions (60+)\n│   ├── _cors.js                   # CORS origin allowlist\n│   ├── _rate-limit.js             # Upstash Redis rate limiting\n│   ├── _api-key.js                # API key injection\n│   ├── bootstrap.js               # Pre-fetch 15 Redis keys for first render\n│   ├── rss-proxy.js               # RSS feed proxy with domain allowlist\n│   ├── market\u002Fv1\u002F[rpc].ts         # Market data endpoints (proto-first)\n│   ├── news\u002Fv1\u002F[rpc].ts           # News endpoints\n│   └── ...                        # 22 service domains\n├── server\u002F                        # Railway relay server\n├── proto\u002F                         # Protocol Buffer definitions\n└── tests\u002F                         # 30 test files, 554 test cases\n```\n\n## Core Pattern: Panel Base Class\n\n**File**: `src\u002Fcomponents\u002FPanel.ts` (~1000 lines)\n\nThe Panel class is the foundation for ALL UI components (80+ panels inherit from it).\n\n### Constructor Options\n\n```typescript\ninterface PanelOptions {\n  id: string;          \u002F\u002F Unique panel identifier (used in DOM data-panel attr)\n  title: string;       \u002F\u002F Display title in header\n  showCount?: boolean; \u002F\u002F Show item count badge\n  className?: string;  \u002F\u002F Additional CSS class (e.g., 'panel-wide')\n  trackActivity?: boolean; \u002F\u002F Enable activity tracking\n  infoTooltip?: string;    \u002F\u002F Hover tooltip text\n  premium?: 'locked' | 'enhanced'; \u002F\u002F Pro feature gating\n}\n```\n\n### DOM Structure\n\n```\ndiv.panel[data-panel=\"{id}\"]\n├── div.panel-header\n│   ├── div.panel-header-left\n│   │   ├── span.panel-title\n│   │   └── span.panel-new-badge (optional)\n│   ├── span.panel-data-badge (optional, \"LIVE\"\u002F\"CACHED\")\n│   └── span.panel-count (optional)\n├── div.panel-content\n│   └── (loading spinner | error state | rendered content)\n└── div.panel-resize-handle\n```\n\n### Key Methods\n\n| Method | Purpose |\n|--------|---------|\n| `getElement()` | Returns the outer `div.panel` |\n| `showLoading(msg?)` | Display spinner + message |\n| `showError(msg, onRetry?)` | Display error with optional retry button |\n| `setContent(html)` | Set content innerHTML (debounced 150ms) |\n| `setContentDirect(html)` | Set content immediately (no debounce) |\n| `setCount(n)` | Update the count badge |\n| `setStatusBadge(label, type)` | Show \"LIVE\"\u002F\"CACHED\" badge |\n| `show() \u002F hide()` | Toggle visibility |\n| `destroy()` | Remove element, abort controller, cleanup listeners |\n\n### Resize System\n\nPanels support both row span (1-4 rows) and column span (1-3 cols) resizing via drag handles. Sizes are persisted in `localStorage` with keys `worldmonitor-panel-spans` and `worldmonitor-panel-col-spans`.\n\n## Core Pattern: Data Service Layer\n\n**Directory**: `src\u002Fservices\u002F` (117 files)\n\n### SmartPollLoop\n\n**File**: `src\u002Fservices\u002Fruntime.ts`\n\nInstead of raw `setInterval`, WorldMonitor uses `startSmartPollLoop()`:\n\n```typescript\nconst loop = startSmartPollLoop(async () => {\n  \u002F\u002F fetch data, return boolean for success\u002Ffailure\n}, intervalMs);\nloop.stop(); \u002F\u002F cleanup\n```\n\nFeatures:\n- Exponential backoff on failure (1x → 2x → 4x, capped at 8x)\n- Hidden-tab throttle (pauses when `document.hidden`)\n- Circuit breaker integration (stops after N consecutive failures)\n- Adaptive refresh (can adjust interval based on data freshness)\n\n### Service Module Convention\n\nEach service is a module (not a class) exporting async functions:\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fmarket\u002Findex.ts\nexport async function fetchMarketQuotes(symbols: string[]): Promise\u003CMarketQuote[]> { ... }\nexport async function fetchMarketNews(): Promise\u003CMarketNews[]> { ... }\n```\n\nServices call `\u002Fapi\u002F...` proxy endpoints, never external APIs directly.\n\n## Core Pattern: CSS Theme System\n\n**File**: `src\u002Fstyles\u002Fmain.css` (~17,000 lines)\n\n### CSS Custom Properties (Dark Theme)\n\n```css\n:root {\n  \u002F* Backgrounds *\u002F\n  --bg: #0a0a0a;\n  --bg-secondary: #111;\n  --surface: #141414;\n  --surface-hover: #1e1e1e;\n\n  \u002F* Borders *\u002F\n  --border: #2a2a2a;\n  --border-strong: #444;\n  --border-subtle: #1a1a1a;\n\n  \u002F* Text *\u002F\n  --text: #e8e8e8;\n  --text-secondary: #ccc;\n  --text-dim: #888;\n  --text-muted: #666;\n  --accent: #fff;\n\n  \u002F* Semantic Colors *\u002F\n  --semantic-critical: #ff4444;\n  --semantic-high: #ff8800;\n  --semantic-elevated: #ffaa00;\n  --semantic-normal: #44aa44;\n  --semantic-info: #3b82f6;\n\n  \u002F* Status *\u002F\n  --green: #44ff88;\n  --red: #ff4444;\n  --yellow: #ffaa00;\n\n  \u002F* Font Stack *\u002F\n  --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Fira Code', monospace;\n  --font-body: var(--font-mono);\n}\n```\n\n### Grid Layout\n\n```css\n.panels-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));\n  grid-auto-flow: row dense;\n  grid-auto-rows: minmax(200px, 380px);\n  gap: 4px;\n  padding: 4px;\n}\n```\n\n### Panel Base Styles\n\n```css\n.panel {\n  background: var(--surface);\n  border: 1px solid var(--border);\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.panel-header {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 6px 10px;\n  background: var(--overlay-subtle);\n  border-bottom: 1px solid var(--border);\n}\n\n.panel-title {\n  font-size: 11px;\n  font-weight: 700;\n  color: var(--accent);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.panel-content {\n  flex: 1;\n  overflow-y: auto;\n  padding: 8px;\n  font-size: 12px;\n}\n```\n\n## Core Pattern: API Proxy Layer\n\n**Directory**: `api\u002F` (60+ Vercel Edge Functions)\n\n### CORS Helper (`api\u002F_cors.js`)\n\nOrigin allowlist pattern — only approved origins can call API endpoints:\n\n```javascript\nconst ALLOWED_ORIGIN_PATTERNS = [\n  \u002F^https:\\\u002F\\\u002F(.*\\.)?worldmonitor\\.app$\u002F,\n  \u002F^https?:\\\u002F\\\u002Flocalhost(:\\d+)?$\u002F,\n];\n\nexport function getCorsHeaders(req, methods = 'GET, OPTIONS') {\n  const origin = req.headers.get('origin') || '';\n  const allowOrigin = isAllowedOrigin(origin) ? origin : 'https:\u002F\u002Fworldmonitor.app';\n  return {\n    'Access-Control-Allow-Origin': allowOrigin,\n    'Access-Control-Allow-Methods': methods,\n    'Access-Control-Allow-Headers': 'Content-Type',\n  };\n}\n```\n\n### Edge Function Pattern\n\nEach endpoint file follows this structure:\n1. CORS preflight handling\n2. Input validation\n3. API key from `process.env`\n4. Upstream fetch with error wrapping\n5. `Cache-Control` headers for CDN caching\n6. Structured JSON response\n\n## Core Pattern: Refresh Scheduler\n\n**File**: `src\u002Fapp\u002Frefresh-scheduler.ts`\n\n```typescript\ninterface RefreshRegistration {\n  name: string;\n  fn: () => Promise\u003Cboolean | void>;\n  intervalMs: number;\n  condition?: () => boolean;   \u002F\u002F Skip refresh if false\n}\n\nclass RefreshScheduler {\n  scheduleRefresh(name, fn, intervalMs, condition?): void\n  flushStaleRefreshes(hiddenMs): void   \u002F\u002F Staggered 150ms between each\n  destroy(): void\n}\n```\n\nKey behaviors:\n- Each panel registers with a unique name and interval\n- Visibility-aware: pauses when tab hidden, flushes stale on return\n- In-flight guard: `ctx.inFlight` set prevents duplicate refreshes\n- Stagger on resume: 150ms gap between each stale refresh to avoid API burst\n\n## Core Pattern: DOM Utilities\n\n**File**: `src\u002Futils\u002Fdom-utils.ts`\n\nWorldMonitor uses a lightweight JSX-free helper `h()`:\n\n```typescript\nfunction h(tag: string, propsOrChild?, ...children): HTMLElement\nfunction fragment(...children): DocumentFragment\nfunction replaceChildren(el: Element, ...children): void\nfunction rawHtml(html: string): DocumentFragment\nfunction safeHtml(html: string): string  \u002F\u002F XSS-safe innerHTML\n```\n\nExample usage:\n```typescript\nconst row = h('div', { className: 'stock-row' },\n  h('span', { className: 'symbol' }, 'AAPL'),\n  h('span', { className: 'price' }, '$178.72'),\n);\n```\n\n## Adaptation Notes for Personal Monitor\n\nWhen adapting WorldMonitor patterns for my-daily-monitor:\n\n| WorldMonitor Feature | Personal Monitor Adaptation |\n|---------------------|----------------------------|\n| 80+ panel classes | 15-20 panels (email, feishu, office, social, etc.) |\n| Proto-first API | Simple REST endpoints (no proto needed) |\n| Vercel Edge Functions | Vite dev server plugin or simple Express routes |\n| SmartPollLoop | Simplified RefreshScheduler with setInterval |\n| VirtualList | Not needed until panel has 100+ items |\n| Multi-variant (5 sites) | Single variant only |\n| 21 languages (i18n) | Chinese + English only |\n| Tauri desktop app | Web-only (may add later) |\n| Redis caching | In-memory cache only |\n\n## Key Files to Study\n\nWhen extracting a specific pattern, start with these files:\n\n| Pattern | Read First | Then Read |\n|---------|-----------|-----------|\n| Panel architecture | `src\u002Fcomponents\u002FPanel.ts` | Any concrete panel (e.g., `NewsPanel.ts`) |\n| Service layer | `src\u002Fservices\u002Fruntime.ts` | `src\u002Fservices\u002Fmarket\u002Findex.ts` |\n| CSS theme | `src\u002Fstyles\u002Fmain.css` (first 60 lines) | `src\u002Fstyles\u002Fpanels.css` |\n| API proxy | `api\u002F_cors.js` | Any `api\u002F*\u002Fv1\u002F[rpc].ts` |\n| Refresh | `src\u002Fapp\u002Frefresh-scheduler.ts` | `src\u002Fapp\u002Fevent-handlers.ts` |\n| Grid layout | `src\u002Fstyles\u002Fmain.css` (search `.panels-grid`) | `src\u002Fapp\u002Fpanel-layout.ts` |\n| DOM helpers | `src\u002Futils\u002Fdom-utils.ts` | `src\u002Futils\u002Fsanitize.ts` |\n| Entry point | `src\u002Fmain.ts` | `src\u002FApp.ts` |\n\n","# WorldMonitor Architecture Reference\n\nWorldMonitor is a real-time global intelligence dashboard built with vanilla TypeScript (no framework). This skill provides a curated index of its architecture, organized by the patterns most relevant to building a personal daily monitor.\n\n## When to Use\n\n- You are creating a new dashboard panel and need to follow WorldMonitor conventions\n- You need to understand how a specific pattern works before adapting it\n- You are deciding which WorldMonitor patterns to adopt vs. simplify for a personal project\n\n## Project Overview\n\n| Aspect | Detail |\n|--------|--------|\n| **Language** | TypeScript (strict), vanilla DOM — no React\u002FVue\u002FAngular |\n| **Bundler** | Vite |\n| **Deployment** | Vercel (60+ Edge Functions) + Railway (WebSocket relay) |\n| **Desktop** | Tauri 2 (Rust) with Node.js sidecar |\n| **Map engines** | globe.gl + Three.js (3D), deck.gl + MapLibre GL (2D) |\n| **CSS** | Custom properties, dark\u002Flight themes, responsive grid |\n| **API contracts** | Protocol Buffers (92 proto files, 22 services) |\n| **Data sources** | 435+ RSS feeds, 45 data layers, 30+ live video streams |\n\n## Directory Structure\n\n```\nworldmonitor\u002F\n├── src\u002F\n│   ├── main.ts                    # Entry point: Sentry, analytics, App bootstrap\n│   ├── App.ts                     # Root application class\n│   ├── components\u002F                # All UI panel classes (80+ files)\n│   │   ├── Panel.ts               # *** BASE CLASS — most important file ***\n│   │   ├── VirtualList.ts         # Virtual scrolling for large lists\n│   │   ├── NewsPanel.ts           # News with clustering, NER, summaries\n│   │   ├── MarketPanel.ts         # Stock market with sparklines\n│   │   ├── SearchModal.ts         # Cmd+K command palette\n│   │   ├── InsightsPanel.ts       # AI briefing + metrics\n│   │   ├── WorldClockPanel.ts     # Multi-timezone clock\n│   │   └── ...                    # 70+ more panels\n│   ├── services\u002F                  # Data layer (117 files)\n│   │   ├── runtime.ts             # SmartPollLoop, desktop detection, fetch routing\n│   │   ├── bootstrap.ts           # Initial data hydration from Redis\n│   │   ├── rss.ts                 # RSS feed aggregation\n│   │   ├── news\u002Findex.ts          # News fetching + processing\n│   │   ├── market\u002Findex.ts        # Market data (Yahoo Finance, Finnhub)\n│   │   ├── i18n.ts                # 21-language internationalization\n│   │   ├── threat-classifier.ts   # 3-stage threat classification\n│   │   ├── clustering.ts          # News headline clustering\n│   │   └── ...                    # 100+ more services\n│   ├── config\u002F                    # Static configuration\n│   │   ├── variant.ts             # Multi-variant (world\u002Ftech\u002Ffinance\u002Fcommodity\u002Fhappy)\n│   │   ├── feeds.ts               # 435+ RSS feed definitions\n│   │   ├── panels.ts              # Panel enable\u002Fdisable config\n│   │   ├── markets.ts             # Stock symbol lists\n│   │   └── ...\n│   ├── app\u002F                       # Application-level modules\n│   │   ├── app-context.ts         # Shared state (inFlight, isDestroyed)\n│   │   ├── refresh-scheduler.ts   # *** REFRESH PATTERN ***\n│   │   ├── panel-layout.ts        # Grid layout management\n│   │   ├── search-manager.ts      # Command palette logic\n│   │   └── event-handlers.ts      # Global keyboard\u002Fvisibility events\n│   ├── utils\u002F                     # Utilities (22 files)\n│   │   ├── dom-utils.ts           # h(), fragment(), replaceChildren() — JSX-free helpers\n│   │   ├── sanitize.ts            # escapeHtml(), sanitizeUrl() — XSS prevention\n│   │   ├── index.ts               # formatTime, formatNumber, etc.\n│   │   └── ...\n│   ├── styles\u002F                    # CSS\n│   │   ├── main.css               # *** THEME VARIABLES + GRID LAYOUT ***\n│   │   ├── panels.css             # Panel-specific styles (tabs, rows, badges)\n│   │   ├── base-layer.css         # Foundation layer\n│   │   └── ...\n│   └── generated\u002F                 # Auto-generated from .proto files\n│       ├── client\u002F                # TypeScript API clients\n│       └── server\u002F                # TypeScript API handlers\n├── api\u002F                           # Vercel Edge Functions (60+)\n│   ├── _cors.js                   # CORS origin allowlist\n│   ├── _rate-limit.js             # Upstash Redis rate limiting\n│   ├── _api-key.js                # API key injection\n│   ├── bootstrap.js               # Pre-fetch 15 Redis keys for first render\n│   ├── rss-proxy.js               # RSS feed proxy with domain allowlist\n│   ├── market\u002Fv1\u002F[rpc].ts         # Market data endpoints (proto-first)\n│   ├── news\u002Fv1\u002F[rpc].ts           # News endpoints\n│   └── ...                        # 22 service domains\n├── server\u002F                        # Railway relay server\n├── proto\u002F                         # Protocol Buffer definitions\n└── tests\u002F                         # 30 test files, 554 test cases\n```\n\n## Core Pattern: Panel Base Class\n\n**File**: `src\u002Fcomponents\u002FPanel.ts` (~1000 lines)\n\nThe Panel class is the foundation for ALL UI components (80+ panels inherit from it).\n\n### Constructor Options\n\n```typescript\ninterface PanelOptions {\n  id: string;          \u002F\u002F Unique panel identifier (used in DOM data-panel attr)\n  title: string;       \u002F\u002F Display title in header\n  showCount?: boolean; \u002F\u002F Show item count badge\n  className?: string;  \u002F\u002F Additional CSS class (e.g., 'panel-wide')\n  trackActivity?: boolean; \u002F\u002F Enable activity tracking\n  infoTooltip?: string;    \u002F\u002F Hover tooltip text\n  premium?: 'locked' | 'enhanced'; \u002F\u002F Pro feature gating\n}\n```\n\n### DOM Structure\n\n```\ndiv.panel[data-panel=\"{id}\"]\n├── div.panel-header\n│   ├── div.panel-header-left\n│   │   ├── span.panel-title\n│   │   └── span.panel-new-badge (optional)\n│   ├── span.panel-data-badge (optional, \"LIVE\"\u002F\"CACHED\")\n│   └── span.panel-count (optional)\n├── div.panel-content\n│   └── (loading spinner | error state | rendered content)\n└── div.panel-resize-handle\n```\n\n### Key Methods\n\n| Method | Purpose |\n|--------|---------|\n| `getElement()` | Returns the outer `div.panel` |\n| `showLoading(msg?)` | Display spinner + message |\n| `showError(msg, onRetry?)` | Display error with optional retry button |\n| `setContent(html)` | Set content innerHTML (debounced 150ms) |\n| `setContentDirect(html)` | Set content immediately (no debounce) |\n| `setCount(n)` | Update the count badge |\n| `setStatusBadge(label, type)` | Show \"LIVE\"\u002F\"CACHED\" badge |\n| `show() \u002F hide()` | Toggle visibility |\n| `destroy()` | Remove element, abort controller, cleanup listeners |\n\n### Resize System\n\nPanels support both row span (1-4 rows) and column span (1-3 cols) resizing via drag handles. Sizes are persisted in `localStorage` with keys `worldmonitor-panel-spans` and `worldmonitor-panel-col-spans`.\n\n## Core Pattern: Data Service Layer\n\n**Directory**: `src\u002Fservices\u002F` (117 files)\n\n### SmartPollLoop\n\n**File**: `src\u002Fservices\u002Fruntime.ts`\n\nInstead of raw `setInterval`, WorldMonitor uses `startSmartPollLoop()`:\n\n```typescript\nconst loop = startSmartPollLoop(async () => {\n  \u002F\u002F fetch data, return boolean for success\u002Ffailure\n}, intervalMs);\nloop.stop(); \u002F\u002F cleanup\n```\n\nFeatures:\n- Exponential backoff on failure (1x → 2x → 4x, capped at 8x)\n- Hidden-tab throttle (pauses when `document.hidden`)\n- Circuit breaker integration (stops after N consecutive failures)\n- Adaptive refresh (can adjust interval based on data freshness)\n\n### Service Module Convention\n\nEach service is a module (not a class) exporting async functions:\n\n```typescript\n\u002F\u002F src\u002Fservices\u002Fmarket\u002Findex.ts\nexport async function fetchMarketQuotes(symbols: string[]): Promise\u003CMarketQuote[]> { ... }\nexport async function fetchMarketNews(): Promise\u003CMarketNews[]> { ... }\n```\n\nServices call `\u002Fapi\u002F...` proxy endpoints, never external APIs directly.\n\n## Core Pattern: CSS Theme System\n\n**File**: `src\u002Fstyles\u002Fmain.css` (~17,000 lines)\n\n### CSS Custom Properties (Dark Theme)\n\n```css\n:root {\n  \u002F* Backgrounds *\u002F\n  --bg: #0a0a0a;\n  --bg-secondary: #111;\n  --surface: #141414;\n  --surface-hover: #1e1e1e;\n\n  \u002F* Borders *\u002F\n  --border: #2a2a2a;\n  --border-strong: #444;\n  --border-subtle: #1a1a1a;\n\n  \u002F* Text *\u002F\n  --text: #e8e8e8;\n  --text-secondary: #ccc;\n  --text-dim: #888;\n  --text-muted: #666;\n  --accent: #fff;\n\n  \u002F* Semantic Colors *\u002F\n  --semantic-critical: #ff4444;\n  --semantic-high: #ff8800;\n  --semantic-elevated: #ffaa00;\n  --semantic-normal: #44aa44;\n  --semantic-info: #3b82f6;\n\n  \u002F* Status *\u002F\n  --green: #44ff88;\n  --red: #ff4444;\n  --yellow: #ffaa00;\n\n  \u002F* Font Stack *\u002F\n  --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Fira Code', monospace;\n  --font-body: var(--font-mono);\n}\n```\n\n### Grid Layout\n\n```css\n.panels-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));\n  grid-auto-flow: row dense;\n  grid-auto-rows: minmax(200px, 380px);\n  gap: 4px;\n  padding: 4px;\n}\n```\n\n### Panel Base Styles\n\n```css\n.panel {\n  background: var(--surface);\n  border: 1px solid var(--border);\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.panel-header {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  padding: 6px 10px;\n  background: var(--overlay-subtle);\n  border-bottom: 1px solid var(--border);\n}\n\n.panel-title {\n  font-size: 11px;\n  font-weight: 700;\n  color: var(--accent);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.panel-content {\n  flex: 1;\n  overflow-y: auto;\n  padding: 8px;\n  font-size: 12px;\n}\n```\n\n## Core Pattern: API Proxy Layer\n\n**Directory**: `api\u002F` (60+ Vercel Edge Functions)\n\n### CORS Helper (`api\u002F_cors.js`)\n\nOrigin allowlist pattern — only approved origins can call API endpoints:\n\n```javascript\nconst ALLOWED_ORIGIN_PATTERNS = [\n  \u002F^https:\\\u002F\\\u002F(.*\\.)?worldmonitor\\.app$\u002F,\n  \u002F^https?:\\\u002F\\\u002Flocalhost(:\\d+)?$\u002F,\n];\n\nexport function getCorsHeaders(req, methods = 'GET, OPTIONS') {\n  const origin = req.headers.get('origin') || '';\n  const allowOrigin = isAllowedOrigin(origin) ? origin : 'https:\u002F\u002Fworldmonitor.app';\n  return {\n    'Access-Control-Allow-Origin': allowOrigin,\n    'Access-Control-Allow-Methods': methods,\n    'Access-Control-Allow-Headers': 'Content-Type',\n  };\n}\n```\n\n### Edge Function Pattern\n\nEach endpoint file follows this structure:\n1. CORS preflight handling\n2. Input validation\n3. API key from `process.env`\n4. Upstream fetch with error wrapping\n5. `Cache-Control` headers for CDN caching\n6. Structured JSON response\n\n## Core Pattern: Refresh Scheduler\n\n**File**: `src\u002Fapp\u002Frefresh-scheduler.ts`\n\n```typescript\ninterface RefreshRegistration {\n  name: string;\n  fn: () => Promise\u003Cboolean | void>;\n  intervalMs: number;\n  condition?: () => boolean;   \u002F\u002F Skip refresh if false\n}\n\nclass RefreshScheduler {\n  scheduleRefresh(name, fn, intervalMs, condition?): void\n  flushStaleRefreshes(hiddenMs): void   \u002F\u002F Staggered 150ms between each\n  destroy(): void\n}\n```\n\nKey behaviors:\n- Each panel registers with a unique name and interval\n- Visibility-aware: pauses when tab hidden, flushes stale on return\n- In-flight guard: `ctx.inFlight` set prevents duplicate refreshes\n- Stagger on resume: 150ms gap between each stale refresh to avoid API burst\n\n## Core Pattern: DOM Utilities\n\n**File**: `src\u002Futils\u002Fdom-utils.ts`\n\nWorldMonitor uses a lightweight JSX-free helper `h()`:\n\n```typescript\nfunction h(tag: string, propsOrChild?, ...children): HTMLElement\nfunction fragment(...children): DocumentFragment\nfunction replaceChildren(el: Element, ...children): void\nfunction rawHtml(html: string): DocumentFragment\nfunction safeHtml(html: string): string  \u002F\u002F XSS-safe innerHTML\n```\n\nExample usage:\n```typescript\nconst row = h('div', { className: 'stock-row' },\n  h('span', { className: 'symbol' }, 'AAPL'),\n  h('span', { className: 'price' }, '$178.72'),\n);\n```\n\n## Adaptation Notes for Personal Monitor\n\nWhen adapting WorldMonitor patterns for my-daily-monitor:\n\n| WorldMonitor Feature | Personal Monitor Adaptation |\n|---------------------|----------------------------|\n| 80+ panel classes | 15-20 panels (email, feishu, office, social, etc.) |\n| Proto-first API | Simple REST endpoints (no proto needed) |\n| Vercel Edge Functions | Vite dev server plugin or simple Express routes |\n| SmartPollLoop | Simplified RefreshScheduler with setInterval |\n| VirtualList | Not needed until panel has 100+ items |\n| Multi-variant (5 sites) | Single variant only |\n| 21 languages (i18n) | Chinese + English only |\n| Tauri desktop app | Web-only (may add later) |\n| Redis caching | In-memory cache only |\n\n## Key Files to Study\n\nWhen extracting a specific pattern, start with these files:\n\n| Pattern | Read First | Then Read |\n|---------|-----------|-----------|\n| Panel architecture | `src\u002Fcomponents\u002FPanel.ts` | Any concrete panel (e.g., `NewsPanel.ts`) |\n| Service layer | `src\u002Fservices\u002Fruntime.ts` | `src\u002Fservices\u002Fmarket\u002Findex.ts` |\n| CSS theme | `src\u002Fstyles\u002Fmain.css` (first 60 lines) | `src\u002Fstyles\u002Fpanels.css` |\n| API proxy | `api\u002F_cors.js` | Any `api\u002F*\u002Fv1\u002F[rpc].ts` |\n| Refresh | `src\u002Fapp\u002Frefresh-scheduler.ts` | `src\u002Fapp\u002Fevent-handlers.ts` |\n| Grid layout | `src\u002Fstyles\u002Fmain.css` (search `.panels-grid`) | `src\u002Fapp\u002Fpanel-layout.ts` |\n| DOM helpers | `src\u002Futils\u002Fdom-utils.ts` | `src\u002Futils\u002Fsanitize.ts` |\n| Entry point | `src\u002Fmain.ts` | `src\u002FApp.ts` |\n\n",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","showcase\u002Fskills\u002Fworldmonitor-reference","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill worldmonitor-reference",{"tool":60,"command":61},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill worldmonitor-reference",{"tool":63,"command":64},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill worldmonitor-reference","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},".skill_id","OTHER","其他",36,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002F.skill_id",[75,98,115,124,140,156],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":43},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[82,83,84,42,85,86,87,88,29,89,90,91,92,93,94,95,96,97],"write","check","write special chars ts check","files","characters","Existing","type-checking","errors","script","output","type","filters","only","template","file","python",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":43},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[105,106,82,107,108,109,96,90,110,111,112,95,113,114,29,86,97],"readback","write special chars readback","helper","cleanup","verification","with","post","via","read","scripts",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":43},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[122,82,123,86,29,90,112,95,96,97],"write special chars heredoc","shell",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":43},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[131,132,133,134,29,110,135,136,137,138,139],"virtual","list","virtual list","dom","rendering","recycling","chunk","implement","performance",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":43},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[147,148,149,150,96,151,152,153,154,155],"verify directory structure","structure","verify","directory","issues","diagnose","file access","first","access",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":43},"01M6XCC3HAJNFB6WZAHV6YW5AV","verify-directory-structure-parallel-audit","Diagnose and resolve file access issues by verifying directory structure, then reading multiple files in parallel batches for efficient auditing, with built-in guidance for validating TypeScript import patterns.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure-parallel-audit\u002FSKILL.md",[],[147,163,148,164,165,150,149,166,29,167,168,110,169,85,155,96,151,152,42,153],"verify directory structure parallel audit","parallel","audit","import","batches","reading","guidance"]