@bike4mind/cli 0.2.11-fix-cli-socket-hangup-error-handling.17320 → 0.2.11-fix-cli-socket-hangup-error-handling.17321

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 +26 -39
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -11253,7 +11253,8 @@ var ServerLlmBackend = class {
11253
11253
  reject(error);
11254
11254
  });
11255
11255
  } catch (error) {
11256
- logger.debug(`LLM completion failed: ${error instanceof Error ? error.message : String(error)}`);
11256
+ const errorMsg = error instanceof Error ? error.message : String(error);
11257
+ logger.error(`LLM completion failed: ${errorMsg}`);
11257
11258
  if (isAxiosError(error)) {
11258
11259
  logger.debug(
11259
11260
  `[ServerLlmBackend] Axios error details: ${JSON.stringify({
@@ -11296,8 +11297,8 @@ var ServerLlmBackend = class {
11296
11297
  } catch (extractError) {
11297
11298
  logger.error("[ServerLlmBackend] Error extracting response:", extractError);
11298
11299
  }
11299
- const errorMsg = errorDetails ? `403 Forbidden: ${errorDetails}` : "403 Forbidden - Request blocked by server. Check debug logs at ~/.bike4mind/debug/";
11300
- reject(new Error(errorMsg));
11300
+ const errorMsg2 = errorDetails ? `403 Forbidden: ${errorDetails}` : "403 Forbidden - Request blocked by server. Check debug logs at ~/.bike4mind/debug/";
11301
+ reject(new Error(errorMsg2));
11301
11302
  return;
11302
11303
  }
11303
11304
  if (error.response) {
@@ -11554,7 +11555,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11554
11555
  // package.json
11555
11556
  var package_default = {
11556
11557
  name: "@bike4mind/cli",
11557
- version: "0.2.11-fix-cli-socket-hangup-error-handling.17320+0e857a508",
11558
+ version: "0.2.11-fix-cli-socket-hangup-error-handling.17321+491f73515",
11558
11559
  type: "module",
11559
11560
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11560
11561
  license: "UNLICENSED",
@@ -11658,10 +11659,10 @@ var package_default = {
11658
11659
  },
11659
11660
  devDependencies: {
11660
11661
  "@bike4mind/agents": "0.1.0",
11661
- "@bike4mind/common": "2.40.1-fix-cli-socket-hangup-error-handling.17320+0e857a508",
11662
- "@bike4mind/mcp": "1.20.5-fix-cli-socket-hangup-error-handling.17320+0e857a508",
11663
- "@bike4mind/services": "2.35.1-fix-cli-socket-hangup-error-handling.17320+0e857a508",
11664
- "@bike4mind/utils": "2.1.5-fix-cli-socket-hangup-error-handling.17320+0e857a508",
11662
+ "@bike4mind/common": "2.40.1-fix-cli-socket-hangup-error-handling.17321+491f73515",
11663
+ "@bike4mind/mcp": "1.20.5-fix-cli-socket-hangup-error-handling.17321+491f73515",
11664
+ "@bike4mind/services": "2.35.1-fix-cli-socket-hangup-error-handling.17321+491f73515",
11665
+ "@bike4mind/utils": "2.1.5-fix-cli-socket-hangup-error-handling.17321+491f73515",
11665
11666
  "@types/better-sqlite3": "^7.6.13",
11666
11667
  "@types/diff": "^5.0.9",
11667
11668
  "@types/jsonwebtoken": "^9.0.4",
@@ -11674,7 +11675,7 @@ var package_default = {
11674
11675
  typescript: "^5.9.3",
11675
11676
  vitest: "^3.2.4"
11676
11677
  },
11677
- gitHead: "0e857a50868cd4445d961180d5cd490d87585138"
11678
+ gitHead: "491f7351545d881122b4f774bf1bd92ac6439c2a"
11678
11679
  };
11679
11680
 
11680
11681
  // src/config/constants.ts
@@ -12620,31 +12621,6 @@ Remember: Use context from previous messages to understand follow-up questions.$
12620
12621
  return;
12621
12622
  }
12622
12623
  useCliStore.getState().setIsThinking(true);
12623
- const currentSteps = [];
12624
- const pendingAssistantMessage = {
12625
- id: uuidv410(),
12626
- role: "assistant",
12627
- content: "...",
12628
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12629
- metadata: {
12630
- steps: []
12631
- }
12632
- };
12633
- const stepHandler = (step) => {
12634
- currentSteps.push(step);
12635
- const { pendingMessages, updatePendingMessage } = useCliStore.getState();
12636
- const lastIdx = pendingMessages.length - 1;
12637
- if (lastIdx >= 0 && pendingMessages[lastIdx].role === "assistant") {
12638
- updatePendingMessage(lastIdx, {
12639
- ...pendingMessages[lastIdx],
12640
- metadata: {
12641
- ...pendingMessages[lastIdx].metadata,
12642
- steps: [...currentSteps]
12643
- }
12644
- });
12645
- }
12646
- };
12647
- state.agent.on("action", stepHandler);
12648
12624
  try {
12649
12625
  let messageContent = message;
12650
12626
  let userMessageContent = message;
@@ -12666,6 +12642,16 @@ Remember: Use context from previous messages to understand follow-up questions.$
12666
12642
  };
12667
12643
  setState((prev) => ({ ...prev, session: sessionWithUserMessage }));
12668
12644
  setStoreSession(sessionWithUserMessage);
12645
+ const pendingAssistantMessage = {
12646
+ id: uuidv410(),
12647
+ role: "assistant",
12648
+ content: "...",
12649
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12650
+ metadata: {
12651
+ steps: []
12652
+ // Steps will be populated by the init handler's stepHandler
12653
+ }
12654
+ };
12669
12655
  useCliStore.getState().addPendingMessage(pendingAssistantMessage);
12670
12656
  const recentMessages = state.session.messages.slice(-20);
12671
12657
  const previousMessages = recentMessages.filter((msg) => msg.role === "user" || msg.role === "assistant").map((msg) => ({
@@ -12733,13 +12719,16 @@ ${errorMessage}`;
12733
12719
 
12734
12720
  ${errorMessage}`;
12735
12721
  }
12722
+ const { pendingMessages } = useCliStore.getState();
12723
+ const pendingMessage = pendingMessages[0];
12724
+ const capturedSteps = pendingMessage?.metadata?.steps || [];
12736
12725
  const errorAssistantMessage = {
12737
- id: pendingAssistantMessage.id,
12726
+ id: pendingMessage?.id || uuidv410(),
12738
12727
  role: "assistant",
12739
12728
  content: displayMessage,
12740
- timestamp: pendingAssistantMessage.timestamp,
12729
+ timestamp: pendingMessage?.timestamp || (/* @__PURE__ */ new Date()).toISOString(),
12741
12730
  metadata: {
12742
- steps: currentSteps
12731
+ steps: capturedSteps
12743
12732
  // Include any steps that were completed before error
12744
12733
  }
12745
12734
  };
@@ -12754,8 +12743,6 @@ ${errorMessage}`;
12754
12743
  setStoreSession(updatedSession);
12755
12744
  await state.sessionStore.save(updatedSession);
12756
12745
  }
12757
- } finally {
12758
- state.agent.off("action", stepHandler);
12759
12746
  }
12760
12747
  };
12761
12748
  const handleBashCommand = useCallback(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.11-fix-cli-socket-hangup-error-handling.17320+0e857a508",
3
+ "version": "0.2.11-fix-cli-socket-hangup-error-handling.17321+491f73515",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -104,10 +104,10 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "@bike4mind/agents": "0.1.0",
107
- "@bike4mind/common": "2.40.1-fix-cli-socket-hangup-error-handling.17320+0e857a508",
108
- "@bike4mind/mcp": "1.20.5-fix-cli-socket-hangup-error-handling.17320+0e857a508",
109
- "@bike4mind/services": "2.35.1-fix-cli-socket-hangup-error-handling.17320+0e857a508",
110
- "@bike4mind/utils": "2.1.5-fix-cli-socket-hangup-error-handling.17320+0e857a508",
107
+ "@bike4mind/common": "2.40.1-fix-cli-socket-hangup-error-handling.17321+491f73515",
108
+ "@bike4mind/mcp": "1.20.5-fix-cli-socket-hangup-error-handling.17321+491f73515",
109
+ "@bike4mind/services": "2.35.1-fix-cli-socket-hangup-error-handling.17321+491f73515",
110
+ "@bike4mind/utils": "2.1.5-fix-cli-socket-hangup-error-handling.17321+491f73515",
111
111
  "@types/better-sqlite3": "^7.6.13",
112
112
  "@types/diff": "^5.0.9",
113
113
  "@types/jsonwebtoken": "^9.0.4",
@@ -120,5 +120,5 @@
120
120
  "typescript": "^5.9.3",
121
121
  "vitest": "^3.2.4"
122
122
  },
123
- "gitHead": "0e857a50868cd4445d961180d5cd490d87585138"
123
+ "gitHead": "491f7351545d881122b4f774bf1bd92ac6439c2a"
124
124
  }