@waterplus-ai/waterbuddy 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/host/index.js +16 -7
  2. package/package.json +1 -1
package/lib/host/index.js CHANGED
@@ -664,14 +664,18 @@ function setupExpertTools(ctx, config, { getCatalog, getEnabled }) {
664
664
  return disposers
665
665
  }
666
666
 
667
- export const inject = ['webServer', 'systemPrompt', 'credentials', 'settings', 'tools', 'subagents']
667
+ // 只列本插件**必需**的服务:cordis 的 inject 没有「可选」语义(对象形式只是拦截配置),
668
+ // 少一个就整条 fiber 永久 pending,品牌、登录、额度、MCP 全都不激活。
669
+ // `tools`/`subagents` 只在专家功能里用,且宿主缺失时本就按「专家禁用」降级;`settings`
670
+ // 从未被使用。三者一律改为延迟注入(见 apply)。
671
+ export const inject = ['webServer', 'systemPrompt', 'credentials']
668
672
  export { normalizeAvatar, setUpstreamTransport }
669
673
 
670
674
  export function apply(ctx, config) {
671
675
  readPersistedAuth()
672
676
  ctx.effect(() => {
673
- // 内置名册读一次(异步、失败只记日志);自定义专家与启用状态存在 settings 里,
674
- // 每次快照时合并,所以用户在设置页改完立刻生效,不需要重启。
677
+ // 内置名册读一次(异步、失败只记日志);自定义专家与启用状态由 expertStore 合并进快照
678
+ // (文件存储,不走宿主 settings 命名空间),用户在设置页改完立刻生效,不需要重启。
675
679
  const builtinCatalog = loadExpertCatalog(config?.expertsDir || undefined)
676
680
  builtinCatalog.catch(error => console.warn('[WaterPlusAI] expert catalog failed to load:', error.message))
677
681
  // 状态存在 $DSH_HOME/waterbuddy-experts.json(`expertsStateFile` 可覆盖,测试用临时文件)。
@@ -725,9 +729,14 @@ export function apply(ctx, config) {
725
729
  const disposers = routes.map(route => ctx.webServer.register(route))
726
730
  const disposeTitle = ctx.webServer.tapIndex(html => html.replace(/<title>[^<]*<\/title>/i, '<title>WaterPlusAI</title>').replace(/<link[^>]+rel=["']icon["'][^>]*>/i, '<link rel="icon" type="image/png" href="/waterplus-mark.png" />'))
727
731
  const disposePersona = ctx.systemPrompt.section({ name: 'waterplus:persona', order: 100, text: WATERPLUS_PERSONA })
728
- const expertDisposers = setupExpertTools(ctx, config, {
729
- getCatalog: async () => (await expertSnapshot()).catalog,
730
- getEnabled: () => expertStore.read().enabled,
732
+ // 专家是附加能力:`tools`/`subagents` 延迟注入,服务到位才挂工具。宿主没有它们时本插件
733
+ // 照常激活(品牌、登录、额度、MCP 都在),只是专家功能不出现——附加能力绝不能挡住启动。
734
+ ctx.inject(['tools', 'subagents'], expertCtx => {
735
+ const expertDisposers = setupExpertTools(expertCtx, config, {
736
+ getCatalog: async () => (await expertSnapshot()).catalog,
737
+ getEnabled: () => expertStore.read().enabled,
738
+ })
739
+ expertCtx.effect(() => () => { for (const dispose of expertDisposers) dispose() })
731
740
  })
732
741
  // 尽力而为:宿主没有 credentials 服务(例如测试替身)时直接跳过,不发网络请求。
733
742
  if (ctx.credentials?.set) {
@@ -735,6 +744,6 @@ export function apply(ctx, config) {
735
744
  llmLogoutHook = () => restoreDeviceLlmCredential(ctx, { config })
736
745
  void bootstrapLlmCredential(ctx, config)
737
746
  }
738
- return () => { for (const dispose of disposers) dispose(); disposeTitle(); disposePersona(); for (const dispose of expertDisposers) dispose(); sessions.clear(); currentUser = undefined; persistedAuth = undefined }
747
+ return () => { for (const dispose of disposers) dispose(); disposeTitle(); disposePersona(); sessions.clear(); currentUser = undefined; persistedAuth = undefined }
739
748
  }, 'waterbuddy: identity and auth')
740
749
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waterplus-ai/waterbuddy",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "WaterPlusAI branding and Web profile bundle for DeepSeek Harness",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",