@bike4mind/cli 0.2.29-feat-cli-websocket-streaming.18878 → 0.2.29-feat-cli-websocket-streaming.18879

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/dist/index.js +40 -6
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -13519,10 +13519,16 @@ var WebSocketLlmBackend = class {
13519
13519
  if (settled) return;
13520
13520
  settled = true;
13521
13521
  this.wsManager.offRequest(requestId);
13522
+ this.wsManager.offDisconnect(onDisconnect);
13522
13523
  action();
13523
13524
  };
13524
13525
  const settleResolve = () => settle(() => resolve3());
13525
13526
  const settleReject = (err) => settle(() => reject(err));
13527
+ const onDisconnect = () => {
13528
+ logger.debug("[WebSocketLlmBackend] Connection dropped during completion");
13529
+ settleReject(new Error("WebSocket connection lost during completion"));
13530
+ };
13531
+ this.wsManager.onDisconnect(onDisconnect);
13526
13532
  if (options.abortSignal) {
13527
13533
  if (options.abortSignal.aborted) {
13528
13534
  settleResolve();
@@ -13677,6 +13683,7 @@ var WebSocketConnectionManager = class {
13677
13683
  this.reconnectAttempts = 0;
13678
13684
  this.maxReconnectDelay = 3e4;
13679
13685
  this.handlers = /* @__PURE__ */ new Map();
13686
+ this.disconnectHandlers = /* @__PURE__ */ new Set();
13680
13687
  this.connected = false;
13681
13688
  this.connecting = false;
13682
13689
  this.closed = false;
@@ -13724,6 +13731,7 @@ var WebSocketConnectionManager = class {
13724
13731
  this.ws.onclose = () => {
13725
13732
  logger.debug("[WS] Connection closed");
13726
13733
  this.cleanup();
13734
+ this.notifyDisconnect();
13727
13735
  if (!this.closed) {
13728
13736
  this.scheduleReconnect();
13729
13737
  }
@@ -13763,6 +13771,18 @@ var WebSocketConnectionManager = class {
13763
13771
  offRequest(requestId) {
13764
13772
  this.handlers.delete(requestId);
13765
13773
  }
13774
+ /**
13775
+ * Register a handler that fires when the connection drops.
13776
+ */
13777
+ onDisconnect(handler) {
13778
+ this.disconnectHandlers.add(handler);
13779
+ }
13780
+ /**
13781
+ * Remove a disconnect handler.
13782
+ */
13783
+ offDisconnect(handler) {
13784
+ this.disconnectHandlers.delete(handler);
13785
+ }
13766
13786
  /**
13767
13787
  * Close the connection and stop all heartbeat/reconnect logic.
13768
13788
  */
@@ -13774,6 +13794,7 @@ var WebSocketConnectionManager = class {
13774
13794
  this.ws = null;
13775
13795
  }
13776
13796
  this.handlers.clear();
13797
+ this.disconnectHandlers.clear();
13777
13798
  }
13778
13799
  startHeartbeat() {
13779
13800
  this.stopHeartbeat();
@@ -13798,6 +13819,14 @@ var WebSocketConnectionManager = class {
13798
13819
  this.connecting = false;
13799
13820
  this.stopHeartbeat();
13800
13821
  }
13822
+ notifyDisconnect() {
13823
+ for (const handler of this.disconnectHandlers) {
13824
+ try {
13825
+ handler();
13826
+ } catch {
13827
+ }
13828
+ }
13829
+ }
13801
13830
  scheduleReconnect() {
13802
13831
  if (this.closed) return;
13803
13832
  this.reconnectAttempts++;
@@ -13840,10 +13869,15 @@ var WebSocketToolExecutor = class {
13840
13869
  if (settled) return;
13841
13870
  settled = true;
13842
13871
  this.wsManager.offRequest(requestId);
13872
+ this.wsManager.offDisconnect(onDisconnect);
13843
13873
  action();
13844
13874
  };
13845
13875
  const settleResolve = (result) => settle(() => resolve3(result));
13846
13876
  const settleReject = (err) => settle(() => reject(err));
13877
+ const onDisconnect = () => {
13878
+ settleReject(new Error("WebSocket connection lost during tool execution"));
13879
+ };
13880
+ this.wsManager.onDisconnect(onDisconnect);
13847
13881
  if (abortSignal) {
13848
13882
  if (abortSignal.aborted) {
13849
13883
  settleReject(new Error("Tool execution aborted"));
@@ -14014,7 +14048,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
14014
14048
  // package.json
14015
14049
  var package_default = {
14016
14050
  name: "@bike4mind/cli",
14017
- version: "0.2.29-feat-cli-websocket-streaming.18878+661239950",
14051
+ version: "0.2.29-feat-cli-websocket-streaming.18879+058b16fd8",
14018
14052
  type: "module",
14019
14053
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
14020
14054
  license: "UNLICENSED",
@@ -14124,10 +14158,10 @@ var package_default = {
14124
14158
  },
14125
14159
  devDependencies: {
14126
14160
  "@bike4mind/agents": "0.1.0",
14127
- "@bike4mind/common": "2.50.1-feat-cli-websocket-streaming.18878+661239950",
14128
- "@bike4mind/mcp": "1.29.1-feat-cli-websocket-streaming.18878+661239950",
14129
- "@bike4mind/services": "2.48.1-feat-cli-websocket-streaming.18878+661239950",
14130
- "@bike4mind/utils": "2.5.1-feat-cli-websocket-streaming.18878+661239950",
14161
+ "@bike4mind/common": "2.50.1-feat-cli-websocket-streaming.18879+058b16fd8",
14162
+ "@bike4mind/mcp": "1.29.1-feat-cli-websocket-streaming.18879+058b16fd8",
14163
+ "@bike4mind/services": "2.48.1-feat-cli-websocket-streaming.18879+058b16fd8",
14164
+ "@bike4mind/utils": "2.5.1-feat-cli-websocket-streaming.18879+058b16fd8",
14131
14165
  "@types/better-sqlite3": "^7.6.13",
14132
14166
  "@types/diff": "^5.0.9",
14133
14167
  "@types/jsonwebtoken": "^9.0.4",
@@ -14144,7 +14178,7 @@ var package_default = {
14144
14178
  optionalDependencies: {
14145
14179
  "@vscode/ripgrep": "^1.17.0"
14146
14180
  },
14147
- gitHead: "661239950fcb26f7027596b319567a19d56fb1a7"
14181
+ gitHead: "058b16fd85d5311089d30e3d8ccfbe135b3e90c6"
14148
14182
  };
14149
14183
 
14150
14184
  // src/config/constants.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.29-feat-cli-websocket-streaming.18878+661239950",
3
+ "version": "0.2.29-feat-cli-websocket-streaming.18879+058b16fd8",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -110,10 +110,10 @@
110
110
  },
111
111
  "devDependencies": {
112
112
  "@bike4mind/agents": "0.1.0",
113
- "@bike4mind/common": "2.50.1-feat-cli-websocket-streaming.18878+661239950",
114
- "@bike4mind/mcp": "1.29.1-feat-cli-websocket-streaming.18878+661239950",
115
- "@bike4mind/services": "2.48.1-feat-cli-websocket-streaming.18878+661239950",
116
- "@bike4mind/utils": "2.5.1-feat-cli-websocket-streaming.18878+661239950",
113
+ "@bike4mind/common": "2.50.1-feat-cli-websocket-streaming.18879+058b16fd8",
114
+ "@bike4mind/mcp": "1.29.1-feat-cli-websocket-streaming.18879+058b16fd8",
115
+ "@bike4mind/services": "2.48.1-feat-cli-websocket-streaming.18879+058b16fd8",
116
+ "@bike4mind/utils": "2.5.1-feat-cli-websocket-streaming.18879+058b16fd8",
117
117
  "@types/better-sqlite3": "^7.6.13",
118
118
  "@types/diff": "^5.0.9",
119
119
  "@types/jsonwebtoken": "^9.0.4",
@@ -130,5 +130,5 @@
130
130
  "optionalDependencies": {
131
131
  "@vscode/ripgrep": "^1.17.0"
132
132
  },
133
- "gitHead": "661239950fcb26f7027596b319567a19d56fb1a7"
133
+ "gitHead": "058b16fd85d5311089d30e3d8ccfbe135b3e90c6"
134
134
  }