@bike4mind/cli 0.2.21-fix-idle-timeout-error-message.18216 → 0.2.21-fix-allow-empty-tool-parameters.18230
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/dist/{chunk-5HGFCD76.js → chunk-BKQ3OOVN.js} +187 -39
- package/dist/{chunk-ODEZ5IPN.js → chunk-IPZQZ3JV.js} +1 -1
- package/dist/{chunk-CY4U5QI6.js → chunk-UZSJIKOL.js} +1 -1
- package/dist/{chunk-Y7KY6POM.js → chunk-VGFZ6AA3.js} +1 -1
- package/dist/{create-SJHBZJHC.js → create-NIBOJCLG.js} +2 -2
- package/dist/index.js +10 -10
- package/dist/{mementoService-JY62U4RB.js → mementoService-BFH3L5HQ.js} +2 -2
- package/dist/{src-QBISQZK4.js → src-WXIDZNUW.js} +1 -1
- package/dist/{subtractCredits-SY4SXTIT.js → subtractCredits-UPWGHCRL.js} +2 -2
- package/package.json +6 -6
|
@@ -1965,8 +1965,10 @@ var AnthropicBackend = class {
|
|
|
1965
1965
|
/**
|
|
1966
1966
|
* Emit a CloudWatch metric when a rate limit error occurs.
|
|
1967
1967
|
* This helps monitor and alert on Anthropic API rate limiting issues.
|
|
1968
|
+
* @param model - The model that triggered the rate limit
|
|
1969
|
+
* @param featureArea - The feature area (mcp-tools, chat, built-in-tools, etc.) for filtering (#6413)
|
|
1968
1970
|
*/
|
|
1969
|
-
async emitRateLimitMetric(model) {
|
|
1971
|
+
async emitRateLimitMetric(model, featureArea = "unknown") {
|
|
1970
1972
|
try {
|
|
1971
1973
|
const client = new CloudWatchClient({
|
|
1972
1974
|
region: process.env.AWS_REGION || "us-east-2"
|
|
@@ -1984,13 +1986,15 @@ var AnthropicBackend = class {
|
|
|
1984
1986
|
// SEED_STAGE_NAME is set via DEFAULT_LAMBDA_ENVIRONMENT in infra/constants.ts
|
|
1985
1987
|
// and maps to $app.stage. The alarm in infra/alarms.ts filters by Stage dimension.
|
|
1986
1988
|
// Fallback to 'local' for non-Lambda contexts (local dev, tests).
|
|
1987
|
-
{ Name: "Stage", Value: process.env.SEED_STAGE_NAME || "local" }
|
|
1989
|
+
{ Name: "Stage", Value: process.env.SEED_STAGE_NAME || "local" },
|
|
1990
|
+
// Feature area helps identify which feature is causing rate limits (#6413)
|
|
1991
|
+
{ Name: "FeatureArea", Value: featureArea }
|
|
1988
1992
|
]
|
|
1989
1993
|
}
|
|
1990
1994
|
]
|
|
1991
1995
|
});
|
|
1992
1996
|
await client.send(command);
|
|
1993
|
-
this.logger.info("[AnthropicBackend] Emitted RateLimitError metric to CloudWatch", { model });
|
|
1997
|
+
this.logger.info("[AnthropicBackend] Emitted RateLimitError metric to CloudWatch", { model, featureArea });
|
|
1994
1998
|
} catch (metricsError) {
|
|
1995
1999
|
this.logger.warn("[AnthropicBackend] Failed to emit CloudWatch metric", {
|
|
1996
2000
|
error: metricsError instanceof Error ? metricsError.message : String(metricsError)
|
|
@@ -2290,15 +2294,27 @@ var AnthropicBackend = class {
|
|
|
2290
2294
|
...options
|
|
2291
2295
|
};
|
|
2292
2296
|
const toolCallCount = options._internal?.toolCallCount ?? 0;
|
|
2293
|
-
if (toolCallCount >= DEFAULT_MAX_TOOL_CALLS) {
|
|
2294
|
-
|
|
2297
|
+
if (toolCallCount >= DEFAULT_MAX_TOOL_CALLS && options.tools?.length) {
|
|
2298
|
+
const mcpTools = options.tools?.filter((t) => t._isMcpTool) || [];
|
|
2299
|
+
const builtInTools = options.tools?.filter((t) => !t._isMcpTool) || [];
|
|
2300
|
+
this.logger.warn(`\u26A0\uFE0F Max tool calls limit (${DEFAULT_MAX_TOOL_CALLS}) reached. Disabling tools to prevent infinite loops.`, {
|
|
2301
|
+
model,
|
|
2302
|
+
toolCallCount,
|
|
2303
|
+
toolsUsedSoFar: toolsUsed.map((t) => t.name),
|
|
2304
|
+
availableToolCount: options.tools?.length || 0,
|
|
2305
|
+
mcpToolCount: mcpTools.length,
|
|
2306
|
+
mcpToolNames: mcpTools.map((t) => t.toolSchema.name).slice(0, 10),
|
|
2307
|
+
builtInToolCount: builtInTools.length,
|
|
2308
|
+
builtInToolNames: builtInTools.map((t) => t.toolSchema.name).slice(0, 10),
|
|
2309
|
+
messageCount: messages.length
|
|
2310
|
+
});
|
|
2295
2311
|
await this.complete(model, messages, {
|
|
2296
2312
|
...options,
|
|
2297
2313
|
tools: void 0,
|
|
2298
2314
|
_internal: {
|
|
2299
|
-
...options._internal
|
|
2315
|
+
...options._internal
|
|
2300
2316
|
// Preserve enableIdleTimeout, idleTimeoutMs
|
|
2301
|
-
|
|
2317
|
+
// Keep toolCallCount at the limit - no need to increment when tools are removed
|
|
2302
2318
|
}
|
|
2303
2319
|
}, cb, toolsUsed);
|
|
2304
2320
|
return;
|
|
@@ -2441,7 +2457,6 @@ var AnthropicBackend = class {
|
|
|
2441
2457
|
this.emitIdleTimeoutMetric(model, options.tools?.length || 0, eventCount).catch(() => {
|
|
2442
2458
|
});
|
|
2443
2459
|
stream.controller?.abort?.();
|
|
2444
|
-
reject(new Error(`Stream idle timeout after ${timeoutMs}ms - no events received`));
|
|
2445
2460
|
}, timeoutMs);
|
|
2446
2461
|
};
|
|
2447
2462
|
resetIdleTimer();
|
|
@@ -2556,7 +2571,7 @@ var AnthropicBackend = class {
|
|
|
2556
2571
|
toolCount: options.tools?.length || 0,
|
|
2557
2572
|
idleTimeoutMs: idleTimeoutMsForError
|
|
2558
2573
|
});
|
|
2559
|
-
reject(new Error(`Anthropic API stream timeout - no response received within ${idleTimeoutMsForError / 1e3} seconds. The model may be overloaded
|
|
2574
|
+
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.`));
|
|
2560
2575
|
} else {
|
|
2561
2576
|
this.logger.debug("Anthropic request was aborted (likely client disconnect)");
|
|
2562
2577
|
resolve();
|
|
@@ -2567,27 +2582,53 @@ var AnthropicBackend = class {
|
|
|
2567
2582
|
}
|
|
2568
2583
|
});
|
|
2569
2584
|
if (func.some((f) => f && f.name)) {
|
|
2585
|
+
const toolCallNames = func.filter((t) => t?.name).map((t) => t.name);
|
|
2586
|
+
this.logger.info("[Tool Execution] Model requested tool calls", {
|
|
2587
|
+
model,
|
|
2588
|
+
toolCallCount,
|
|
2589
|
+
toolsRequested: toolCallNames,
|
|
2590
|
+
toolCount: toolCallNames.length,
|
|
2591
|
+
messageCountBefore: messages.length
|
|
2592
|
+
});
|
|
2570
2593
|
for (const tool of func) {
|
|
2571
|
-
if (!tool || !tool.name
|
|
2594
|
+
if (!tool || !tool.name)
|
|
2572
2595
|
continue;
|
|
2573
2596
|
toolsUsed.push({
|
|
2574
2597
|
name: tool.name,
|
|
2575
|
-
arguments: tool.parameters
|
|
2598
|
+
arguments: tool.parameters || "{}"
|
|
2576
2599
|
});
|
|
2577
2600
|
}
|
|
2578
2601
|
if (options.executeTools !== false) {
|
|
2579
2602
|
for (const tool of func) {
|
|
2580
|
-
if (!tool || !tool.name
|
|
2603
|
+
if (!tool || !tool.name)
|
|
2581
2604
|
continue;
|
|
2582
|
-
const { id, name
|
|
2583
|
-
const
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2605
|
+
const { id, name } = tool;
|
|
2606
|
+
const parameters = tool.parameters || "{}";
|
|
2607
|
+
const toolDef = options.tools?.find((tool2) => tool2.toolSchema.name === name);
|
|
2608
|
+
const toolFn = toolDef?.toolFn;
|
|
2609
|
+
const isMcpTool = toolDef?._isMcpTool ?? false;
|
|
2610
|
+
if (name && toolFn) {
|
|
2611
|
+
this.logger.info("[Tool Execution] Executing tool", {
|
|
2612
|
+
model,
|
|
2613
|
+
toolName: name,
|
|
2614
|
+
isMcpTool,
|
|
2615
|
+
toolCallIteration: toolCallCount + 1,
|
|
2616
|
+
parameterKeys: Object.keys(JSON.parse(parameters))
|
|
2617
|
+
});
|
|
2618
|
+
const toolStartTime = Date.now();
|
|
2587
2619
|
try {
|
|
2588
2620
|
const parsedParams = JSON.parse(parameters);
|
|
2589
2621
|
const result = await toolFn(parsedParams);
|
|
2590
|
-
|
|
2622
|
+
const resultStr = result.toString();
|
|
2623
|
+
const toolDuration = Date.now() - toolStartTime;
|
|
2624
|
+
this.logger.info("[Tool Execution] Tool completed successfully", {
|
|
2625
|
+
model,
|
|
2626
|
+
toolName: name,
|
|
2627
|
+
isMcpTool,
|
|
2628
|
+
durationMs: toolDuration,
|
|
2629
|
+
resultLength: resultStr.length,
|
|
2630
|
+
resultPreview: resultStr.substring(0, 100) + (resultStr.length > 100 ? "..." : "")
|
|
2631
|
+
});
|
|
2591
2632
|
await handleToolResultStreaming(name, result, async (results) => {
|
|
2592
2633
|
await cb(results, {
|
|
2593
2634
|
inputTokens: 0,
|
|
@@ -2596,25 +2637,45 @@ var AnthropicBackend = class {
|
|
|
2596
2637
|
});
|
|
2597
2638
|
});
|
|
2598
2639
|
const toolId = id || `tool_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
2599
|
-
this.pushToolMessages(messages, { id: toolId, name, parameters },
|
|
2640
|
+
this.pushToolMessages(messages, { id: toolId, name, parameters }, resultStr);
|
|
2600
2641
|
} catch (error) {
|
|
2642
|
+
const toolDuration = Date.now() - toolStartTime;
|
|
2601
2643
|
if (error instanceof PermissionDeniedError) {
|
|
2602
2644
|
throw error;
|
|
2603
2645
|
}
|
|
2604
|
-
this.logger.error(
|
|
2646
|
+
this.logger.error("[Tool Execution] Tool failed", {
|
|
2647
|
+
model,
|
|
2648
|
+
toolName: name,
|
|
2649
|
+
isMcpTool,
|
|
2650
|
+
durationMs: toolDuration,
|
|
2651
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
2652
|
+
});
|
|
2605
2653
|
const toolId = id || `tool_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
2606
2654
|
this.pushToolMessages(messages, { id: toolId, name, parameters }, `Error processing ${name} tool: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2607
2655
|
}
|
|
2656
|
+
} else if (name && !toolFn) {
|
|
2657
|
+
this.logger.warn("[Tool Execution] Tool function not found", {
|
|
2658
|
+
model,
|
|
2659
|
+
toolName: name,
|
|
2660
|
+
availableTools: options.tools?.map((t) => t.toolSchema.name) || []
|
|
2661
|
+
});
|
|
2608
2662
|
}
|
|
2609
2663
|
}
|
|
2610
2664
|
await cb(["\n\n"], { toolsUsed });
|
|
2611
|
-
this.logger.debug(`[Tool Execution] Making recursive call with ${messages.length} messages`);
|
|
2612
|
-
this.logger.debug(`[Tool Execution] Last few messages:`, JSON.stringify(messages.slice(-3), null, 2));
|
|
2613
2665
|
const hasMcpTool = func.some((tool) => {
|
|
2614
2666
|
if (!tool?.name)
|
|
2615
2667
|
return false;
|
|
2616
2668
|
return options.tools?.find((t) => t.toolSchema.name === tool.name)?._isMcpTool;
|
|
2617
2669
|
});
|
|
2670
|
+
this.logger.info("[Tool Execution] Making recursive call after tool execution", {
|
|
2671
|
+
model,
|
|
2672
|
+
toolCallIteration: toolCallCount + 1,
|
|
2673
|
+
messageCountAfter: messages.length,
|
|
2674
|
+
toolsExecuted: func.filter((t) => t?.name).map((t) => t.name),
|
|
2675
|
+
hasMcpTool,
|
|
2676
|
+
willKeepTools: hasMcpTool,
|
|
2677
|
+
totalToolsUsed: toolsUsed.length
|
|
2678
|
+
});
|
|
2618
2679
|
if (hasMcpTool) {
|
|
2619
2680
|
await this.complete(model, messages, {
|
|
2620
2681
|
...options,
|
|
@@ -2665,41 +2726,80 @@ var AnthropicBackend = class {
|
|
|
2665
2726
|
}
|
|
2666
2727
|
}
|
|
2667
2728
|
for (const tool of func) {
|
|
2668
|
-
if (tool?.name
|
|
2729
|
+
if (tool?.name) {
|
|
2669
2730
|
toolsUsed.push({
|
|
2670
2731
|
name: tool.name,
|
|
2671
|
-
arguments: tool.parameters
|
|
2732
|
+
arguments: tool.parameters || "{}"
|
|
2672
2733
|
});
|
|
2673
2734
|
}
|
|
2674
2735
|
}
|
|
2675
2736
|
await cb(streamedText, { toolsUsed });
|
|
2676
2737
|
if (func.some((f) => f && f.name)) {
|
|
2738
|
+
const toolCallNames = func.filter((t) => t?.name).map((t) => t.name);
|
|
2739
|
+
this.logger.info("[Tool Execution] Model requested tool calls (non-streaming)", {
|
|
2740
|
+
model,
|
|
2741
|
+
toolCallCount,
|
|
2742
|
+
toolsRequested: toolCallNames,
|
|
2743
|
+
toolCount: toolCallNames.length,
|
|
2744
|
+
messageCountBefore: messages.length
|
|
2745
|
+
});
|
|
2677
2746
|
if (options.executeTools !== false) {
|
|
2678
2747
|
for (const tool of func) {
|
|
2679
|
-
if (!tool || !tool.name
|
|
2748
|
+
if (!tool || !tool.name)
|
|
2680
2749
|
continue;
|
|
2681
|
-
const { id, name
|
|
2682
|
-
const
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2750
|
+
const { id, name } = tool;
|
|
2751
|
+
const parameters = tool.parameters || "{}";
|
|
2752
|
+
const toolDef = options.tools?.find((tool2) => tool2.toolSchema.name === name);
|
|
2753
|
+
const toolFn = toolDef?.toolFn;
|
|
2754
|
+
const isMcpTool = toolDef?._isMcpTool ?? false;
|
|
2755
|
+
if (name && toolFn) {
|
|
2756
|
+
this.logger.info("[Tool Execution] Executing tool (non-streaming)", {
|
|
2757
|
+
model,
|
|
2758
|
+
toolName: name,
|
|
2759
|
+
isMcpTool,
|
|
2760
|
+
toolCallIteration: toolCallCount + 1,
|
|
2761
|
+
parameterKeys: Object.keys(JSON.parse(parameters))
|
|
2762
|
+
});
|
|
2763
|
+
const toolStartTime = Date.now();
|
|
2686
2764
|
try {
|
|
2687
2765
|
const parsedParams = JSON.parse(parameters);
|
|
2688
2766
|
const result = await toolFn(parsedParams);
|
|
2689
|
-
|
|
2767
|
+
const resultStr = result.toString();
|
|
2768
|
+
const toolDuration = Date.now() - toolStartTime;
|
|
2769
|
+
this.logger.info("[Tool Execution] Tool completed successfully (non-streaming)", {
|
|
2770
|
+
model,
|
|
2771
|
+
toolName: name,
|
|
2772
|
+
isMcpTool,
|
|
2773
|
+
durationMs: toolDuration,
|
|
2774
|
+
resultLength: resultStr.length,
|
|
2775
|
+
resultPreview: resultStr.substring(0, 100) + (resultStr.length > 100 ? "..." : "")
|
|
2776
|
+
});
|
|
2690
2777
|
await handleToolResultStreaming(name, result, async (results) => {
|
|
2691
2778
|
await cb(results, { toolsUsed });
|
|
2692
2779
|
});
|
|
2693
2780
|
const toolId = id || `tool_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
2694
|
-
this.pushToolMessages(messages, { id: toolId, name, parameters },
|
|
2781
|
+
this.pushToolMessages(messages, { id: toolId, name, parameters }, resultStr);
|
|
2695
2782
|
} catch (error) {
|
|
2783
|
+
const toolDuration = Date.now() - toolStartTime;
|
|
2696
2784
|
if (error instanceof PermissionDeniedError) {
|
|
2697
2785
|
throw error;
|
|
2698
2786
|
}
|
|
2699
|
-
this.logger.error(
|
|
2787
|
+
this.logger.error("[Tool Execution] Tool failed (non-streaming)", {
|
|
2788
|
+
model,
|
|
2789
|
+
toolName: name,
|
|
2790
|
+
isMcpTool,
|
|
2791
|
+
durationMs: toolDuration,
|
|
2792
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
2793
|
+
});
|
|
2700
2794
|
const toolId = id || `tool_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
2701
2795
|
this.pushToolMessages(messages, { id: toolId, name, parameters }, `Error processing ${name} tool: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2702
2796
|
}
|
|
2797
|
+
} else if (name && !toolFn) {
|
|
2798
|
+
this.logger.warn("[Tool Execution] Tool function not found (non-streaming)", {
|
|
2799
|
+
model,
|
|
2800
|
+
toolName: name,
|
|
2801
|
+
availableTools: options.tools?.map((t) => t.toolSchema.name) || []
|
|
2802
|
+
});
|
|
2703
2803
|
}
|
|
2704
2804
|
}
|
|
2705
2805
|
const hasMcpTool = func.some((tool) => {
|
|
@@ -2707,6 +2807,15 @@ var AnthropicBackend = class {
|
|
|
2707
2807
|
return false;
|
|
2708
2808
|
return options.tools?.find((t) => t.toolSchema.name === tool.name)?._isMcpTool;
|
|
2709
2809
|
});
|
|
2810
|
+
this.logger.info("[Tool Execution] Making recursive call after tool execution (non-streaming)", {
|
|
2811
|
+
model,
|
|
2812
|
+
toolCallIteration: toolCallCount + 1,
|
|
2813
|
+
messageCountAfter: messages.length,
|
|
2814
|
+
toolsExecuted: func.filter((t) => t?.name).map((t) => t.name),
|
|
2815
|
+
hasMcpTool,
|
|
2816
|
+
willKeepTools: hasMcpTool,
|
|
2817
|
+
totalToolsUsed: toolsUsed.length
|
|
2818
|
+
});
|
|
2710
2819
|
await cb(["\n\n"], { toolsUsed });
|
|
2711
2820
|
if (hasMcpTool) {
|
|
2712
2821
|
await this.complete(model, messages, {
|
|
@@ -2741,12 +2850,41 @@ var AnthropicBackend = class {
|
|
|
2741
2850
|
}
|
|
2742
2851
|
} catch (error) {
|
|
2743
2852
|
if (error instanceof RateLimitError) {
|
|
2853
|
+
const mcpTools = options.tools?.filter((t) => t._isMcpTool) || [];
|
|
2854
|
+
const builtInTools = options.tools?.filter((t) => !t._isMcpTool) || [];
|
|
2855
|
+
const hasMcpTools = mcpTools.length > 0;
|
|
2856
|
+
const hasBuiltInTools = builtInTools.length > 0;
|
|
2857
|
+
let featureArea = "chat";
|
|
2858
|
+
if (hasMcpTools && !hasBuiltInTools) {
|
|
2859
|
+
featureArea = "mcp-tools";
|
|
2860
|
+
} else if (hasMcpTools && hasBuiltInTools) {
|
|
2861
|
+
featureArea = "mcp-tools+built-in";
|
|
2862
|
+
} else if (hasBuiltInTools) {
|
|
2863
|
+
featureArea = "built-in-tools";
|
|
2864
|
+
}
|
|
2865
|
+
let requestType = "initial-chat";
|
|
2866
|
+
if (toolCallCount > 0) {
|
|
2867
|
+
requestType = `tool-continuation-${toolCallCount}`;
|
|
2868
|
+
} else if (options.tools?.length) {
|
|
2869
|
+
requestType = "initial-with-tools";
|
|
2870
|
+
}
|
|
2744
2871
|
this.logger.error("[AnthropicBackend] Rate limit error after all retries exhausted", {
|
|
2745
2872
|
model,
|
|
2746
2873
|
status: error.status,
|
|
2747
|
-
message: error.message
|
|
2874
|
+
message: error.message,
|
|
2875
|
+
// Context for ops (#6413)
|
|
2876
|
+
featureArea,
|
|
2877
|
+
requestType,
|
|
2878
|
+
toolCallIteration: toolCallCount,
|
|
2879
|
+
toolsUsedSoFar: toolsUsed.map((t) => t.name),
|
|
2880
|
+
availableToolCount: options.tools?.length || 0,
|
|
2881
|
+
mcpToolCount: mcpTools.length,
|
|
2882
|
+
mcpToolNames: mcpTools.map((t) => t.toolSchema.name).slice(0, 10),
|
|
2883
|
+
builtInToolCount: builtInTools.length,
|
|
2884
|
+
builtInToolNames: builtInTools.map((t) => t.toolSchema.name).slice(0, 10),
|
|
2885
|
+
messageCount: messages.length
|
|
2748
2886
|
});
|
|
2749
|
-
this.emitRateLimitMetric(model).catch(() => {
|
|
2887
|
+
this.emitRateLimitMetric(model, featureArea).catch(() => {
|
|
2750
2888
|
});
|
|
2751
2889
|
} else {
|
|
2752
2890
|
this.logger.debug("Error in complete:", error);
|
|
@@ -6072,9 +6210,14 @@ var OpenAIBackend = class {
|
|
|
6072
6210
|
...options
|
|
6073
6211
|
};
|
|
6074
6212
|
const toolCallCount = options._internal?.toolCallCount ?? 0;
|
|
6075
|
-
if (toolCallCount >= DEFAULT_MAX_TOOL_CALLS) {
|
|
6213
|
+
if (toolCallCount >= DEFAULT_MAX_TOOL_CALLS && options.tools?.length) {
|
|
6076
6214
|
this.logger.warn(`\u26A0\uFE0F Max tool calls limit (${DEFAULT_MAX_TOOL_CALLS}) reached. Disabling tools to prevent infinite loops.`);
|
|
6077
|
-
await this.complete(model, messages, {
|
|
6215
|
+
await this.complete(model, messages, {
|
|
6216
|
+
...options,
|
|
6217
|
+
tools: void 0,
|
|
6218
|
+
_internal: options._internal
|
|
6219
|
+
// Preserve any internal settings
|
|
6220
|
+
}, callback, toolsUsed);
|
|
6078
6221
|
return;
|
|
6079
6222
|
}
|
|
6080
6223
|
const rawTools = options.tools;
|
|
@@ -6581,9 +6724,14 @@ var XAIBackend = class {
|
|
|
6581
6724
|
...options
|
|
6582
6725
|
};
|
|
6583
6726
|
const toolCallCount = options._internal?.toolCallCount ?? 0;
|
|
6584
|
-
if (toolCallCount >= DEFAULT_MAX_TOOL_CALLS) {
|
|
6727
|
+
if (toolCallCount >= DEFAULT_MAX_TOOL_CALLS && options.tools?.length) {
|
|
6585
6728
|
this.logger.warn(`\u26A0\uFE0F Max tool calls limit (${DEFAULT_MAX_TOOL_CALLS}) reached. Disabling tools to prevent infinite loops.`);
|
|
6586
|
-
await this.complete(model, messages, {
|
|
6729
|
+
await this.complete(model, messages, {
|
|
6730
|
+
...options,
|
|
6731
|
+
tools: void 0,
|
|
6732
|
+
_internal: options._internal
|
|
6733
|
+
// Preserve any internal settings
|
|
6734
|
+
}, callback, toolsUsed);
|
|
6587
6735
|
return;
|
|
6588
6736
|
}
|
|
6589
6737
|
const rawTools = options.tools;
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-UZSJIKOL.js";
|
|
8
8
|
import {
|
|
9
9
|
ConfigStore
|
|
10
10
|
} from "./chunk-VFQF2JIT.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-VGFZ6AA3.js";
|
|
12
|
+
import "./chunk-IPZQZ3JV.js";
|
|
13
13
|
import {
|
|
14
14
|
BFLImageService,
|
|
15
15
|
BaseStorage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
OpenAIBackend,
|
|
22
22
|
OpenAIImageService,
|
|
23
23
|
XAIImageService
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-BKQ3OOVN.js";
|
|
25
25
|
import {
|
|
26
26
|
AiEvents,
|
|
27
27
|
ApiKeyEvents,
|
|
@@ -12262,7 +12262,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
12262
12262
|
// package.json
|
|
12263
12263
|
var package_default = {
|
|
12264
12264
|
name: "@bike4mind/cli",
|
|
12265
|
-
version: "0.2.21-fix-
|
|
12265
|
+
version: "0.2.21-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
12266
12266
|
type: "module",
|
|
12267
12267
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
12268
12268
|
license: "UNLICENSED",
|
|
@@ -12369,10 +12369,10 @@ var package_default = {
|
|
|
12369
12369
|
},
|
|
12370
12370
|
devDependencies: {
|
|
12371
12371
|
"@bike4mind/agents": "0.1.0",
|
|
12372
|
-
"@bike4mind/common": "2.45.1-fix-
|
|
12373
|
-
"@bike4mind/mcp": "1.25.1-fix-
|
|
12374
|
-
"@bike4mind/services": "2.43.1-fix-
|
|
12375
|
-
"@bike4mind/utils": "2.3.1-fix-
|
|
12372
|
+
"@bike4mind/common": "2.45.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
12373
|
+
"@bike4mind/mcp": "1.25.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
12374
|
+
"@bike4mind/services": "2.43.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
12375
|
+
"@bike4mind/utils": "2.3.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
12376
12376
|
"@types/better-sqlite3": "^7.6.13",
|
|
12377
12377
|
"@types/diff": "^5.0.9",
|
|
12378
12378
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -12389,7 +12389,7 @@ var package_default = {
|
|
|
12389
12389
|
optionalDependencies: {
|
|
12390
12390
|
"@vscode/ripgrep": "^1.17.0"
|
|
12391
12391
|
},
|
|
12392
|
-
gitHead: "
|
|
12392
|
+
gitHead: "84a90f5c4950d7592316baf2a65466025f26eef4"
|
|
12393
12393
|
};
|
|
12394
12394
|
|
|
12395
12395
|
// src/config/constants.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.21-fix-
|
|
3
|
+
"version": "0.2.21-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@bike4mind/agents": "0.1.0",
|
|
110
|
-
"@bike4mind/common": "2.45.1-fix-
|
|
111
|
-
"@bike4mind/mcp": "1.25.1-fix-
|
|
112
|
-
"@bike4mind/services": "2.43.1-fix-
|
|
113
|
-
"@bike4mind/utils": "2.3.1-fix-
|
|
110
|
+
"@bike4mind/common": "2.45.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
111
|
+
"@bike4mind/mcp": "1.25.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
112
|
+
"@bike4mind/services": "2.43.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
113
|
+
"@bike4mind/utils": "2.3.1-fix-allow-empty-tool-parameters.18230+84a90f5c4",
|
|
114
114
|
"@types/better-sqlite3": "^7.6.13",
|
|
115
115
|
"@types/diff": "^5.0.9",
|
|
116
116
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"optionalDependencies": {
|
|
128
128
|
"@vscode/ripgrep": "^1.17.0"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "84a90f5c4950d7592316baf2a65466025f26eef4"
|
|
131
131
|
}
|