@nomad-e/bluma-cli 0.26.1 → 0.26.3
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/main.js +23 -9
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -25711,6 +25711,9 @@ function resolveReasoningEffortForRequest(params, runtimeConfig = getRuntimeConf
|
|
|
25711
25711
|
}
|
|
25712
25712
|
return effort;
|
|
25713
25713
|
}
|
|
25714
|
+
function isReasoningEnabledForRequest(params, runtimeConfig = getRuntimeConfig()) {
|
|
25715
|
+
return resolveReasoningEffortForRequest(params, runtimeConfig) !== void 0;
|
|
25716
|
+
}
|
|
25714
25717
|
function buildChatCompletionRequestBody(params, runtimeConfig = getRuntimeConfig(), stream = false, options) {
|
|
25715
25718
|
const tools = params.tools;
|
|
25716
25719
|
const hasTools = Array.isArray(tools) && tools.length > 0;
|
|
@@ -26068,15 +26071,19 @@ var LLMService = class {
|
|
|
26068
26071
|
}
|
|
26069
26072
|
const toolCallsAccumulator = /* @__PURE__ */ new Map();
|
|
26070
26073
|
let reasoningSnapshot = "";
|
|
26074
|
+
const reasoningEnabled = isReasoningEnabledForRequest(params, runtimeConfig);
|
|
26071
26075
|
for await (const chunk of stream) {
|
|
26072
26076
|
const choice = chunk.choices[0];
|
|
26073
26077
|
if (!choice) continue;
|
|
26074
26078
|
const delta = choice.delta;
|
|
26075
26079
|
applyDeltaToolCallsToAccumulator(toolCallsAccumulator, delta?.tool_calls);
|
|
26076
|
-
|
|
26077
|
-
|
|
26078
|
-
|
|
26079
|
-
reasoningSnapshot
|
|
26080
|
+
let reasoning = "";
|
|
26081
|
+
if (reasoningEnabled) {
|
|
26082
|
+
const rawReasoning = delta?.reasoning_content || delta?.reasoning || "";
|
|
26083
|
+
reasoning = extractStreamingDelta(reasoningSnapshot, rawReasoning);
|
|
26084
|
+
if (reasoning) {
|
|
26085
|
+
reasoningSnapshot += reasoning;
|
|
26086
|
+
}
|
|
26080
26087
|
}
|
|
26081
26088
|
const fullToolCalls = choice.finish_reason === "tool_calls" ? Array.from(toolCallsAccumulator.values()) : void 0;
|
|
26082
26089
|
yield {
|
|
@@ -27802,20 +27809,23 @@ var BluMaTurnCoordinator = class {
|
|
|
27802
27809
|
let toolCalls;
|
|
27803
27810
|
let hasEmittedStart = false;
|
|
27804
27811
|
let currentStreamPhase = "idle";
|
|
27805
|
-
const
|
|
27812
|
+
const llmUserContext = this.deps.getLlmUserContext();
|
|
27813
|
+
const streamParams = {
|
|
27806
27814
|
messages: contextWindow,
|
|
27807
27815
|
temperature: 0,
|
|
27808
27816
|
tools: this.deps.mcpClient.getAvailableTools(),
|
|
27809
27817
|
parallel_tool_calls: true,
|
|
27810
|
-
userContext:
|
|
27811
|
-
}
|
|
27818
|
+
userContext: llmUserContext
|
|
27819
|
+
};
|
|
27820
|
+
const reasoningEnabled = isReasoningEnabledForRequest(streamParams);
|
|
27821
|
+
const stream = llmService.chatCompletionStream(streamParams);
|
|
27812
27822
|
for await (const chunk of stream) {
|
|
27813
27823
|
if (this.deps.isInterrupted()) {
|
|
27814
27824
|
this.deps.eventBus.emit("stream_end", {});
|
|
27815
27825
|
this.deps.eventBus.emit("backend_message", { type: "info", message: "Agent task cancelled by user." });
|
|
27816
27826
|
return;
|
|
27817
27827
|
}
|
|
27818
|
-
if (chunk.reasoning) {
|
|
27828
|
+
if (chunk.reasoning && reasoningEnabled) {
|
|
27819
27829
|
if (!hasEmittedStart) {
|
|
27820
27830
|
this.deps.eventBus.emit("stream_start", {});
|
|
27821
27831
|
hasEmittedStart = true;
|
|
@@ -27936,7 +27946,11 @@ var BluMaTurnCoordinator = class {
|
|
|
27936
27946
|
}
|
|
27937
27947
|
let message2 = response.choices[0].message;
|
|
27938
27948
|
message2 = ToolCallNormalizer.normalizeAssistantMessage(message2);
|
|
27939
|
-
|
|
27949
|
+
const reasoningEnabled = isReasoningEnabledForRequest({
|
|
27950
|
+
messages: contextWindow,
|
|
27951
|
+
userContext: this.deps.getLlmUserContext()
|
|
27952
|
+
});
|
|
27953
|
+
if (reasoningEnabled && (message2.reasoning_content || message2.reasoning)) {
|
|
27940
27954
|
const reasoningText = message2.reasoning_content || message2.reasoning;
|
|
27941
27955
|
this.deps.eventBus.emit("backend_message", {
|
|
27942
27956
|
type: "reasoning",
|