@zhongqian97-code/ecode 0.5.67 → 0.5.69

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.
@@ -718,11 +718,11 @@ function loadMessagesFromJsonl(logFilePath) {
718
718
  } else if (entry.role === "assistant") {
719
719
  const msg = {
720
720
  role: "assistant",
721
- content: entry.content ?? null
721
+ content: entry.content ?? null,
722
+ reasoning_content: entry.reasoning_content ?? ""
722
723
  };
723
- if (entry.tool_calls) {
724
- msg.tool_calls = entry.tool_calls;
725
- }
724
+ if (entry.tool_calls) msg.tool_calls = entry.tool_calls;
725
+ if (entry.reasoning_details) msg.reasoning_details = entry.reasoning_details;
726
726
  messages.push(msg);
727
727
  } else if (entry.role === "tool") {
728
728
  messages.push({
@@ -3,7 +3,7 @@ const _ew=process.emitWarning.bind(process);process.emitWarning=function(w,...a)
3
3
  import {
4
4
  findSession,
5
5
  listSessions
6
- } from "./chunk-LODP7T4D.js";
6
+ } from "./chunk-IC2CWYVU.js";
7
7
 
8
8
  // src/sessions/command.ts
9
9
  import * as path from "path";
@@ -4,7 +4,7 @@ import {
4
4
  createSessionMetadata,
5
5
  updateSessionMetadata,
6
6
  writeSessionMetadata
7
- } from "./chunk-LODP7T4D.js";
7
+ } from "./chunk-IC2CWYVU.js";
8
8
 
9
9
  // src/skills/loader.ts
10
10
  import { readFile, readdir, stat } from "fs/promises";
@@ -1202,29 +1202,23 @@ async function runSubagentRuntime(options) {
1202
1202
  while (turnCount < maxTurns) {
1203
1203
  turnCount++;
1204
1204
  let assistantText = "";
1205
+ let assistantReasoning;
1205
1206
  const toolCalls = [];
1206
1207
  for await (const chunk of provider.stream(messages, tools)) {
1207
1208
  if (chunk.text) {
1208
1209
  assistantText += chunk.text;
1209
1210
  onOutput == null ? void 0 : onOutput(chunk.text);
1210
1211
  }
1211
- if (chunk.done && chunk.toolCalls) {
1212
- toolCalls.push(...chunk.toolCalls);
1212
+ if (chunk.done) {
1213
+ if (chunk.toolCalls) toolCalls.push(...chunk.toolCalls);
1214
+ if (chunk.reasoning) assistantReasoning = chunk.reasoning;
1213
1215
  }
1214
1216
  }
1215
1217
  if (toolCalls.length === 0) {
1216
- messages.push({ role: "assistant", content: assistantText });
1218
+ messages.push(buildAssistantMessage(assistantText, [], assistantReasoning));
1217
1219
  return { success: true, finalText: assistantText, turnCount };
1218
1220
  }
1219
- messages.push({
1220
- role: "assistant",
1221
- content: assistantText || null,
1222
- tool_calls: toolCalls.map((tc) => ({
1223
- id: tc.id,
1224
- type: "function",
1225
- function: { name: tc.name, arguments: tc.arguments }
1226
- }))
1227
- });
1221
+ messages.push(buildAssistantMessage(assistantText, toolCalls, assistantReasoning));
1228
1222
  for (const tc of toolCalls) {
1229
1223
  const result = await executeToolCall(tc);
1230
1224
  messages.push({ role: "tool", tool_call_id: tc.id, content: result });
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  cmdSessionsInspect,
6
6
  cmdSessionsList,
7
7
  cmdSessionsReplay
8
- } from "./chunk-ZNCND354.js";
8
+ } from "./chunk-JDAOARQA.js";
9
9
  import {
10
10
  APPLY_PATCH_TOOL,
11
11
  BASH_TOOL,
@@ -34,7 +34,7 @@ import {
34
34
  todo,
35
35
  webFetch,
36
36
  writeFile
37
- } from "./chunk-WHVNMO5M.js";
37
+ } from "./chunk-VSJXCYVY.js";
38
38
  import {
39
39
  createProvider,
40
40
  createSessionMetadata,
@@ -43,7 +43,7 @@ import {
43
43
  resolveActiveProfile,
44
44
  updateSessionMetadata,
45
45
  writeSessionMetadata
46
- } from "./chunk-LODP7T4D.js";
46
+ } from "./chunk-IC2CWYVU.js";
47
47
 
48
48
  // src/index.ts
49
49
  import { createRequire } from "module";
@@ -461,6 +461,8 @@ var SessionRuntime = class {
461
461
  ts: (/* @__PURE__ */ new Date()).toISOString(),
462
462
  role: "assistant",
463
463
  content: assistantText || null,
464
+ reasoning_content: assistantReasoning ?? "",
465
+ ...lastReasoningDetails ? { reasoning_details: lastReasoningDetails } : {},
464
466
  tool_calls: toolCalls.map((tc) => ({ id: tc.id, type: "function", function: { name: tc.name, arguments: tc.arguments } }))
465
467
  });
466
468
  for (const tc of toolCalls) {
@@ -478,7 +480,7 @@ var SessionRuntime = class {
478
480
  } else {
479
481
  if (assistantText) {
480
482
  this.messages.push(buildAssistantMessage(assistantText, [], assistantReasoning));
481
- (_c = this.logger) == null ? void 0 : _c.append({ ts: (/* @__PURE__ */ new Date()).toISOString(), role: "assistant", content: assistantText || null });
483
+ (_c = this.logger) == null ? void 0 : _c.append({ ts: (/* @__PURE__ */ new Date()).toISOString(), role: "assistant", content: assistantText || null, reasoning_content: assistantReasoning ?? "" });
482
484
  }
483
485
  break;
484
486
  }
@@ -810,7 +812,7 @@ if (rawArgs[0] === "web") {
810
812
  webAutoApprove = true;
811
813
  }
812
814
  }
813
- const { buildServer, generateAccessToken } = await import("./web-24EDYYNA.js");
815
+ const { buildServer, generateAccessToken } = await import("./web-ZYG3OQO7.js");
814
816
  const token = finalConfig.webToken ?? generateAccessToken();
815
817
  const manager = new SessionManager(finalConfig);
816
818
  const __webDirname = dirname(fileURLToPath(import.meta.url));
@@ -907,7 +909,7 @@ Node.js 16/18 \u8BF7\u4F7F\u7528 --web \u6216 --pipe \u6A21\u5F0F\u3002
907
909
  );
908
910
  process.exit(1);
909
911
  }
910
- const { App, React, render, createStdinFilter } = await import("./ui-GQ6DSF7S.js");
912
+ const { App, React, render, createStdinFilter } = await import("./ui-62ULGO6H.js");
911
913
  const stdinFilter = process.stdin.isTTY ? createStdinFilter(process.stdin) : process.stdin;
912
914
  render(
913
915
  React.createElement(App, { config: finalConfig, version: VERSION, autoMode, registry, trustedSkillDirs, initialMessages, stdinFilter }),
@@ -25,7 +25,7 @@ import {
25
25
  todo,
26
26
  webFetch,
27
27
  writeFile
28
- } from "./chunk-WHVNMO5M.js";
28
+ } from "./chunk-VSJXCYVY.js";
29
29
  import {
30
30
  handleSkillInput,
31
31
  loadJobs,
@@ -40,7 +40,7 @@ import {
40
40
  resolveActiveProfile,
41
41
  updateSessionMetadata,
42
42
  writeSessionMetadata
43
- } from "./chunk-LODP7T4D.js";
43
+ } from "./chunk-IC2CWYVU.js";
44
44
 
45
45
  // src/ui/index.ts
46
46
  import { default as default2 } from "react";
@@ -984,7 +984,6 @@ ${contextSection}` : contextSection;
984
984
  }
985
985
 
986
986
  // src/ui/mouseCoords.ts
987
- var STATUS_BAR_ROWS = 1;
988
987
  function computeVisibleWindow(totalLines, scrollOffset, historyMaxHeight) {
989
988
  const end = Math.max(0, Math.min(totalLines, totalLines - scrollOffset));
990
989
  const initialStart = Math.max(0, end - historyMaxHeight);
@@ -995,14 +994,11 @@ function computeVisibleWindow(totalLines, scrollOffset, historyMaxHeight) {
995
994
  }
996
995
  function mouseRowToLineIndex(opts) {
997
996
  if (opts.visibleCount <= 0) return null;
998
- const bottomRows = opts.bottomChromeRows ?? STATUS_BAR_ROWS + (opts.skillAcRows ?? 0) + (opts.fileAcRows ?? 0) + (opts.selectedItemsRows ?? 0) + (opts.inputRows ?? 1);
999
- const innerBoxHeight = opts.terminalRows - bottomRows;
1000
- const chTopRow = innerBoxHeight - opts.visibleCount;
1001
- const chBottomRow = innerBoxHeight - 1;
1002
- if (opts.mouseRow < chTopRow || opts.mouseRow > chBottomRow) return null;
997
+ const chBottomRow = opts.chTopRow + opts.visibleCount - 1;
998
+ if (opts.mouseRow < opts.chTopRow || opts.mouseRow > chBottomRow) return null;
1003
999
  const indicatorOffset = opts.hasScrollIndicator ? 1 : 0;
1004
- if (opts.mouseRow < chTopRow + indicatorOffset) return null;
1005
- return opts.mouseRow - chTopRow - indicatorOffset;
1000
+ if (opts.mouseRow < opts.chTopRow + indicatorOffset) return null;
1001
+ return opts.mouseRow - opts.chTopRow - indicatorOffset;
1006
1002
  }
1007
1003
 
1008
1004
  // src/ui/App.tsx
@@ -2510,6 +2506,17 @@ function handleMetaAlignCommand(input) {
2510
2506
  return `**[meta-align \u9519\u8BEF]** ${String(err)}`;
2511
2507
  }
2512
2508
  }
2509
+ function absoluteTop(node) {
2510
+ var _a;
2511
+ if (!(node == null ? void 0 : node.yogaNode)) return null;
2512
+ let top = 0;
2513
+ let cur = node;
2514
+ while (cur) {
2515
+ top += ((_a = cur.yogaNode) == null ? void 0 : _a.getComputedTop()) ?? 0;
2516
+ cur = cur.parentNode ?? null;
2517
+ }
2518
+ return top;
2519
+ }
2513
2520
  function formatMetaAlignOutput(result, model) {
2514
2521
  const { resolvedTaskType, modelProfileSummary, executionPolicy, materializedArtifacts } = result;
2515
2522
  const lines = [
@@ -2592,10 +2599,9 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
2592
2599
  historyMaxHeightRef.current = historyMaxHeight;
2593
2600
  const selectionStateRef = useRef2(selectionState);
2594
2601
  selectionStateRef.current = selectionState;
2595
- const bottomChromeRef = useRef2(null);
2602
+ const chBoxRef = useRef2(null);
2603
+ const inputBoxRef = useRef2(null);
2596
2604
  const inputRowsRef = useRef2(1);
2597
- const terminalRowsRef = useRef2((stdout == null ? void 0 : stdout.rows) ?? 24);
2598
- terminalRowsRef.current = (stdout == null ? void 0 : stdout.rows) ?? 24;
2599
2605
  const pendingConfirmRef = useRef2(null);
2600
2606
  const abortControllerRef = useRef2(null);
2601
2607
  const llmRef = useRef2(llmClient ?? createProvider(resolveActiveProfile(config)));
@@ -2647,6 +2653,10 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
2647
2653
  tool_call_id: "tool_call_id" in msg ? msg.tool_call_id : void 0,
2648
2654
  // tool_calls 只在 assistant 角色消息中存在(当 LLM 决定调用工具时)
2649
2655
  tool_calls: "tool_calls" in msg ? msg.tool_calls : void 0,
2656
+ // reasoning_content/reasoning_details 必须随 assistant 消息持久化,
2657
+ // 否则恢复会话时缺失 → DeepSeek thinking 模式 400。
2658
+ reasoning_content: "reasoning_content" in msg ? msg.reasoning_content : void 0,
2659
+ reasoning_details: "reasoning_details" in msg ? msg.reasoning_details : void 0,
2650
2660
  selection: sel
2651
2661
  });
2652
2662
  }
@@ -2689,11 +2699,10 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
2689
2699
  }
2690
2700
  return;
2691
2701
  }
2692
- const tRows = terminalRowsRef.current;
2693
- const inRows = inputRowsRef.current;
2694
- const inputStartRow = tRows - inRows;
2695
- if (e.row >= inputStartRow && e.row <= tRows - 1) {
2696
- const localRow = e.row - inputStartRow;
2702
+ const inputTop = absoluteTop(inputBoxRef.current);
2703
+ const inputHeight = inputBoxRef.current ? measureElement(inputBoxRef.current).height : inputRowsRef.current;
2704
+ if (inputTop !== null && e.row >= inputTop && e.row <= inputTop + inputHeight - 1) {
2705
+ const localRow = e.row - inputTop;
2697
2706
  if (e.type === "leftDown") {
2698
2707
  (_a = inputRef.current) == null ? void 0 : _a.setCursorByClick(localRow, e.col);
2699
2708
  (_b = inputRef.current) == null ? void 0 : _b.startInputSelection(localRow, e.col);
@@ -2715,16 +2724,11 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
2715
2724
  scrollOffsetRef.current,
2716
2725
  historyMaxHeightRef.current
2717
2726
  );
2718
- let bottomRows;
2719
- if (bottomChromeRef.current) {
2720
- const m = measureElement(bottomChromeRef.current);
2721
- if (m && m.height > 0) bottomRows = m.height;
2722
- }
2727
+ const chTopRow = absoluteTop(chBoxRef.current);
2728
+ if (chTopRow === null) return;
2723
2729
  const lineIdx = mouseRowToLineIndex({
2724
2730
  mouseRow: e.row,
2725
- terminalRows: tRows,
2726
- bottomChromeRows: bottomRows,
2727
- inputRows: inRows,
2731
+ chTopRow,
2728
2732
  visibleCount: window.visibleCount,
2729
2733
  hasScrollIndicator: window.hasScrollIndicator
2730
2734
  });
@@ -3213,7 +3217,7 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
3213
3217
  const acOpen = isOpen(acState, skillSuggestions);
3214
3218
  const facOpen = isOpen2(fileAcState, fileSuggestions);
3215
3219
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: "100%", children: [
3216
- /* @__PURE__ */ jsx6(Box6, { flexGrow: 1, flexDirection: "column", justifyContent: "flex-end", children: /* @__PURE__ */ jsx6(
3220
+ /* @__PURE__ */ jsx6(Box6, { flexGrow: 1, flexDirection: "column", justifyContent: "flex-end", children: /* @__PURE__ */ jsx6(Box6, { flexDirection: "column", ref: chBoxRef, children: /* @__PURE__ */ jsx6(
3217
3221
  ConversationHistory,
3218
3222
  {
3219
3223
  messages,
@@ -3223,8 +3227,8 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
3223
3227
  scrollOffset,
3224
3228
  selection: selectionState
3225
3229
  }
3226
- ) }),
3227
- /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", ref: bottomChromeRef, children: [
3230
+ ) }) }),
3231
+ /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
3228
3232
  /* @__PURE__ */ jsx6(
3229
3233
  StatusBar,
3230
3234
  {
@@ -3255,7 +3259,7 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
3255
3259
  "Selected: ",
3256
3260
  selectedItems.map((i) => i.label).join(", ")
3257
3261
  ] }) }),
3258
- /* @__PURE__ */ jsx6(
3262
+ /* @__PURE__ */ jsx6(Box6, { flexDirection: "column", ref: inputBoxRef, children: /* @__PURE__ */ jsx6(
3259
3263
  Input_default,
3260
3264
  {
3261
3265
  ref: inputRef,
@@ -3264,7 +3268,7 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
3264
3268
  onChange: handleInputTextChange,
3265
3269
  placeholder: status === "awaiting_confirm" ? "y / n" : void 0
3266
3270
  }
3267
- )
3271
+ ) })
3268
3272
  ] })
3269
3273
  ] });
3270
3274
  }
@@ -3,7 +3,7 @@ const _ew=process.emitWarning.bind(process);process.emitWarning=function(w,...a)
3
3
  import {
4
4
  cmdSessionsFork,
5
5
  cmdSessionsReplay
6
- } from "./chunk-ZNCND354.js";
6
+ } from "./chunk-JDAOARQA.js";
7
7
  import {
8
8
  handleSkillInput,
9
9
  loadJobs,
@@ -17,7 +17,7 @@ import {
17
17
  loadMessagesFromJsonl,
18
18
  resolveActiveProfile,
19
19
  saveConfig
20
- } from "./chunk-LODP7T4D.js";
20
+ } from "./chunk-IC2CWYVU.js";
21
21
 
22
22
  // src/web/server.ts
23
23
  import Fastify from "fastify";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.5.67",
3
+ "version": "0.5.69",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",