Files
apes-sidebar/src/context-types.ts
T
figmar f86c1d82e6 feat(apes-sidebar): Phase 1 — 5 个 apes:* tab 真实注册
- client/index.tsx 改用 dsh-better-sidebar 真实 TabDescriptor/
  TabComponentProps/Context(type-only,擦除不打包)
- 注册 5 个面板:apes:tasks(读 sessions,running/current/subagent
  标记)、apes:agents(subagent 过滤 + 按 parent 分组)、apes:apps /
  apes:messages / apes:profile(占位)
- 全部走 t() i18n,ctx.effect 包裹注册(HMR 安全 disposer)
- betterSidebar 缺失时优雅降级(bare DSH 不破坏 shell)
- context-types.ts 删除被取代的 Phase 0 占位镜像,保留 ApesLocaleService
- package.json devDeps 补 dsh-better-sidebar(dev-only 类型)
- tests/tabs.spec.ts: mock registry 验证 5 个 apes:* id 注册 +
  disposer 撤销 + 缺失降级 + namespace 锁

门禁全绿:typecheck / build / test(20/20)
cordis scratch 真实挂载冒烟留 Phase 2(需真实 DSH host 进程)
2026-09-04 17:42:57 +08:00

34 lines
1.6 KiB
TypeScript

/**
* Structural types for the cordis services apes-sidebar consumes.
*
* PHASE 1: the sidebar tab + session types now come from the REAL
* `dsh-better-sidebar` package (type-only imports in `src/client/index.tsx`):
* `TabDescriptor` / `TabComponentProps` / `BetterSidebarService` /
* `SidebarSessionSummary` / `SidebarSessionList`. The Phase 0 placeholder
* mirrors (`ApesSidebarTabDescriptor`, `ApesSidebarService`,
* `ApesSessionSummary`, `ApesSessionList`, `ApesSessionsService`, and the
* `ApesContext` intersection) were deleted — they are superseded by the
* peer's authoritative types and would drift.
*
* What remains here is the ONE service face apes-sidebar still defines
* itself: the locale runtime mirror (`ApesLocaleService`). `dsh-better-sidebar`
* publishes its own `SidebarLocaleService`, but locales.ts pre-dates the type
* import and stays on this local mirror to keep the i18n module independent
* of the peer (it must compile even when the peer is absent).
*
* This file must stay FREE of Node.js types: it is part of the
* CLIENT-reachable declaration graph, so a Node import here would leak into
* browser-only consumer builds.
*/
/**
* The client locale service face (mirror of dsh-client-locale's LocaleRuntime).
* Only the slices apes-sidebar's i18n module touches: snapshot read, snapshot
* subscription, and per-namespace dictionary registration.
*/
export interface ApesLocaleService {
getSnapshot(): { active: string }
subscribe(fn: () => void): () => void
register(ns: string, locale: string, dict: Record<string, string>): () => void
}