// 三省六部工作台 · 宿主入口。 // // 0.11.0 起老预设线退役:不再有「上朝」模式、Team 政策插件与朝堂侧栏。 // 本入口只做一件事——在应用根上把工作台宿主拉起来(账本、HTTP 接口、 // 会话装配、记忆都在 workbench/host 里),插件卸载时把它停掉。 // 工作台宿主自身对缺失能力一律降级并给出 warnings,所以这里不预检、 // 不抛错:工作台起不来不该拖垮整个应用。 import { createWorkbenchHost } from './workbench/host/index.mjs' export const name = 'sansheng-liubu-workbench-host' export function apply(ctx) { if (ctx === null || ctx === undefined) return undefined let host = null try { host = createWorkbenchHost(ctx?.root ?? ctx, {}) } catch (error) { try { ctx?.logger?.info?.(`[sansheng-liubo] 工作台启动失败:${error?.message ?? error}`) } catch { // 日志失败不能影响应用启动。 } return undefined } for (const warning of host.warnings ?? []) { try { ctx?.logger?.info?.(`[sansheng-liubo] ${warning}`) } catch { // 同上。 } } return () => { try { host.dispose() } catch { // 卸载失败不影响插件卸载;下次启动仍会从同一个账本继续。 } } }