@bike4mind/cli 0.2.60-fix-sre-callback-auth.21619 → 0.2.60-fix-7468-stream-idle-timeout-json-parse.21650

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.
@@ -113,11 +113,12 @@ var S3Storage = class extends BaseStorage {
113
113
  /**
114
114
  * Get a signed URL for a file in the storage bucket that expires after the specified time
115
115
  */
116
- async getSignedUrl(path2, method = "get", { expiresIn = 3600, ACL, ResponseContentDisposition } = {}) {
116
+ async getSignedUrl(path2, method = "get", { expiresIn = 3600, ACL, ContentType, ResponseContentDisposition } = {}) {
117
117
  return await getSignedUrl(this.s3, method !== "get" ? new PutObjectCommand({
118
118
  Bucket: this.bucketName,
119
119
  Key: path2,
120
- ACL
120
+ ACL,
121
+ ContentType
121
122
  }) : new GetObjectCommand({
122
123
  Bucket: this.bucketName,
123
124
  Key: path2,
@@ -3393,6 +3394,16 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
3393
3394
  if (idleTimer)
3394
3395
  clearTimeout(idleTimer);
3395
3396
  }
3397
+ if (isIdleTimeout) {
3398
+ this.logger.error("[AnthropicBackend] Stream ended after idle timeout - rejecting to avoid processing partial data", {
3399
+ model,
3400
+ toolCount: options.tools?.length || 0,
3401
+ idleTimeoutMs: idleTimeoutMsForError,
3402
+ funcEntries: func.filter((f) => f?.name).length
3403
+ });
3404
+ reject(new Error(`Anthropic API stream timeout - no response received within ${idleTimeoutMsForError / 1e3} seconds. The model may be overloaded. Try simplifying your request or using fewer tools.`));
3405
+ return;
3406
+ }
3396
3407
  if (this.isThinkingEnabled && collectedContent.length > 0) {
3397
3408
  this.lastAssistantContent = collectedContent.filter((c) => c != null);
3398
3409
  }
@@ -3473,16 +3484,30 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
3473
3484
  const toolFn = toolDef?.toolFn;
3474
3485
  const isMcpTool = toolDef?._isMcpTool ?? false;
3475
3486
  if (name && toolFn) {
3487
+ let parsedParams;
3488
+ try {
3489
+ parsedParams = JSON.parse(parameters);
3490
+ } catch (parseError) {
3491
+ this.logger.error("[Tool Execution] Invalid tool parameters - skipping execution", {
3492
+ model,
3493
+ toolName: name,
3494
+ isMcpTool,
3495
+ parametersPreview: parameters.substring(0, 100),
3496
+ error: parseError instanceof Error ? parseError.message : String(parseError)
3497
+ });
3498
+ const toolId = id || `tool_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
3499
+ this.pushToolMessages(messages, { id: toolId, name, parameters: "{}" }, `Error: Tool parameters were corrupted due to a stream interruption. Please retry.`);
3500
+ continue;
3501
+ }
3476
3502
  this.logger.info("[Tool Execution] Executing tool", {
3477
3503
  model,
3478
3504
  toolName: name,
3479
3505
  isMcpTool,
3480
3506
  toolCallIteration: toolCallCount + 1,
3481
- parameterKeys: Object.keys(JSON.parse(parameters))
3507
+ parameterKeys: Object.keys(parsedParams)
3482
3508
  });
3483
3509
  const toolStartTime = Date.now();
3484
3510
  try {
3485
- const parsedParams = JSON.parse(parameters);
3486
3511
  const result = await toolFn(parsedParams);
3487
3512
  const resultStr = result.toString();
3488
3513
  const toolDuration = Date.now() - toolStartTime;
@@ -3623,16 +3648,30 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
3623
3648
  const toolFn = toolDef?.toolFn;
3624
3649
  const isMcpTool = toolDef?._isMcpTool ?? false;
3625
3650
  if (name && toolFn) {
3651
+ let parsedParams;
3652
+ try {
3653
+ parsedParams = JSON.parse(parameters);
3654
+ } catch (parseError) {
3655
+ this.logger.error("[Tool Execution] Invalid tool parameters - skipping execution (non-streaming)", {
3656
+ model,
3657
+ toolName: name,
3658
+ isMcpTool,
3659
+ parametersPreview: parameters.substring(0, 100),
3660
+ error: parseError instanceof Error ? parseError.message : String(parseError)
3661
+ });
3662
+ const toolId = id || `tool_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
3663
+ this.pushToolMessages(messages, { id: toolId, name, parameters: "{}" }, `Error: Tool parameters were corrupted. Please retry.`);
3664
+ continue;
3665
+ }
3626
3666
  this.logger.info("[Tool Execution] Executing tool (non-streaming)", {
3627
3667
  model,
3628
3668
  toolName: name,
3629
3669
  isMcpTool,
3630
3670
  toolCallIteration: toolCallCount + 1,
3631
- parameterKeys: Object.keys(JSON.parse(parameters))
3671
+ parameterKeys: Object.keys(parsedParams)
3632
3672
  });
3633
3673
  const toolStartTime = Date.now();
3634
3674
  try {
3635
- const parsedParams = JSON.parse(parameters);
3636
3675
  const result = await toolFn(parsedParams);
3637
3676
  const resultStr = result.toString();
3638
3677
  const toolDuration = Date.now() - toolStartTime;
@@ -3762,6 +3801,12 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
3762
3801
  });
3763
3802
  this.logger.debug(`[AnthropicBackend] Including ${this.lastAssistantContent.length} content blocks (thinking + tool_use) in assistant message`);
3764
3803
  } else if (thinkingBlocks && thinkingBlocks.length > 0) {
3804
+ let parsedInput;
3805
+ try {
3806
+ parsedInput = JSON.parse(tool.parameters || "{}");
3807
+ } catch {
3808
+ parsedInput = {};
3809
+ }
3765
3810
  messages.push({
3766
3811
  role: "assistant",
3767
3812
  content: [
@@ -3770,12 +3815,18 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
3770
3815
  type: "tool_use",
3771
3816
  id: tool.id,
3772
3817
  name: tool.name,
3773
- input: JSON.parse(tool.parameters || "{}")
3818
+ input: parsedInput
3774
3819
  }
3775
3820
  ]
3776
3821
  });
3777
3822
  this.logger.debug(`[AnthropicBackend] Including ${thinkingBlocks.length} explicit thinking blocks in assistant message`);
3778
3823
  } else {
3824
+ let parsedInput;
3825
+ try {
3826
+ parsedInput = JSON.parse(tool.parameters || "{}");
3827
+ } catch {
3828
+ parsedInput = {};
3829
+ }
3779
3830
  messages.push({
3780
3831
  role: "assistant",
3781
3832
  content: [
@@ -3783,7 +3834,7 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
3783
3834
  type: "tool_use",
3784
3835
  id: tool.id,
3785
3836
  name: tool.name,
3786
- input: JSON.parse(tool.parameters || "{}")
3837
+ input: parsedInput
3787
3838
  }
3788
3839
  ]
3789
3840
  });
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@bike4mind/cli",
6
- version: "0.2.60-fix-sre-callback-auth.21619+16b9875ab",
6
+ version: "0.2.60-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
7
7
  type: "module",
8
8
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9
9
  license: "UNLICENSED",
@@ -118,11 +118,11 @@ var package_default = {
118
118
  zustand: "^4.5.4"
119
119
  },
120
120
  devDependencies: {
121
- "@bike4mind/agents": "0.2.4-fix-sre-callback-auth.21619+16b9875ab",
122
- "@bike4mind/common": "2.72.1-fix-sre-callback-auth.21619+16b9875ab",
123
- "@bike4mind/mcp": "1.33.18-fix-sre-callback-auth.21619+16b9875ab",
124
- "@bike4mind/services": "2.67.1-fix-sre-callback-auth.21619+16b9875ab",
125
- "@bike4mind/utils": "2.15.12-fix-sre-callback-auth.21619+16b9875ab",
121
+ "@bike4mind/agents": "0.2.4-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
122
+ "@bike4mind/common": "2.72.1-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
123
+ "@bike4mind/mcp": "1.33.18-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
124
+ "@bike4mind/services": "2.67.1-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
125
+ "@bike4mind/utils": "2.15.12-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
126
126
  "@types/better-sqlite3": "^7.6.13",
127
127
  "@types/jsonwebtoken": "^9.0.4",
128
128
  "@types/node": "^22.9.0",
@@ -139,7 +139,7 @@ var package_default = {
139
139
  optionalDependencies: {
140
140
  "@vscode/ripgrep": "^1.17.1"
141
141
  },
142
- gitHead: "16b9875ab68384690d43a3344ace76ea88634997"
142
+ gitHead: "a0a014ab25c9dfbb7e9af47f5ad4778fdddf7875"
143
143
  };
144
144
 
145
145
  // src/utils/updateChecker.ts
@@ -7,7 +7,7 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-ZHEK333R.js";
10
+ } from "./chunk-2AHW53CX.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
@@ -4,7 +4,7 @@ import {
4
4
  getOpenWeatherKey,
5
5
  getSerperKey,
6
6
  getWolframAlphaKey
7
- } from "./chunk-5DKE2BON.js";
7
+ } from "./chunk-NCM6PTNG.js";
8
8
  import {
9
9
  BFLImageService,
10
10
  BaseStorage,
@@ -16,7 +16,7 @@ import {
16
16
  OpenAIBackend,
17
17
  OpenAIImageService,
18
18
  XAIImageService
19
- } from "./chunk-ZHEK333R.js";
19
+ } from "./chunk-2AHW53CX.js";
20
20
  import {
21
21
  Logger
22
22
  } from "./chunk-PFBYGCOW.js";
@@ -6,7 +6,7 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-ZHEK333R.js";
9
+ } from "./chunk-2AHW53CX.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-ZHEK333R.js";
5
+ } from "./chunk-2AHW53CX.js";
6
6
  import {
7
7
  CompletionApiUsageTransaction,
8
8
  GenericCreditDeductTransaction,
@@ -3,7 +3,7 @@ import {
3
3
  fetchLatestVersion,
4
4
  forceCheckForUpdate,
5
5
  package_default
6
- } from "../chunk-GOIRZ5I7.js";
6
+ } from "../chunk-2TJSZQUI.js";
7
7
 
8
8
  // src/commands/doctorCommand.ts
9
9
  import { execSync } from "child_process";
@@ -36,13 +36,13 @@ import {
36
36
  isReadOnlyTool,
37
37
  loadContextFiles,
38
38
  setWebSocketToolExecutor
39
- } from "../chunk-2CYMXERZ.js";
39
+ } from "../chunk-EH4DPSJG.js";
40
40
  import "../chunk-BDQBOLYG.js";
41
- import "../chunk-5DKE2BON.js";
41
+ import "../chunk-NCM6PTNG.js";
42
42
  import "../chunk-GQGOWACU.js";
43
- import "../chunk-ER4OPYS4.js";
44
- import "../chunk-BMC6NW4A.js";
45
- import "../chunk-ZHEK333R.js";
43
+ import "../chunk-NKXSOWGK.js";
44
+ import "../chunk-D7ULLZFZ.js";
45
+ import "../chunk-2AHW53CX.js";
46
46
  import "../chunk-PFBYGCOW.js";
47
47
  import "../chunk-BPFEGDC7.js";
48
48
  import {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  forceCheckForUpdate,
4
4
  package_default
5
- } from "../chunk-GOIRZ5I7.js";
5
+ } from "../chunk-2TJSZQUI.js";
6
6
 
7
7
  // src/commands/updateCommand.ts
8
8
  import { execSync } from "child_process";
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-BMC6NW4A.js";
6
- import "./chunk-ZHEK333R.js";
5
+ } from "./chunk-D7ULLZFZ.js";
6
+ import "./chunk-2AHW53CX.js";
7
7
  import "./chunk-PFBYGCOW.js";
8
8
  import "./chunk-GW7BH2V4.js";
9
9
  export {
package/dist/index.js CHANGED
@@ -48,15 +48,15 @@ import {
48
48
  setWebSocketToolExecutor,
49
49
  substituteArguments,
50
50
  warmFileCache
51
- } from "./chunk-2CYMXERZ.js";
51
+ } from "./chunk-EH4DPSJG.js";
52
52
  import "./chunk-BDQBOLYG.js";
53
- import "./chunk-5DKE2BON.js";
53
+ import "./chunk-NCM6PTNG.js";
54
54
  import "./chunk-GQGOWACU.js";
55
- import "./chunk-ER4OPYS4.js";
56
- import "./chunk-BMC6NW4A.js";
55
+ import "./chunk-NKXSOWGK.js";
56
+ import "./chunk-D7ULLZFZ.js";
57
57
  import {
58
58
  OllamaBackend
59
- } from "./chunk-ZHEK333R.js";
59
+ } from "./chunk-2AHW53CX.js";
60
60
  import "./chunk-PFBYGCOW.js";
61
61
  import "./chunk-BPFEGDC7.js";
62
62
  import {
@@ -66,7 +66,7 @@ import {
66
66
  import {
67
67
  checkForUpdate,
68
68
  package_default
69
- } from "./chunk-GOIRZ5I7.js";
69
+ } from "./chunk-2TJSZQUI.js";
70
70
  import {
71
71
  selectActiveBackgroundAgents,
72
72
  useCliStore
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-5DKE2BON.js";
6
- import "./chunk-ZHEK333R.js";
5
+ } from "./chunk-NCM6PTNG.js";
6
+ import "./chunk-2AHW53CX.js";
7
7
  import "./chunk-PFBYGCOW.js";
8
8
  import "./chunk-GW7BH2V4.js";
9
9
  export {
@@ -143,7 +143,7 @@ import {
143
143
  validateUrlForFetch,
144
144
  warmUpSettingsCache,
145
145
  withRetry
146
- } from "./chunk-ZHEK333R.js";
146
+ } from "./chunk-2AHW53CX.js";
147
147
  import {
148
148
  Logger,
149
149
  NotificationDeduplicator,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-ER4OPYS4.js";
6
- import "./chunk-ZHEK333R.js";
5
+ } from "./chunk-NKXSOWGK.js";
6
+ import "./chunk-2AHW53CX.js";
7
7
  import "./chunk-PFBYGCOW.js";
8
8
  import "./chunk-GW7BH2V4.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.60-fix-sre-callback-auth.21619+16b9875ab",
3
+ "version": "0.2.60-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -115,11 +115,11 @@
115
115
  "zustand": "^4.5.4"
116
116
  },
117
117
  "devDependencies": {
118
- "@bike4mind/agents": "0.2.4-fix-sre-callback-auth.21619+16b9875ab",
119
- "@bike4mind/common": "2.72.1-fix-sre-callback-auth.21619+16b9875ab",
120
- "@bike4mind/mcp": "1.33.18-fix-sre-callback-auth.21619+16b9875ab",
121
- "@bike4mind/services": "2.67.1-fix-sre-callback-auth.21619+16b9875ab",
122
- "@bike4mind/utils": "2.15.12-fix-sre-callback-auth.21619+16b9875ab",
118
+ "@bike4mind/agents": "0.2.4-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
119
+ "@bike4mind/common": "2.72.1-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
120
+ "@bike4mind/mcp": "1.33.18-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
121
+ "@bike4mind/services": "2.67.1-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
122
+ "@bike4mind/utils": "2.15.12-fix-7468-stream-idle-timeout-json-parse.21650+a0a014ab2",
123
123
  "@types/better-sqlite3": "^7.6.13",
124
124
  "@types/jsonwebtoken": "^9.0.4",
125
125
  "@types/node": "^22.9.0",
@@ -136,5 +136,5 @@
136
136
  "optionalDependencies": {
137
137
  "@vscode/ripgrep": "^1.17.1"
138
138
  },
139
- "gitHead": "16b9875ab68384690d43a3344ace76ea88634997"
139
+ "gitHead": "a0a014ab25c9dfbb7e9af47f5ad4778fdddf7875"
140
140
  }