@zhongqian97-code/ecode 0.5.56 → 0.5.57
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/index.js
CHANGED
|
@@ -814,7 +814,7 @@ if (rawArgs[0] === "web") {
|
|
|
814
814
|
webAutoApprove = true;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
const { buildServer, generateAccessToken } = await import("./web-
|
|
817
|
+
const { buildServer, generateAccessToken } = await import("./web-3CS3TO2E.js");
|
|
818
818
|
const token = finalConfig.webToken ?? generateAccessToken();
|
|
819
819
|
const manager = new SessionManager(finalConfig);
|
|
820
820
|
const __webDirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -923,7 +923,7 @@ Node.js 16/18 \u8BF7\u4F7F\u7528 --web \u6216 --pipe \u6A21\u5F0F\u3002
|
|
|
923
923
|
);
|
|
924
924
|
process.exit(1);
|
|
925
925
|
}
|
|
926
|
-
const { App, React, render, createStdinFilter } = await import("./ui-
|
|
926
|
+
const { App, React, render, createStdinFilter } = await import("./ui-RG76L7OR.js");
|
|
927
927
|
const stdinFilter = process.stdin.isTTY ? createStdinFilter(process.stdin) : process.stdin;
|
|
928
928
|
render(
|
|
929
929
|
React.createElement(App, { config: finalConfig, version: VERSION, autoMode, registry, trustedSkillDirs, initialMessages, stdinFilter }),
|
|
@@ -853,6 +853,28 @@ ${blocks.join("\n\n")}`;
|
|
|
853
853
|
${contextSection}` : contextSection;
|
|
854
854
|
}
|
|
855
855
|
|
|
856
|
+
// src/ui/mouseCoords.ts
|
|
857
|
+
var STATUS_BAR_ROWS = 1;
|
|
858
|
+
function computeVisibleWindow(totalLines, scrollOffset, historyMaxHeight) {
|
|
859
|
+
const end = Math.max(0, Math.min(totalLines, totalLines - scrollOffset));
|
|
860
|
+
const initialStart = Math.max(0, end - historyMaxHeight);
|
|
861
|
+
const hasScrollIndicator = initialStart > 0 && historyMaxHeight > 1;
|
|
862
|
+
const start = hasScrollIndicator ? Math.max(0, end - (historyMaxHeight - 1)) : initialStart;
|
|
863
|
+
const visibleCount = (hasScrollIndicator ? 1 : 0) + (end - start);
|
|
864
|
+
return { start, end, visibleCount, hasScrollIndicator };
|
|
865
|
+
}
|
|
866
|
+
function mouseRowToLineIndex(opts) {
|
|
867
|
+
if (opts.visibleCount <= 0) return null;
|
|
868
|
+
const bottomRows = STATUS_BAR_ROWS + opts.skillAcRows + opts.fileAcRows + opts.selectedItemsRows + opts.inputRows;
|
|
869
|
+
const innerBoxHeight = opts.terminalRows - bottomRows;
|
|
870
|
+
const chTopRow = innerBoxHeight - opts.visibleCount;
|
|
871
|
+
const chBottomRow = innerBoxHeight - 1;
|
|
872
|
+
if (opts.mouseRow < chTopRow || opts.mouseRow > chBottomRow) return null;
|
|
873
|
+
const indicatorOffset = opts.hasScrollIndicator ? 1 : 0;
|
|
874
|
+
if (opts.mouseRow < chTopRow + indicatorOffset) return null;
|
|
875
|
+
return opts.mouseRow - chTopRow - indicatorOffset;
|
|
876
|
+
}
|
|
877
|
+
|
|
856
878
|
// src/ui/App.tsx
|
|
857
879
|
import { homedir as homedir2 } from "os";
|
|
858
880
|
import { join as join5 } from "path";
|
|
@@ -2439,6 +2461,12 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
|
|
|
2439
2461
|
historyMaxHeightRef.current = historyMaxHeight;
|
|
2440
2462
|
const selectionStateRef = useRef2(selectionState);
|
|
2441
2463
|
selectionStateRef.current = selectionState;
|
|
2464
|
+
const inputRowsRef = useRef2(1);
|
|
2465
|
+
const skillAcRowsRef = useRef2(0);
|
|
2466
|
+
const fileAcRowsRef = useRef2(0);
|
|
2467
|
+
const selectedItemsRowsRef = useRef2(0);
|
|
2468
|
+
const terminalRowsRef = useRef2((stdout == null ? void 0 : stdout.rows) ?? 24);
|
|
2469
|
+
terminalRowsRef.current = (stdout == null ? void 0 : stdout.rows) ?? 24;
|
|
2442
2470
|
const pendingConfirmRef = useRef2(null);
|
|
2443
2471
|
const abortControllerRef = useRef2(null);
|
|
2444
2472
|
const llmRef = useRef2(llmClient ?? createProvider(resolveActiveProfile(config)));
|
|
@@ -2520,13 +2548,22 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
|
|
|
2520
2548
|
}
|
|
2521
2549
|
return;
|
|
2522
2550
|
}
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
const lineIdx =
|
|
2529
|
-
|
|
2551
|
+
const window = computeVisibleWindow(
|
|
2552
|
+
totalLinesRef.current,
|
|
2553
|
+
scrollOffsetRef.current,
|
|
2554
|
+
historyMaxHeightRef.current
|
|
2555
|
+
);
|
|
2556
|
+
const lineIdx = mouseRowToLineIndex({
|
|
2557
|
+
mouseRow: e.row,
|
|
2558
|
+
terminalRows: terminalRowsRef.current,
|
|
2559
|
+
inputRows: inputRowsRef.current,
|
|
2560
|
+
skillAcRows: skillAcRowsRef.current,
|
|
2561
|
+
fileAcRows: fileAcRowsRef.current,
|
|
2562
|
+
selectedItemsRows: selectedItemsRowsRef.current,
|
|
2563
|
+
visibleCount: window.visibleCount,
|
|
2564
|
+
hasScrollIndicator: window.hasScrollIndicator
|
|
2565
|
+
});
|
|
2566
|
+
if (lineIdx === null) return;
|
|
2530
2567
|
const pt = { row: lineIdx, col: e.col };
|
|
2531
2568
|
if (e.type === "leftDown") setSelectionState(startSelection(selectionStateRef.current, pt));
|
|
2532
2569
|
else if (e.type === "leftDrag") setSelectionState(updateSelection(selectionStateRef.current, pt));
|
|
@@ -2541,11 +2578,8 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
|
|
|
2541
2578
|
if (selectionState.dragging || !selectionState.anchor || !selectionState.focus) return;
|
|
2542
2579
|
const visible = messages.filter((m) => m.role !== "system");
|
|
2543
2580
|
const allLines = visible.flatMap((msg) => messageToLines(msg, expandTools, (stdout == null ? void 0 : stdout.columns) ?? 0));
|
|
2544
|
-
const
|
|
2545
|
-
const
|
|
2546
|
-
const histH = historyMaxHeight;
|
|
2547
|
-
const start = Math.max(0, end - histH);
|
|
2548
|
-
const lineTexts = allLines.slice(start, end).map((l) => l.text);
|
|
2581
|
+
const window = computeVisibleWindow(allLines.length, scrollOffset, historyMaxHeight);
|
|
2582
|
+
const lineTexts = allLines.slice(window.start, window.end).map((l) => l.text);
|
|
2549
2583
|
const text = extractSelectedText(lineTexts, selectionState);
|
|
2550
2584
|
if (text && stdout) {
|
|
2551
2585
|
const b64 = Buffer.from(text, "utf8").toString("base64");
|
|
@@ -2999,6 +3033,7 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
|
|
|
2999
3033
|
} else {
|
|
3000
3034
|
historyIndexRef.current = -1;
|
|
3001
3035
|
}
|
|
3036
|
+
inputRowsRef.current = Math.max(1, text.split("\n").length);
|
|
3002
3037
|
if (status !== "awaiting_confirm") {
|
|
3003
3038
|
setAcState((prev) => handleInputChange(prev, text));
|
|
3004
3039
|
setFileAcState((prev) => handleInputChange2(prev, text));
|
|
@@ -3006,6 +3041,10 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
|
|
|
3006
3041
|
}, [status]);
|
|
3007
3042
|
const skillSuggestions = registry ? computeSuggestions(registry.list(), acState) : [];
|
|
3008
3043
|
const acOpen = isOpen(acState, skillSuggestions);
|
|
3044
|
+
const facOpen = isOpen2(fileAcState, fileSuggestions);
|
|
3045
|
+
skillAcRowsRef.current = acOpen ? skillSuggestions.length + 2 : 0;
|
|
3046
|
+
fileAcRowsRef.current = facOpen ? fileSuggestions.length + 2 : 0;
|
|
3047
|
+
selectedItemsRowsRef.current = selectedItems.length > 0 ? 1 : 0;
|
|
3009
3048
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: "100%", children: [
|
|
3010
3049
|
/* @__PURE__ */ jsx6(Box6, { flexGrow: 1, flexDirection: "column", justifyContent: "flex-end", children: /* @__PURE__ */ jsx6(
|
|
3011
3050
|
ConversationHistory,
|
|
@@ -3041,7 +3080,7 @@ function App({ config, version, autoMode = false, registry, trustedSkillDirs = [
|
|
|
3041
3080
|
{
|
|
3042
3081
|
suggestions: fileSuggestions,
|
|
3043
3082
|
selectedIndex: fileAcState.selectedIndex,
|
|
3044
|
-
isOpen:
|
|
3083
|
+
isOpen: facOpen
|
|
3045
3084
|
}
|
|
3046
3085
|
),
|
|
3047
3086
|
selectedItems.length > 0 && /* @__PURE__ */ jsx6(Box6, { paddingLeft: 1, children: /* @__PURE__ */ jsxs6(Text6, { color: "cyan", dimColor: true, children: [
|
|
@@ -221,6 +221,15 @@ function generateAdminHtml(version) {
|
|
|
221
221
|
font-size: 12px;
|
|
222
222
|
overflow: hidden;
|
|
223
223
|
margin: 4px 0;
|
|
224
|
+
/* #messages \u662F flex column \u5BB9\u5668\uFF0Cflex item \u9ED8\u8BA4 flex-shrink:1\u3002
|
|
225
|
+
* .tool-box \u6709 overflow:hidden \u4F1A\u8BA9 min-height \u9ED8\u8BA4\u5F52 0\uFF08CSS Flexbox \u89C4\u8303\uFF09\uFF0C
|
|
226
|
+
* \u7D2F\u79EF\u591A\u4E2A tool-box \u65F6\u6574\u5217\u88AB\u6324\u538B\uFF0Cbody \u88AB\u88C1\u6389\u5BFC\u81F4"\u6846\u9AD8\u5EA6\u53D8\u6210\u4E00\u6761\u7EBF"\u3002
|
|
227
|
+
* flex-shrink:0 \u5F3A\u5236\u4FDD\u7559\u81EA\u7136\u9AD8\u5EA6\uFF0C\u7531 #messages \u7684 overflow-y:auto \u6EDA\u52A8\u3002 */
|
|
228
|
+
flex-shrink: 0;
|
|
229
|
+
}
|
|
230
|
+
.thinking-block,
|
|
231
|
+
.msg {
|
|
232
|
+
flex-shrink: 0;
|
|
224
233
|
}
|
|
225
234
|
.tool-box-header {
|
|
226
235
|
background: #21262d;
|