@waterplus-ai/waterbuddy 0.1.34 → 0.1.35

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 +22 -1
  2. package/package.json +1 -1
package/lib/host/index.js CHANGED
@@ -345,7 +345,28 @@ async function proxyAvatar(req, res) {
345
345
  */
346
346
  export async function bootstrapLlmCredential(ctx, config) {
347
347
  try {
348
- const { deviceId, credential } = await ensureLlmCredential(ctx, { config })
348
+ // 已登录的会话必须绑**账号档**,不能只领设备档。
349
+ //
350
+ // 账号档原先只在「登录那一刻」由 finalizeLogin 建立,启动引导只走设备档,
351
+ // 于是每次重启都会把 key 换回设备档——表现为「我明明登录着,额度却只有
352
+ // 试用档 0.1,得重新登录才恢复 10」(实测踩过)。
353
+ const token = typeof persistedAuth?.token === 'string' ? persistedAuth.token : ''
354
+ let credential
355
+ let deviceId
356
+ if (token) {
357
+ try {
358
+ ({ deviceId, credential } = await bindLlmCredential(ctx, token, { config }))
359
+ } catch (error) {
360
+ // 会话过期或网关不可用时回落设备档,保证仍能对话。
361
+ console.warn(
362
+ '[WaterBuddy] startup bind failed; falling back to the device credential:',
363
+ error.message,
364
+ )
365
+ }
366
+ }
367
+ if (!credential) {
368
+ ({ deviceId, credential } = await ensureLlmCredential(ctx, { config }))
369
+ }
349
370
  llmStatus = describeLlmCredential(credential, deviceId)
350
371
  try {
351
372
  await switchDefaultProviderWithRetry(ctx)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waterplus-ai/waterbuddy",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "WaterBuddy branding and Web profile bundle for DeepSeek Harness",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",