/** * apes:* information-layer tabs — the fork's own contribution on top of the * upstream dsh-better-sidebar. Three tabs ship (agents / apps / profile); * `apes:tasks` was removed (C6) because it overlaps the official DSH session * tree in the native sidebar, and `messages` is deferred (no DSH * message-stream API yet — tracked separately). * * Isolated under `src/client/apes/` so the upstream `builtins/` tree stays * untouched: cherry-picking upstream releases only has to keep the single * `registerApesTabs(...)` call site in `index.tsx` (see D1 = module B). * * Every descriptor is registered through the same `BetterSidebarService` * the builtins use (dogfood), so the apes tabs get the full sidebar * lifecycle for free: + menu, enable/disable switches, badge pills, * dedupe/focus, and HMR-safe disposal via the returned disposer. */ import type { Context } from '../../context-types.ts' import type { BetterSidebarService } from '../service.ts' import { apesTabs } from './tabs.tsx' // Re-exported so index.tsx can register the apes dictionaries + attach the // locale service in one import (keeps the apes module self-contained). export { APES_LOCALE_NS, apesZh, apesEn, attachApesLocale } from './locales.ts' /** * Register the apes:* tabs with the sidebar service. Returns a disposer that * unregisters all of them (cordis auto-invokes it on fiber disposal, so HMR * re-activation re-registers cleanly — same contract as registerBuiltins). */ export function registerApesTabs( _ctx: Context, service: BetterSidebarService, ): () => void { const disposers: (() => void)[] = [] for (const tab of apesTabs) { disposers.push(service.registerTab(tab)) } return () => { for (const d of disposers) { try { d() } catch { /* already disposed */ } } } }