bloby-bot 0.23.5 → 0.23.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bloby-bot",
3
- "version": "0.23.5",
3
+ "version": "0.23.6",
4
4
  "releaseNotes": [
5
5
  "1. new stuff",
6
6
  "2. ",
@@ -94,6 +94,14 @@ export function hasConversation(conversationId: string): boolean {
94
94
  return liveConversations.has(conversationId);
95
95
  }
96
96
 
97
+ /** End all live conversations (e.g. after re-auth so they restart with fresh token) */
98
+ export function endAllConversations(): void {
99
+ for (const convId of liveConversations.keys()) {
100
+ log.info(`[conversation] Ending conversation ${convId} (auth changed)`);
101
+ endConversation(convId);
102
+ }
103
+ }
104
+
97
105
  // ── Helpers ─────────────────────────────────────────────────────────────────
98
106
 
99
107
  /** Read a memory file from workspace, returning '(empty)' if missing or empty */
@@ -14,7 +14,7 @@ import { closeDb, getSession, getSetting } from '../worker/db.js';
14
14
  import { spawnBackend, stopBackend, getBackendPort, isBackendAlive, isBackendStopping, resetBackendRestarts } from './backend.js';
15
15
  import { updateTunnelUrl, startHeartbeat, stopHeartbeat, disconnect } from '../shared/relay.js';
16
16
  import {
17
- startConversation, pushMessage, hasConversation, endConversation,
17
+ startConversation, pushMessage, hasConversation, endConversation, endAllConversations,
18
18
  isConversationBusy, stopSubAgentTask,
19
19
  startBlobyAgentQuery, stopBlobyAgentQuery,
20
20
  type RecentMessage,
@@ -687,6 +687,24 @@ ${!connected ? '<script>setTimeout(()=>location.reload(),4000)</script>' : ''}
687
687
  }
688
688
  }
689
689
 
690
+ // After successful Claude re-auth, end live conversations so they restart with a fresh token
691
+ if (req.method === 'POST' && req.url === '/api/auth/claude/exchange') {
692
+ const origEnd = res.end.bind(res);
693
+ (res as any).end = function (this: typeof res, ...args: any[]) {
694
+ try {
695
+ const body = typeof args[0] === 'string' ? args[0] : args[0]?.toString();
696
+ if (body) {
697
+ const json = JSON.parse(body);
698
+ if (json.success) {
699
+ log.info('[orchestrator] Claude re-auth succeeded — restarting conversations with fresh token');
700
+ endAllConversations();
701
+ }
702
+ }
703
+ } catch {}
704
+ return origEnd(...args);
705
+ };
706
+ }
707
+
690
708
  workerApp(req, res);
691
709
  return;
692
710
  }
@@ -942,6 +960,9 @@ ${!connected ? '<script>setTimeout(()=>location.reload(),4000)</script>' : ''}
942
960
  (async () => {
943
961
  try {
944
962
  const result = await workerApi('/api/onboard', 'POST', msg.data);
963
+ // Settings change may affect model/provider/token — restart conversations
964
+ log.info('[orchestrator] Settings saved — restarting conversations');
965
+ endAllConversations();
945
966
  if (ws.readyState === WebSocket.OPEN) {
946
967
  ws.send(JSON.stringify({ type: 'settings:saved', data: result }));
947
968
  }