snow-ai 0.6.18 → 0.6.19
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/bundle/cli.mjs +266 -70
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -1421,7 +1421,7 @@ var require_react_development = __commonJS({
|
|
|
1421
1421
|
}
|
|
1422
1422
|
return dispatcher.useContext(Context);
|
|
1423
1423
|
}
|
|
1424
|
-
function
|
|
1424
|
+
function useState67(initialState) {
|
|
1425
1425
|
var dispatcher = resolveDispatcher();
|
|
1426
1426
|
return dispatcher.useState(initialState);
|
|
1427
1427
|
}
|
|
@@ -1433,7 +1433,7 @@ var require_react_development = __commonJS({
|
|
|
1433
1433
|
var dispatcher = resolveDispatcher();
|
|
1434
1434
|
return dispatcher.useRef(initialValue);
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1436
|
+
function useEffect59(create3, deps) {
|
|
1437
1437
|
var dispatcher = resolveDispatcher();
|
|
1438
1438
|
return dispatcher.useEffect(create3, deps);
|
|
1439
1439
|
}
|
|
@@ -1449,7 +1449,7 @@ var require_react_development = __commonJS({
|
|
|
1449
1449
|
var dispatcher = resolveDispatcher();
|
|
1450
1450
|
return dispatcher.useCallback(callback, deps);
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1452
|
+
function useMemo35(create3, deps) {
|
|
1453
1453
|
var dispatcher = resolveDispatcher();
|
|
1454
1454
|
return dispatcher.useMemo(create3, deps);
|
|
1455
1455
|
}
|
|
@@ -2216,15 +2216,15 @@ var require_react_development = __commonJS({
|
|
|
2216
2216
|
exports2.useContext = useContext13;
|
|
2217
2217
|
exports2.useDebugValue = useDebugValue;
|
|
2218
2218
|
exports2.useDeferredValue = useDeferredValue;
|
|
2219
|
-
exports2.useEffect =
|
|
2219
|
+
exports2.useEffect = useEffect59;
|
|
2220
2220
|
exports2.useId = useId;
|
|
2221
2221
|
exports2.useImperativeHandle = useImperativeHandle2;
|
|
2222
2222
|
exports2.useInsertionEffect = useInsertionEffect;
|
|
2223
2223
|
exports2.useLayoutEffect = useLayoutEffect2;
|
|
2224
|
-
exports2.useMemo =
|
|
2224
|
+
exports2.useMemo = useMemo35;
|
|
2225
2225
|
exports2.useReducer = useReducer8;
|
|
2226
2226
|
exports2.useRef = useRef16;
|
|
2227
|
-
exports2.useState =
|
|
2227
|
+
exports2.useState = useState67;
|
|
2228
2228
|
exports2.useSyncExternalStore = useSyncExternalStore;
|
|
2229
2229
|
exports2.useTransition = useTransition;
|
|
2230
2230
|
exports2.version = ReactVersion;
|
|
@@ -75686,6 +75686,24 @@ var init_vscodeConnection = __esm({
|
|
|
75686
75686
|
writable: true,
|
|
75687
75687
|
value: process.cwd()
|
|
75688
75688
|
});
|
|
75689
|
+
Object.defineProperty(this, "connectedWorkspaceFolders", {
|
|
75690
|
+
enumerable: true,
|
|
75691
|
+
configurable: true,
|
|
75692
|
+
writable: true,
|
|
75693
|
+
value: /* @__PURE__ */ new Set()
|
|
75694
|
+
});
|
|
75695
|
+
Object.defineProperty(this, "connectedPortHasCwdMatch", {
|
|
75696
|
+
enumerable: true,
|
|
75697
|
+
configurable: true,
|
|
75698
|
+
writable: true,
|
|
75699
|
+
value: false
|
|
75700
|
+
});
|
|
75701
|
+
Object.defineProperty(this, "trustContextFromConnectedServer", {
|
|
75702
|
+
enumerable: true,
|
|
75703
|
+
configurable: true,
|
|
75704
|
+
writable: true,
|
|
75705
|
+
value: false
|
|
75706
|
+
});
|
|
75689
75707
|
Object.defineProperty(this, "connectingPromise", {
|
|
75690
75708
|
enumerable: true,
|
|
75691
75709
|
configurable: true,
|
|
@@ -75744,8 +75762,10 @@ var init_vscodeConnection = __esm({
|
|
|
75744
75762
|
this.client.on("open", () => {
|
|
75745
75763
|
if (!isSettled) {
|
|
75746
75764
|
isSettled = true;
|
|
75765
|
+
this.trustContextFromConnectedServer = false;
|
|
75747
75766
|
this.reconnectAttempts = 0;
|
|
75748
75767
|
this.port = port;
|
|
75768
|
+
this.refreshConnectedWorkspaceFolders();
|
|
75749
75769
|
if (this.connectionTimeout) {
|
|
75750
75770
|
clearTimeout(this.connectionTimeout);
|
|
75751
75771
|
this.connectionTimeout = null;
|
|
@@ -75909,6 +75929,9 @@ var init_vscodeConnection = __esm({
|
|
|
75909
75929
|
if (!data.workspaceFolder) {
|
|
75910
75930
|
return true;
|
|
75911
75931
|
}
|
|
75932
|
+
if (data.type === "context" && this.trustContextFromConnectedServer) {
|
|
75933
|
+
return true;
|
|
75934
|
+
}
|
|
75912
75935
|
const cwd2 = this.normalizePath(this.currentWorkingDirectory);
|
|
75913
75936
|
const workspaceFolder = this.normalizePath(data.workspaceFolder);
|
|
75914
75937
|
if (cwd2 === workspaceFolder) {
|
|
@@ -75916,7 +75939,43 @@ var init_vscodeConnection = __esm({
|
|
|
75916
75939
|
}
|
|
75917
75940
|
const cwdInWorkspace = cwd2.startsWith(workspaceFolder + "/");
|
|
75918
75941
|
const workspaceInCwd = workspaceFolder.startsWith(cwd2 + "/");
|
|
75919
|
-
|
|
75942
|
+
if (cwdInWorkspace || workspaceInCwd) {
|
|
75943
|
+
return true;
|
|
75944
|
+
}
|
|
75945
|
+
if (this.connectedPortHasCwdMatch && this.connectedWorkspaceFolders.size > 0 && this.connectedWorkspaceFolders.has(workspaceFolder)) {
|
|
75946
|
+
return true;
|
|
75947
|
+
}
|
|
75948
|
+
return false;
|
|
75949
|
+
}
|
|
75950
|
+
refreshConnectedWorkspaceFolders() {
|
|
75951
|
+
this.connectedWorkspaceFolders.clear();
|
|
75952
|
+
this.connectedPortHasCwdMatch = false;
|
|
75953
|
+
try {
|
|
75954
|
+
const portInfoPath = path11.join(os7.tmpdir(), "snow-cli-ports.json");
|
|
75955
|
+
if (!fs11.existsSync(portInfoPath)) {
|
|
75956
|
+
return;
|
|
75957
|
+
}
|
|
75958
|
+
const portInfo = JSON.parse(fs11.readFileSync(portInfoPath, "utf8"));
|
|
75959
|
+
for (const [workspace, port] of Object.entries(portInfo)) {
|
|
75960
|
+
if (typeof port !== "number" || port !== this.port) {
|
|
75961
|
+
continue;
|
|
75962
|
+
}
|
|
75963
|
+
const normalizedWorkspace = this.normalizePath(workspace);
|
|
75964
|
+
if (normalizedWorkspace) {
|
|
75965
|
+
this.connectedWorkspaceFolders.add(normalizedWorkspace);
|
|
75966
|
+
}
|
|
75967
|
+
}
|
|
75968
|
+
const cwd2 = this.normalizePath(this.currentWorkingDirectory);
|
|
75969
|
+
for (const ws of this.connectedWorkspaceFolders) {
|
|
75970
|
+
if (cwd2 === ws || cwd2.startsWith(ws + "/") || ws.startsWith(cwd2 + "/")) {
|
|
75971
|
+
this.connectedPortHasCwdMatch = true;
|
|
75972
|
+
break;
|
|
75973
|
+
}
|
|
75974
|
+
}
|
|
75975
|
+
} catch (error) {
|
|
75976
|
+
this.connectedWorkspaceFolders.clear();
|
|
75977
|
+
this.connectedPortHasCwdMatch = false;
|
|
75978
|
+
}
|
|
75920
75979
|
}
|
|
75921
75980
|
scheduleReconnect() {
|
|
75922
75981
|
if (this.reconnectTimer) {
|
|
@@ -75950,6 +76009,9 @@ var init_vscodeConnection = __esm({
|
|
|
75950
76009
|
}
|
|
75951
76010
|
this.client = null;
|
|
75952
76011
|
}
|
|
76012
|
+
this.trustContextFromConnectedServer = false;
|
|
76013
|
+
this.connectedWorkspaceFolders.clear();
|
|
76014
|
+
this.connectedPortHasCwdMatch = false;
|
|
75953
76015
|
this.reconnectAttempts = 0;
|
|
75954
76016
|
}
|
|
75955
76017
|
isConnected() {
|
|
@@ -75970,6 +76032,7 @@ var init_vscodeConnection = __esm({
|
|
|
75970
76032
|
}
|
|
75971
76033
|
handleMessage(data) {
|
|
75972
76034
|
if (data.type === "context") {
|
|
76035
|
+
this.trustContextFromConnectedServer = true;
|
|
75973
76036
|
this.editorContext = {
|
|
75974
76037
|
activeFile: data.activeFile,
|
|
75975
76038
|
selectedText: data.selectedText,
|
|
@@ -81353,6 +81416,19 @@ var init_en = __esm({
|
|
|
81353
81416
|
searchLabel: "Search:",
|
|
81354
81417
|
noResults: "No matching profiles found"
|
|
81355
81418
|
},
|
|
81419
|
+
skillsPickerPanel: {
|
|
81420
|
+
title: "Select Skill",
|
|
81421
|
+
keyboardHint: "(ESC: cancel \xB7 Tab: switch \xB7 Enter: confirm)",
|
|
81422
|
+
loading: "Loading skills...",
|
|
81423
|
+
searchLabel: "Search:",
|
|
81424
|
+
appendLabel: "Append:",
|
|
81425
|
+
empty: "(empty)",
|
|
81426
|
+
noSkillsFound: "No skills found",
|
|
81427
|
+
noDescription: "No description",
|
|
81428
|
+
scrollHint: "\u2191\u2193 to scroll",
|
|
81429
|
+
moreAbove: "{count} above",
|
|
81430
|
+
moreBelow: "{count} below"
|
|
81431
|
+
},
|
|
81356
81432
|
reviewCommitPanel: {
|
|
81357
81433
|
title: "Review: Select Changes",
|
|
81358
81434
|
loadingCommits: "Loading commits...",
|
|
@@ -81813,6 +81889,9 @@ var init_en = __esm({
|
|
|
81813
81889
|
reason: "Reason:",
|
|
81814
81890
|
requiresConfirmation: "This command requires confirmation even in YOLO/Always-Approved mode",
|
|
81815
81891
|
arguments: "Arguments:",
|
|
81892
|
+
commandPagerTitle: "Command (paged):",
|
|
81893
|
+
commandPagerStatus: "{page}/{total}",
|
|
81894
|
+
commandPagerHint: "Tab: Next page (wraps)",
|
|
81816
81895
|
selectAction: "Select action:",
|
|
81817
81896
|
enterRejectionReason: "Enter rejection reason:",
|
|
81818
81897
|
pressEnterToSubmit: "Press Enter to submit",
|
|
@@ -82553,6 +82632,19 @@ var init_zh = __esm({
|
|
|
82553
82632
|
searchLabel: "\u641C\u7D22:",
|
|
82554
82633
|
noResults: "\u672A\u627E\u5230\u5339\u914D\u7684\u914D\u7F6E"
|
|
82555
82634
|
},
|
|
82635
|
+
skillsPickerPanel: {
|
|
82636
|
+
title: "\u9009\u62E9\u6280\u80FD",
|
|
82637
|
+
keyboardHint: "(ESC: \u53D6\u6D88 \xB7 Tab: \u5207\u6362 \xB7 Enter: \u786E\u8BA4)",
|
|
82638
|
+
loading: "\u6B63\u5728\u52A0\u8F7D\u6280\u80FD...",
|
|
82639
|
+
searchLabel: "\u641C\u7D22:",
|
|
82640
|
+
appendLabel: "\u8FFD\u52A0:",
|
|
82641
|
+
empty: "(\u7A7A)",
|
|
82642
|
+
noSkillsFound: "\u672A\u627E\u5230\u6280\u80FD",
|
|
82643
|
+
noDescription: "\u65E0\u63CF\u8FF0",
|
|
82644
|
+
scrollHint: "\u2191\u2193 \u6EDA\u52A8",
|
|
82645
|
+
moreAbove: "\u4E0A\u65B9 {count} \u9879",
|
|
82646
|
+
moreBelow: "\u4E0B\u65B9 {count} \u9879"
|
|
82647
|
+
},
|
|
82556
82648
|
reviewCommitPanel: {
|
|
82557
82649
|
title: "\u4EE3\u7801\u5BA1\u67E5\uFF1A\u9009\u62E9\u53D8\u66F4",
|
|
82558
82650
|
loadingCommits: "\u6B63\u5728\u52A0\u8F7D\u63D0\u4EA4\u8BB0\u5F55...",
|
|
@@ -83012,6 +83104,9 @@ var init_zh = __esm({
|
|
|
83012
83104
|
reason: "\u539F\u56E0:",
|
|
83013
83105
|
requiresConfirmation: "\u6B64\u547D\u4EE4\u5373\u4F7F\u5728 YOLO/\u81EA\u52A8\u6279\u51C6\u6A21\u5F0F\u4E0B\u4E5F\u9700\u8981\u786E\u8BA4",
|
|
83014
83106
|
arguments: "\u53C2\u6570:",
|
|
83107
|
+
commandPagerTitle: "\u547D\u4EE4(\u7FFB\u9875):",
|
|
83108
|
+
commandPagerStatus: "{page}/{total}",
|
|
83109
|
+
commandPagerHint: "Tab \u4E0B\u4E00\u9875(\u5FAA\u73AF)",
|
|
83015
83110
|
selectAction: "\u9009\u62E9\u64CD\u4F5C:",
|
|
83016
83111
|
enterRejectionReason: "\u8F93\u5165\u62D2\u7EDD\u539F\u56E0:",
|
|
83017
83112
|
pressEnterToSubmit: "\u6309 Enter \u63D0\u4EA4",
|
|
@@ -83752,6 +83847,19 @@ var init_zh_TW = __esm({
|
|
|
83752
83847
|
searchLabel: "\u641C\u5C0B:",
|
|
83753
83848
|
noResults: "\u672A\u627E\u5230\u7B26\u5408\u7684\u8A2D\u5B9A\u6A94"
|
|
83754
83849
|
},
|
|
83850
|
+
skillsPickerPanel: {
|
|
83851
|
+
title: "\u9078\u64C7\u6280\u80FD",
|
|
83852
|
+
keyboardHint: "(ESC: \u53D6\u6D88 \xB7 Tab: \u5207\u63DB \xB7 Enter: \u78BA\u8A8D)",
|
|
83853
|
+
loading: "\u6B63\u5728\u8F09\u5165\u6280\u80FD...",
|
|
83854
|
+
searchLabel: "\u641C\u5C0B:",
|
|
83855
|
+
appendLabel: "\u8FFD\u52A0:",
|
|
83856
|
+
empty: "(\u7A7A)",
|
|
83857
|
+
noSkillsFound: "\u672A\u627E\u5230\u6280\u80FD",
|
|
83858
|
+
noDescription: "\u7121\u63CF\u8FF0",
|
|
83859
|
+
scrollHint: "\u2191\u2193 \u6372\u52D5",
|
|
83860
|
+
moreAbove: "\u4E0A\u65B9 {count} \u9805",
|
|
83861
|
+
moreBelow: "\u4E0B\u65B9 {count} \u9805"
|
|
83862
|
+
},
|
|
83755
83863
|
reviewCommitPanel: {
|
|
83756
83864
|
title: "\u7A0B\u5F0F\u78BC\u5BE9\u67E5\uFF1A\u9078\u64C7\u8B8A\u66F4",
|
|
83757
83865
|
loadingCommits: "\u6B63\u5728\u8F09\u5165\u63D0\u4EA4\u8A18\u9304...",
|
|
@@ -84210,6 +84318,9 @@ var init_zh_TW = __esm({
|
|
|
84210
84318
|
reason: "\u539F\u56E0:",
|
|
84211
84319
|
requiresConfirmation: "\u6B64\u547D\u4EE4\u5373\u4F7F\u5728 YOLO/\u81EA\u52D5\u6279\u51C6\u6A21\u5F0F\u4E0B\u4E5F\u9700\u8981\u78BA\u8A8D",
|
|
84212
84320
|
arguments: "\u53C3\u6578:",
|
|
84321
|
+
commandPagerTitle: "\u547D\u4EE4(\u7FFB\u9801):",
|
|
84322
|
+
commandPagerStatus: "{page}/{total}",
|
|
84323
|
+
commandPagerHint: "Tab \u4E0B\u4E00\u9801(\u5FAA\u74B0)",
|
|
84213
84324
|
selectAction: "\u9078\u64C7\u64CD\u4F5C:",
|
|
84214
84325
|
enterRejectionReason: "\u8F38\u5165\u62D2\u7D55\u539F\u56E0:",
|
|
84215
84326
|
pressEnterToSubmit: "\u6309 Enter \u63D0\u4EA4",
|
|
@@ -554841,8 +554952,10 @@ var init_SkillsPickerPanel = __esm({
|
|
|
554841
554952
|
"use strict";
|
|
554842
554953
|
import_react99 = __toESM(require_react(), 1);
|
|
554843
554954
|
await init_build2();
|
|
554955
|
+
init_i18n();
|
|
554844
554956
|
init_ThemeContext();
|
|
554845
554957
|
SkillsPickerPanel = (0, import_react99.memo)(({ skills, selectedIndex, visible, maxHeight, isLoading = false, searchQuery = "", appendText = "", focus = "search" }) => {
|
|
554958
|
+
const { t } = useI18n();
|
|
554846
554959
|
const { theme: theme14 } = useTheme();
|
|
554847
554960
|
const MAX_DISPLAY_ITEMS = 5;
|
|
554848
554961
|
const effectiveMaxItems = maxHeight ? Math.min(maxHeight, MAX_DISPLAY_ITEMS) : MAX_DISPLAY_ITEMS;
|
|
@@ -554890,16 +555003,16 @@ var init_SkillsPickerPanel = __esm({
|
|
|
554890
555003
|
import_react99.default.createElement(
|
|
554891
555004
|
Text,
|
|
554892
555005
|
{ color: theme14.colors.warning, bold: true },
|
|
554893
|
-
|
|
555006
|
+
t.skillsPickerPanel.title,
|
|
554894
555007
|
" ",
|
|
554895
555008
|
skills.length > effectiveMaxItems && `(${selectedIndex + 1}/${skills.length})`
|
|
554896
555009
|
),
|
|
554897
|
-
import_react99.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true },
|
|
555010
|
+
import_react99.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true }, t.skillsPickerPanel.keyboardHint)
|
|
554898
555011
|
),
|
|
554899
555012
|
isLoading ? import_react99.default.createElement(
|
|
554900
555013
|
Box_default,
|
|
554901
555014
|
{ marginTop: 1 },
|
|
554902
|
-
import_react99.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true },
|
|
555015
|
+
import_react99.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true }, t.skillsPickerPanel.loading)
|
|
554903
555016
|
) : import_react99.default.createElement(
|
|
554904
555017
|
import_react99.default.Fragment,
|
|
554905
555018
|
null,
|
|
@@ -554910,23 +555023,23 @@ var init_SkillsPickerPanel = __esm({
|
|
|
554910
555023
|
Text,
|
|
554911
555024
|
{ color: theme14.colors.menuInfo },
|
|
554912
555025
|
focus === "search" ? "\u25B6 " : " ",
|
|
554913
|
-
|
|
555026
|
+
t.skillsPickerPanel.searchLabel,
|
|
554914
555027
|
" ",
|
|
554915
|
-
import_react99.default.createElement(Text, { color: theme14.colors.menuSelected }, searchQuery ||
|
|
555028
|
+
import_react99.default.createElement(Text, { color: theme14.colors.menuSelected }, searchQuery || t.skillsPickerPanel.empty)
|
|
554916
555029
|
),
|
|
554917
555030
|
import_react99.default.createElement(
|
|
554918
555031
|
Text,
|
|
554919
555032
|
{ color: theme14.colors.menuInfo },
|
|
554920
555033
|
focus === "append" ? "\u25B6 " : " ",
|
|
554921
|
-
|
|
555034
|
+
t.skillsPickerPanel.appendLabel,
|
|
554922
555035
|
" ",
|
|
554923
|
-
import_react99.default.createElement(Text, { color: theme14.colors.menuSelected }, appendText ||
|
|
555036
|
+
import_react99.default.createElement(Text, { color: theme14.colors.menuSelected }, appendText || t.skillsPickerPanel.empty)
|
|
554924
555037
|
)
|
|
554925
555038
|
),
|
|
554926
555039
|
skills.length === 0 ? import_react99.default.createElement(
|
|
554927
555040
|
Box_default,
|
|
554928
555041
|
{ marginTop: 1 },
|
|
554929
|
-
import_react99.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true },
|
|
555042
|
+
import_react99.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true }, t.skillsPickerPanel.noSkillsFound)
|
|
554930
555043
|
) : import_react99.default.createElement(
|
|
554931
555044
|
Box_default,
|
|
554932
555045
|
{ marginTop: 1, flexDirection: "column" },
|
|
@@ -554954,8 +555067,9 @@ var init_SkillsPickerPanel = __esm({
|
|
|
554954
555067
|
import_react99.default.createElement(
|
|
554955
555068
|
Text,
|
|
554956
555069
|
{ color: index === displayedSelectedIndex ? theme14.colors.menuSelected : theme14.colors.menuNormal, dimColor: true },
|
|
554957
|
-
"\u2514\u2500
|
|
554958
|
-
|
|
555070
|
+
"\u2514\u2500",
|
|
555071
|
+
" ",
|
|
555072
|
+
skill.description || skill.name || t.skillsPickerPanel.noDescription
|
|
554959
555073
|
)
|
|
554960
555074
|
)
|
|
554961
555075
|
)),
|
|
@@ -554965,9 +555079,21 @@ var init_SkillsPickerPanel = __esm({
|
|
|
554965
555079
|
import_react99.default.createElement(
|
|
554966
555080
|
Text,
|
|
554967
555081
|
{ color: theme14.colors.menuSecondary, dimColor: true },
|
|
554968
|
-
|
|
554969
|
-
hiddenAboveCount > 0 &&
|
|
554970
|
-
|
|
555082
|
+
t.skillsPickerPanel.scrollHint,
|
|
555083
|
+
hiddenAboveCount > 0 && import_react99.default.createElement(
|
|
555084
|
+
import_react99.default.Fragment,
|
|
555085
|
+
null,
|
|
555086
|
+
"\xB7",
|
|
555087
|
+
" ",
|
|
555088
|
+
t.skillsPickerPanel.moreAbove.replace("{count}", hiddenAboveCount.toString())
|
|
555089
|
+
),
|
|
555090
|
+
hiddenBelowCount > 0 && import_react99.default.createElement(
|
|
555091
|
+
import_react99.default.Fragment,
|
|
555092
|
+
null,
|
|
555093
|
+
"\xB7",
|
|
555094
|
+
" ",
|
|
555095
|
+
t.skillsPickerPanel.moreBelow.replace("{count}", hiddenBelowCount.toString())
|
|
555096
|
+
)
|
|
554971
555097
|
)
|
|
554972
555098
|
)
|
|
554973
555099
|
)
|
|
@@ -556230,38 +556356,34 @@ var init_BackgroundProcessPanel = __esm({
|
|
|
556230
556356
|
// dist/ui/components/special/TodoTree.js
|
|
556231
556357
|
function TodoTree({ todos }) {
|
|
556232
556358
|
const { theme: theme14 } = useTheme();
|
|
556359
|
+
const { t } = useI18n();
|
|
556233
556360
|
if (todos.length === 0) {
|
|
556234
556361
|
return null;
|
|
556235
556362
|
}
|
|
556236
|
-
const
|
|
556363
|
+
const PAGE_SIZE2 = 5;
|
|
556237
556364
|
const totalCount = todos.length;
|
|
556238
|
-
const completedCount = todos.reduce((acc,
|
|
556239
|
-
|
|
556240
|
-
|
|
556241
|
-
|
|
556242
|
-
|
|
556243
|
-
|
|
556244
|
-
|
|
556245
|
-
|
|
556246
|
-
|
|
556247
|
-
|
|
556248
|
-
|
|
556249
|
-
|
|
556250
|
-
|
|
556251
|
-
|
|
556252
|
-
|
|
556253
|
-
|
|
556254
|
-
|
|
556255
|
-
|
|
556256
|
-
|
|
556257
|
-
|
|
556258
|
-
|
|
556259
|
-
|
|
556260
|
-
}
|
|
556261
|
-
visibleTodos = todos.filter((_3, i) => visibleMask[i]);
|
|
556262
|
-
const visibleCompletedCount = visibleTodos.reduce((acc, t) => acc + (t.status === "completed" ? 1 : 0), 0);
|
|
556263
|
-
hiddenCompletedCount = Math.max(0, completedCount - visibleCompletedCount);
|
|
556264
|
-
}
|
|
556365
|
+
const completedCount = todos.reduce((acc, t2) => acc + (t2.status === "completed" ? 1 : 0), 0);
|
|
556366
|
+
const sortedTodos = (0, import_react104.useMemo)(() => {
|
|
556367
|
+
return todos.map((t2, originalIndex) => ({ t: t2, originalIndex })).slice().sort((a, b) => {
|
|
556368
|
+
const aCompleted = a.t.status === "completed" ? 1 : 0;
|
|
556369
|
+
const bCompleted = b.t.status === "completed" ? 1 : 0;
|
|
556370
|
+
if (aCompleted !== bCompleted)
|
|
556371
|
+
return aCompleted - bCompleted;
|
|
556372
|
+
return a.originalIndex - b.originalIndex;
|
|
556373
|
+
}).map(({ t: t2 }) => t2);
|
|
556374
|
+
}, [todos]);
|
|
556375
|
+
const pageCount = Math.max(1, Math.ceil(sortedTodos.length / PAGE_SIZE2));
|
|
556376
|
+
const [pageIndex, setPageIndex] = (0, import_react104.useState)(0);
|
|
556377
|
+
(0, import_react104.useEffect)(() => {
|
|
556378
|
+
setPageIndex((p) => Math.min(p, pageCount - 1));
|
|
556379
|
+
}, [pageCount]);
|
|
556380
|
+
use_input_default((_input, key) => {
|
|
556381
|
+
if (!key.tab || pageCount <= 1)
|
|
556382
|
+
return;
|
|
556383
|
+
setPageIndex((p) => (p + 1) % pageCount);
|
|
556384
|
+
});
|
|
556385
|
+
const visibleTodos = sortedTodos.slice(pageIndex * PAGE_SIZE2, pageIndex * PAGE_SIZE2 + PAGE_SIZE2);
|
|
556386
|
+
const hiddenCount = Math.max(0, sortedTodos.length - visibleTodos.length);
|
|
556265
556387
|
const getStatusIcon = (status) => {
|
|
556266
556388
|
return status === "completed" ? "\u2713" : "\u25CB";
|
|
556267
556389
|
};
|
|
@@ -556277,7 +556399,7 @@ function TodoTree({ todos }) {
|
|
|
556277
556399
|
};
|
|
556278
556400
|
return import_react104.default.createElement(
|
|
556279
556401
|
Text,
|
|
556280
|
-
{ key: `${todo.id}:${index}` },
|
|
556402
|
+
{ key: `${todo.id}:${pageIndex}:${index}` },
|
|
556281
556403
|
applyColor(statusIcon),
|
|
556282
556404
|
applyColor(" " + todo.content)
|
|
556283
556405
|
);
|
|
@@ -556298,12 +556420,23 @@ function TodoTree({ todos }) {
|
|
|
556298
556420
|
totalCount,
|
|
556299
556421
|
")"
|
|
556300
556422
|
),
|
|
556301
|
-
|
|
556423
|
+
import_react104.default.createElement(
|
|
556424
|
+
Text,
|
|
556425
|
+
{ dimColor: true },
|
|
556426
|
+
" ",
|
|
556427
|
+
"[",
|
|
556428
|
+
pageIndex + 1,
|
|
556429
|
+
"/",
|
|
556430
|
+
pageCount,
|
|
556431
|
+
"] ",
|
|
556432
|
+
t.toolConfirmation.commandPagerHint
|
|
556433
|
+
),
|
|
556434
|
+
hiddenCount > 0 && import_react104.default.createElement(
|
|
556302
556435
|
Text,
|
|
556303
556436
|
{ dimColor: true },
|
|
556304
556437
|
" +",
|
|
556305
|
-
|
|
556306
|
-
"
|
|
556438
|
+
hiddenCount,
|
|
556439
|
+
" more"
|
|
556307
556440
|
)
|
|
556308
556441
|
),
|
|
556309
556442
|
visibleTodos.map((todo, index) => renderTodoLine(todo, index))
|
|
@@ -556316,6 +556449,7 @@ var init_TodoTree = __esm({
|
|
|
556316
556449
|
import_react104 = __toESM(require_react(), 1);
|
|
556317
556450
|
await init_build2();
|
|
556318
556451
|
init_source();
|
|
556452
|
+
init_i18n();
|
|
556319
556453
|
init_ThemeContext();
|
|
556320
556454
|
}
|
|
556321
556455
|
});
|
|
@@ -556962,26 +557096,43 @@ function formatArgumentsAsTree(args2, toolName) {
|
|
|
556962
557096
|
excludeFields.add("context");
|
|
556963
557097
|
excludeFields.add("signature");
|
|
556964
557098
|
}
|
|
556965
|
-
const noTruncateFields = /* @__PURE__ */ new Set();
|
|
556966
|
-
if (toolName === "terminal-execute") {
|
|
556967
|
-
noTruncateFields.add("command");
|
|
556968
|
-
}
|
|
556969
557099
|
const keys2 = Object.keys(args2).filter((key) => !excludeFields.has(key));
|
|
556970
557100
|
return keys2.map((key, index) => ({
|
|
556971
557101
|
key,
|
|
556972
|
-
value: formatArgumentValue(args2[key], 100,
|
|
557102
|
+
value: formatArgumentValue(args2[key], 100, false),
|
|
556973
557103
|
isLast: index === keys2.length - 1
|
|
556974
557104
|
}));
|
|
556975
557105
|
}
|
|
556976
557106
|
function ToolConfirmation({ toolName, toolArguments, allTools, onConfirm, onHookError }) {
|
|
556977
|
-
var _a21
|
|
557107
|
+
var _a21;
|
|
556978
557108
|
const { theme: theme14 } = useTheme();
|
|
556979
557109
|
const { t } = useI18n();
|
|
557110
|
+
const { stdout } = use_stdout_default();
|
|
557111
|
+
const [terminalColumns, setTerminalColumns] = (0, import_react110.useState)((stdout == null ? void 0 : stdout.columns) ?? process.stdout.columns ?? 80);
|
|
557112
|
+
(0, import_react110.useEffect)(() => {
|
|
557113
|
+
var _a22;
|
|
557114
|
+
const next = (stdout == null ? void 0 : stdout.columns) ?? process.stdout.columns;
|
|
557115
|
+
if (typeof next === "number") {
|
|
557116
|
+
setTerminalColumns(next);
|
|
557117
|
+
}
|
|
557118
|
+
const handler = () => {
|
|
557119
|
+
const cols = (stdout == null ? void 0 : stdout.columns) ?? process.stdout.columns;
|
|
557120
|
+
if (typeof cols === "number") {
|
|
557121
|
+
setTerminalColumns(cols);
|
|
557122
|
+
}
|
|
557123
|
+
};
|
|
557124
|
+
(_a22 = stdout == null ? void 0 : stdout.on) == null ? void 0 : _a22.call(stdout, "resize", handler);
|
|
557125
|
+
return () => {
|
|
557126
|
+
var _a23;
|
|
557127
|
+
(_a23 = stdout == null ? void 0 : stdout.off) == null ? void 0 : _a23.call(stdout, "resize", handler);
|
|
557128
|
+
};
|
|
557129
|
+
}, [stdout]);
|
|
556980
557130
|
const [hasSelected, setHasSelected] = (0, import_react110.useState)(false);
|
|
556981
557131
|
const [showRejectInput, setShowRejectInput] = (0, import_react110.useState)(false);
|
|
556982
557132
|
const [rejectReason, setRejectReason] = (0, import_react110.useState)("");
|
|
556983
557133
|
const [menuKey, setMenuKey] = (0, import_react110.useState)(0);
|
|
556984
557134
|
const [initialMenuIndex, setInitialMenuIndex] = (0, import_react110.useState)(0);
|
|
557135
|
+
const [commandPageOffset, setCommandPageOffset] = (0, import_react110.useState)(0);
|
|
556985
557136
|
const sensitiveCommandCheck = (0, import_react110.useMemo)(() => {
|
|
556986
557137
|
if (toolName !== "terminal-execute" || !toolArguments) {
|
|
556987
557138
|
return { isSensitive: false };
|
|
@@ -557006,6 +557157,45 @@ function ToolConfirmation({ toolName, toolArguments, allTools, onConfirm, onHook
|
|
|
557006
557157
|
return null;
|
|
557007
557158
|
}
|
|
557008
557159
|
}, [toolArguments, toolName]);
|
|
557160
|
+
const terminalCommand = (0, import_react110.useMemo)(() => {
|
|
557161
|
+
if (toolName !== "terminal-execute" || !toolArguments) {
|
|
557162
|
+
return null;
|
|
557163
|
+
}
|
|
557164
|
+
try {
|
|
557165
|
+
const parsed = JSON.parse(toolArguments);
|
|
557166
|
+
const command = parsed.command;
|
|
557167
|
+
return typeof command === "string" ? command : null;
|
|
557168
|
+
} catch {
|
|
557169
|
+
return null;
|
|
557170
|
+
}
|
|
557171
|
+
}, [toolName, toolArguments]);
|
|
557172
|
+
(0, import_react110.useEffect)(() => {
|
|
557173
|
+
setCommandPageOffset(0);
|
|
557174
|
+
}, [terminalCommand]);
|
|
557175
|
+
const commandPager = (0, import_react110.useMemo)(() => {
|
|
557176
|
+
if (!terminalCommand)
|
|
557177
|
+
return null;
|
|
557178
|
+
const maxLines = 3;
|
|
557179
|
+
const reserved = 24;
|
|
557180
|
+
const lineWidth = Math.max(20, terminalColumns - reserved);
|
|
557181
|
+
const windowChars = lineWidth * maxLines;
|
|
557182
|
+
const totalPages = Math.max(1, Math.ceil(terminalCommand.length / windowChars));
|
|
557183
|
+
const normalizedOffset = totalPages <= 1 ? 0 : (commandPageOffset % (totalPages * windowChars) + totalPages * windowChars) % (totalPages * windowChars);
|
|
557184
|
+
const slice2 = terminalCommand.slice(normalizedOffset, normalizedOffset + windowChars);
|
|
557185
|
+
const lines = [];
|
|
557186
|
+
for (let i = 0; i < maxLines; i++) {
|
|
557187
|
+
lines.push(slice2.slice(i * lineWidth, (i + 1) * lineWidth));
|
|
557188
|
+
}
|
|
557189
|
+
return {
|
|
557190
|
+
lines,
|
|
557191
|
+
maxLines,
|
|
557192
|
+
lineWidth,
|
|
557193
|
+
windowChars,
|
|
557194
|
+
totalPages,
|
|
557195
|
+
pageIndex: Math.floor(normalizedOffset / windowChars) + 1,
|
|
557196
|
+
canPage: totalPages > 1
|
|
557197
|
+
};
|
|
557198
|
+
}, [terminalCommand, commandPageOffset, terminalColumns]);
|
|
557009
557199
|
(0, import_react110.useEffect)(() => {
|
|
557010
557200
|
const context2 = {
|
|
557011
557201
|
toolName,
|
|
@@ -557177,6 +557367,10 @@ Output: ${combinedOutput}`);
|
|
|
557177
557367
|
return baseItems;
|
|
557178
557368
|
}, [sensitiveCommandCheck.isSensitive, t]);
|
|
557179
557369
|
use_input_default((_input, key) => {
|
|
557370
|
+
if (key.tab && !hasSelected && !showRejectInput && toolName === "terminal-execute" && (commandPager == null ? void 0 : commandPager.canPage)) {
|
|
557371
|
+
setCommandPageOffset((prev) => prev + commandPager.windowChars);
|
|
557372
|
+
return;
|
|
557373
|
+
}
|
|
557180
557374
|
if (showRejectInput && key.escape) {
|
|
557181
557375
|
setShowRejectInput(false);
|
|
557182
557376
|
setRejectReason("");
|
|
@@ -557244,17 +557438,6 @@ Output: ${combinedOutput}`);
|
|
|
557244
557438
|
" "
|
|
557245
557439
|
),
|
|
557246
557440
|
import_react110.default.createElement(Text, { color: "magenta", bold: true }, (_a21 = sensitiveCommandCheck.matchedCommand) == null ? void 0 : _a21.pattern)
|
|
557247
|
-
),
|
|
557248
|
-
import_react110.default.createElement(
|
|
557249
|
-
Box_default,
|
|
557250
|
-
{ marginTop: 0 },
|
|
557251
|
-
import_react110.default.createElement(
|
|
557252
|
-
Text,
|
|
557253
|
-
{ dimColor: true },
|
|
557254
|
-
t.toolConfirmation.reason,
|
|
557255
|
-
" "
|
|
557256
|
-
),
|
|
557257
|
-
import_react110.default.createElement(Text, { color: "white" }, (_b14 = sensitiveCommandCheck.matchedCommand) == null ? void 0 : _b14.description)
|
|
557258
557441
|
)
|
|
557259
557442
|
),
|
|
557260
557443
|
import_react110.default.createElement(
|
|
@@ -557263,7 +557446,7 @@ Output: ${combinedOutput}`);
|
|
|
557263
557446
|
import_react110.default.createElement(Text, { color: theme14.colors.warning, italic: true }, t.toolConfirmation.requiresConfirmation)
|
|
557264
557447
|
)
|
|
557265
557448
|
),
|
|
557266
|
-
formattedArgs && formattedArgs.length > 0 && import_react110.default.createElement(
|
|
557449
|
+
toolName !== "terminal-execute" && formattedArgs && formattedArgs.length > 0 && import_react110.default.createElement(
|
|
557267
557450
|
Box_default,
|
|
557268
557451
|
{ flexDirection: "column", marginBottom: 1 },
|
|
557269
557452
|
import_react110.default.createElement(Text, { dimColor: true }, t.toolConfirmation.arguments),
|
|
@@ -557281,6 +557464,19 @@ Output: ${combinedOutput}`);
|
|
|
557281
557464
|
import_react110.default.createElement(Text, { color: "white" }, arg.value)
|
|
557282
557465
|
)
|
|
557283
557466
|
))
|
|
557467
|
+
),
|
|
557468
|
+
toolName === "terminal-execute" && commandPager && import_react110.default.createElement(
|
|
557469
|
+
Box_default,
|
|
557470
|
+
{ flexDirection: "column", marginBottom: 1 },
|
|
557471
|
+
import_react110.default.createElement(
|
|
557472
|
+
Text,
|
|
557473
|
+
{ dimColor: true },
|
|
557474
|
+
t.toolConfirmation.commandPagerTitle,
|
|
557475
|
+
" ",
|
|
557476
|
+
import_react110.default.createElement(Text, { color: theme14.colors.menuInfo }, t.toolConfirmation.commandPagerStatus.replace("{page}", String(commandPager.pageIndex)).replace("{total}", String(commandPager.totalPages)))
|
|
557477
|
+
),
|
|
557478
|
+
import_react110.default.createElement(Box_default, { flexDirection: "column", paddingLeft: 2 }, commandPager.lines.map((line, idx2) => import_react110.default.createElement(Text, { key: idx2, color: "white", wrap: "truncate" }, line))),
|
|
557479
|
+
commandPager.canPage && import_react110.default.createElement(Text, { dimColor: true }, t.toolConfirmation.commandPagerHint)
|
|
557284
557480
|
)
|
|
557285
557481
|
),
|
|
557286
557482
|
formattedAllTools && import_react110.default.createElement(
|
package/bundle/package.json
CHANGED