@dotobokuri/fleet-console 1.49.0 → 1.50.0

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
- const flushParts = () => {
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)) {
@@ -43270,18 +43289,22 @@ function forChatCompletionsBackend(request) {
43270
43289
  if (request.instructions !== void 0 && request.instructions.length > 0) {
43271
43290
  messages.push({ role: "system", content: request.instructions });
43272
43291
  }
43292
+ const replayReasoning = request.model.startsWith("deepseek-v4-");
43273
43293
  let pendingToolCalls = [];
43274
43294
  let pendingAssistantText;
43295
+ let pendingAssistantReasoning;
43275
43296
  let deferredMessages = [];
43276
43297
  const flushToolCalls = () => {
43277
43298
  if (pendingToolCalls.length === 0) return;
43278
43299
  messages.push({
43279
43300
  role: "assistant",
43280
43301
  content: pendingAssistantText ?? null,
43281
- tool_calls: pendingToolCalls
43302
+ tool_calls: pendingToolCalls,
43303
+ ...replayReasoning && pendingAssistantReasoning ? { reasoning_content: pendingAssistantReasoning } : {}
43282
43304
  });
43283
43305
  pendingToolCalls = [];
43284
43306
  pendingAssistantText = void 0;
43307
+ pendingAssistantReasoning = void 0;
43285
43308
  };
43286
43309
  const flushDeferredMessages = () => {
43287
43310
  if (deferredMessages.length === 0) return;
@@ -43296,6 +43319,9 @@ function forChatCompletionsBackend(request) {
43296
43319
  type: "function",
43297
43320
  function: { name: item.name, arguments: item.arguments }
43298
43321
  });
43322
+ if (replayReasoning && item.reasoning_content) {
43323
+ pendingAssistantReasoning ??= item.reasoning_content;
43324
+ }
43299
43325
  continue;
43300
43326
  }
43301
43327
  if (item.type === "function_call_output") {
@@ -43312,12 +43338,12 @@ function forChatCompletionsBackend(request) {
43312
43338
  ${text2}`;
43313
43339
  }
43314
43340
  } else {
43315
- deferredMessages.push(chatWireMessage(item));
43341
+ deferredMessages.push(chatWireMessage(item, replayReasoning));
43316
43342
  }
43317
43343
  continue;
43318
43344
  }
43319
43345
  flushDeferredMessages();
43320
- messages.push(chatWireMessage(item));
43346
+ messages.push(chatWireMessage(item, replayReasoning));
43321
43347
  }
43322
43348
  flushToolCalls();
43323
43349
  flushDeferredMessages();
@@ -43350,12 +43376,19 @@ ${text2}`;
43350
43376
  }
43351
43377
  return payload;
43352
43378
  }
43353
- function chatWireMessage(item) {
43379
+ function chatWireMessage(item, replayReasoning) {
43354
43380
  const role = item.role === "developer" ? "system" : item.role;
43381
+ if (role === "assistant") {
43382
+ return {
43383
+ role,
43384
+ content: canonicalMessageText(item.content),
43385
+ ...replayReasoning && item.reasoning_content ? { reasoning_content: item.reasoning_content } : {}
43386
+ };
43387
+ }
43355
43388
  if (typeof item.content === "string") {
43356
43389
  return { role, content: item.content };
43357
43390
  }
43358
- if (role !== "user") {
43391
+ if (role === "system") {
43359
43392
  return { role, content: canonicalMessageText(item.content) };
43360
43393
  }
43361
43394
  const parts = item.content.map((part) => {
@@ -43425,6 +43458,14 @@ async function* translateChatCompletionsStream(body, options) {
43425
43458
  for (const choice of choices) {
43426
43459
  if (!isRecord7(choice)) continue;
43427
43460
  const delta = isRecord7(choice.delta) ? choice.delta : {};
43461
+ if (typeof delta.reasoning_content === "string" && delta.reasoning_content.length > 0) {
43462
+ yield {
43463
+ type: "response.reasoning_summary_text.delta",
43464
+ item_id: `${MESSAGE_ITEM_ID}_reasoning`,
43465
+ output_index: 0,
43466
+ delta: delta.reasoning_content
43467
+ };
43468
+ }
43428
43469
  if (typeof delta.content === "string" && delta.content.length > 0) {
43429
43470
  textSeen = true;
43430
43471
  accumulatedText += delta.content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotobokuri/fleet-console",
3
- "version": "1.49.0",
3
+ "version": "1.50.0",
4
4
  "description": "Fleet Console - standalone web surface for observing Fleet CLI workspaces, carrier jobs, live output streams, and terminals.",
5
5
  "repository": {
6
6
  "type": "git",