@dotobokuri/fleet-console 1.49.0 → 1.50.1
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.
|
@@ -38272,14 +38272,22 @@ function translateMessage(message) {
|
|
|
38272
38272
|
}
|
|
38273
38273
|
const items = [];
|
|
38274
38274
|
const parts = [];
|
|
38275
|
-
|
|
38275
|
+
let reasoningContent = "";
|
|
38276
|
+
const takeReasoningContent = () => {
|
|
38277
|
+
if (role !== "assistant" || reasoningContent.length === 0) return {};
|
|
38278
|
+
const reasoning = reasoningContent;
|
|
38279
|
+
reasoningContent = "";
|
|
38280
|
+
return { reasoning_content: reasoning };
|
|
38281
|
+
};
|
|
38282
|
+
const flushParts = (includeReasoning = true) => {
|
|
38276
38283
|
if (parts.length === 0) {
|
|
38277
38284
|
return;
|
|
38278
38285
|
}
|
|
38279
38286
|
items.push({
|
|
38280
38287
|
type: "message",
|
|
38281
38288
|
role,
|
|
38282
|
-
content: normalizeCanonicalMessageContent(parts.splice(0, parts.length))
|
|
38289
|
+
content: normalizeCanonicalMessageContent(parts.splice(0, parts.length)),
|
|
38290
|
+
...includeReasoning ? takeReasoningContent() : {}
|
|
38283
38291
|
});
|
|
38284
38292
|
};
|
|
38285
38293
|
for (const block of message.content) {
|
|
@@ -38293,12 +38301,13 @@ function translateMessage(message) {
|
|
|
38293
38301
|
parts.push(translateImageBlock(block));
|
|
38294
38302
|
break;
|
|
38295
38303
|
case "tool_use":
|
|
38296
|
-
flushParts();
|
|
38304
|
+
flushParts(false);
|
|
38297
38305
|
items.push({
|
|
38298
38306
|
type: "function_call",
|
|
38299
38307
|
call_id: block.id,
|
|
38300
38308
|
name: block.name,
|
|
38301
|
-
arguments: JSON.stringify(block.input)
|
|
38309
|
+
arguments: JSON.stringify(block.input),
|
|
38310
|
+
...takeReasoningContent()
|
|
38302
38311
|
});
|
|
38303
38312
|
break;
|
|
38304
38313
|
case "tool_result": {
|
|
@@ -38314,6 +38323,10 @@ function translateMessage(message) {
|
|
|
38314
38323
|
break;
|
|
38315
38324
|
}
|
|
38316
38325
|
case "thinking":
|
|
38326
|
+
if (role === "assistant" && typeof block.thinking === "string") {
|
|
38327
|
+
reasoningContent += block.thinking;
|
|
38328
|
+
}
|
|
38329
|
+
break;
|
|
38317
38330
|
case "redacted_thinking":
|
|
38318
38331
|
break;
|
|
38319
38332
|
default:
|
|
@@ -41642,6 +41655,12 @@ ${argumentsText}`;
|
|
|
41642
41655
|
}
|
|
41643
41656
|
if (isRecord42(update.thinkingDelta) && typeof update.thinkingDelta.text === "string") {
|
|
41644
41657
|
activeSegment.outputText += update.thinkingDelta.text;
|
|
41658
|
+
emit({
|
|
41659
|
+
type: "response.reasoning_summary_text.delta",
|
|
41660
|
+
item_id: `${activeSegment.itemId}_reasoning`,
|
|
41661
|
+
output_index: 0,
|
|
41662
|
+
delta: update.thinkingDelta.text
|
|
41663
|
+
});
|
|
41645
41664
|
return;
|
|
41646
41665
|
}
|
|
41647
41666
|
if (isRecord42(update.tokenDelta)) {
|
|
@@ -42508,12 +42527,15 @@ function forOpenAIResponsesBackend(request, dropSamplingParams) {
|
|
|
42508
42527
|
} = source;
|
|
42509
42528
|
const payload = { ...rest };
|
|
42510
42529
|
payload.input = request.input.map((item) => {
|
|
42511
|
-
if (item.type
|
|
42512
|
-
|
|
42513
|
-
|
|
42514
|
-
|
|
42515
|
-
|
|
42516
|
-
|
|
42530
|
+
if (item.type === "function_call_output") {
|
|
42531
|
+
const {
|
|
42532
|
+
is_error: _isError,
|
|
42533
|
+
tool_references: _toolReferences,
|
|
42534
|
+
...wireItem2
|
|
42535
|
+
} = item;
|
|
42536
|
+
return wireItem2;
|
|
42537
|
+
}
|
|
42538
|
+
const { reasoning_content: _reasoningContent, ...wireItem } = item;
|
|
42517
42539
|
return wireItem;
|
|
42518
42540
|
});
|
|
42519
42541
|
const wireTools = (canonicalTools ?? []).map((tool) => {
|
|
@@ -43270,18 +43292,22 @@ function forChatCompletionsBackend(request) {
|
|
|
43270
43292
|
if (request.instructions !== void 0 && request.instructions.length > 0) {
|
|
43271
43293
|
messages.push({ role: "system", content: request.instructions });
|
|
43272
43294
|
}
|
|
43295
|
+
const replayReasoning = request.model.startsWith("deepseek-v4-");
|
|
43273
43296
|
let pendingToolCalls = [];
|
|
43274
43297
|
let pendingAssistantText;
|
|
43298
|
+
let pendingAssistantReasoning;
|
|
43275
43299
|
let deferredMessages = [];
|
|
43276
43300
|
const flushToolCalls = () => {
|
|
43277
43301
|
if (pendingToolCalls.length === 0) return;
|
|
43278
43302
|
messages.push({
|
|
43279
43303
|
role: "assistant",
|
|
43280
43304
|
content: pendingAssistantText ?? null,
|
|
43281
|
-
tool_calls: pendingToolCalls
|
|
43305
|
+
tool_calls: pendingToolCalls,
|
|
43306
|
+
...replayReasoning && pendingAssistantReasoning ? { reasoning_content: pendingAssistantReasoning } : {}
|
|
43282
43307
|
});
|
|
43283
43308
|
pendingToolCalls = [];
|
|
43284
43309
|
pendingAssistantText = void 0;
|
|
43310
|
+
pendingAssistantReasoning = void 0;
|
|
43285
43311
|
};
|
|
43286
43312
|
const flushDeferredMessages = () => {
|
|
43287
43313
|
if (deferredMessages.length === 0) return;
|
|
@@ -43296,6 +43322,9 @@ function forChatCompletionsBackend(request) {
|
|
|
43296
43322
|
type: "function",
|
|
43297
43323
|
function: { name: item.name, arguments: item.arguments }
|
|
43298
43324
|
});
|
|
43325
|
+
if (replayReasoning && item.reasoning_content) {
|
|
43326
|
+
pendingAssistantReasoning ??= item.reasoning_content;
|
|
43327
|
+
}
|
|
43299
43328
|
continue;
|
|
43300
43329
|
}
|
|
43301
43330
|
if (item.type === "function_call_output") {
|
|
@@ -43312,12 +43341,12 @@ function forChatCompletionsBackend(request) {
|
|
|
43312
43341
|
${text2}`;
|
|
43313
43342
|
}
|
|
43314
43343
|
} else {
|
|
43315
|
-
deferredMessages.push(chatWireMessage(item));
|
|
43344
|
+
deferredMessages.push(chatWireMessage(item, replayReasoning));
|
|
43316
43345
|
}
|
|
43317
43346
|
continue;
|
|
43318
43347
|
}
|
|
43319
43348
|
flushDeferredMessages();
|
|
43320
|
-
messages.push(chatWireMessage(item));
|
|
43349
|
+
messages.push(chatWireMessage(item, replayReasoning));
|
|
43321
43350
|
}
|
|
43322
43351
|
flushToolCalls();
|
|
43323
43352
|
flushDeferredMessages();
|
|
@@ -43350,12 +43379,19 @@ ${text2}`;
|
|
|
43350
43379
|
}
|
|
43351
43380
|
return payload;
|
|
43352
43381
|
}
|
|
43353
|
-
function chatWireMessage(item) {
|
|
43382
|
+
function chatWireMessage(item, replayReasoning) {
|
|
43354
43383
|
const role = item.role === "developer" ? "system" : item.role;
|
|
43384
|
+
if (role === "assistant") {
|
|
43385
|
+
return {
|
|
43386
|
+
role,
|
|
43387
|
+
content: canonicalMessageText(item.content),
|
|
43388
|
+
...replayReasoning && item.reasoning_content ? { reasoning_content: item.reasoning_content } : {}
|
|
43389
|
+
};
|
|
43390
|
+
}
|
|
43355
43391
|
if (typeof item.content === "string") {
|
|
43356
43392
|
return { role, content: item.content };
|
|
43357
43393
|
}
|
|
43358
|
-
if (role
|
|
43394
|
+
if (role === "system") {
|
|
43359
43395
|
return { role, content: canonicalMessageText(item.content) };
|
|
43360
43396
|
}
|
|
43361
43397
|
const parts = item.content.map((part) => {
|
|
@@ -43425,6 +43461,14 @@ async function* translateChatCompletionsStream(body, options) {
|
|
|
43425
43461
|
for (const choice of choices) {
|
|
43426
43462
|
if (!isRecord7(choice)) continue;
|
|
43427
43463
|
const delta = isRecord7(choice.delta) ? choice.delta : {};
|
|
43464
|
+
if (typeof delta.reasoning_content === "string" && delta.reasoning_content.length > 0) {
|
|
43465
|
+
yield {
|
|
43466
|
+
type: "response.reasoning_summary_text.delta",
|
|
43467
|
+
item_id: `${MESSAGE_ITEM_ID}_reasoning`,
|
|
43468
|
+
output_index: 0,
|
|
43469
|
+
delta: delta.reasoning_content
|
|
43470
|
+
};
|
|
43471
|
+
}
|
|
43428
43472
|
if (typeof delta.content === "string" && delta.content.length > 0) {
|
|
43429
43473
|
textSeen = true;
|
|
43430
43474
|
accumulatedText += delta.content;
|
package/package.json
CHANGED