@rdmind/rdmind 0.0.28-alpha.10 → 0.0.28-alpha.12
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/cli.js +653 -643
- package/locales/en.js +1 -1
- package/locales/zh.js +1 -1
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -147562,7 +147562,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
147562
147562
|
};
|
|
147563
147563
|
}
|
|
147564
147564
|
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
147565
|
-
const version2 = "0.0.28-alpha.
|
|
147565
|
+
const version2 = "0.0.28-alpha.12";
|
|
147566
147566
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
147567
147567
|
const baseHeaders = {
|
|
147568
147568
|
"User-Agent": userAgent2
|
|
@@ -222083,8 +222083,8 @@ var init_git_commit = __esm({
|
|
|
222083
222083
|
"packages/core/src/generated/git-commit.ts"() {
|
|
222084
222084
|
"use strict";
|
|
222085
222085
|
init_esbuild_shims();
|
|
222086
|
-
GIT_COMMIT_INFO = "
|
|
222087
|
-
CLI_VERSION = "0.0.28-alpha.
|
|
222086
|
+
GIT_COMMIT_INFO = "cb24f2a0";
|
|
222087
|
+
CLI_VERSION = "0.0.28-alpha.12";
|
|
222088
222088
|
}
|
|
222089
222089
|
});
|
|
222090
222090
|
|
|
@@ -246414,7 +246414,7 @@ var require_backend = __commonJS({
|
|
|
246414
246414
|
});
|
|
246415
246415
|
return a._currentValue;
|
|
246416
246416
|
}, "useContext"),
|
|
246417
|
-
useEffect: /* @__PURE__ */ __name(function
|
|
246417
|
+
useEffect: /* @__PURE__ */ __name(function useEffect57(a) {
|
|
246418
246418
|
C();
|
|
246419
246419
|
x.push({
|
|
246420
246420
|
primitive: "Effect",
|
|
@@ -246491,7 +246491,7 @@ var require_backend = __commonJS({
|
|
|
246491
246491
|
});
|
|
246492
246492
|
return a;
|
|
246493
246493
|
}, "useRef"),
|
|
246494
|
-
useState: /* @__PURE__ */ __name(function
|
|
246494
|
+
useState: /* @__PURE__ */ __name(function useState66(a) {
|
|
246495
246495
|
var b = C();
|
|
246496
246496
|
a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a;
|
|
246497
246497
|
x.push({
|
|
@@ -287551,7 +287551,7 @@ var init_en2 = __esm({
|
|
|
287551
287551
|
"open documentation": "open documentation",
|
|
287552
287552
|
Create: "Create",
|
|
287553
287553
|
"to customize your interactions with RDMind": "to customize your interactions with RDMind",
|
|
287554
|
-
|
|
287554
|
+
PressEsc: "Press",
|
|
287555
287555
|
"twice to clear input,": "twice to clear input,",
|
|
287556
287556
|
"for new line,": "for new line,",
|
|
287557
287557
|
"to exit RDMind": "to exit RDMind",
|
|
@@ -288404,7 +288404,7 @@ var init_zh = __esm({
|
|
|
288404
288404
|
"open documentation": "\u6253\u5F00\u6587\u6863",
|
|
288405
288405
|
Create: "\u521B\u5EFA",
|
|
288406
288406
|
"to customize your interactions with RDMind": "\u81EA\u5B9A\u4E49\u4F60\u4E0E RDMind \u7684\u4EA4\u4E92\u65B9\u5F0F",
|
|
288407
|
-
|
|
288407
|
+
PressEsc: "\u4E24\u6B21",
|
|
288408
288408
|
"twice to clear input,": "\u6E05\u7A7A\u8F93\u5165\u6846\uFF0C",
|
|
288409
288409
|
"for new line,": "\u6362\u884C\uFF0C",
|
|
288410
288410
|
"to exit RDMind": "\u9000\u51FARDMind",
|
|
@@ -310333,7 +310333,7 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
|
|
|
310333
310333
|
var measure_element_default = measureElement;
|
|
310334
310334
|
|
|
310335
310335
|
// packages/cli/src/gemini.tsx
|
|
310336
|
-
var
|
|
310336
|
+
var import_react137 = __toESM(require_react(), 1);
|
|
310337
310337
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
310338
310338
|
import dns from "node:dns";
|
|
310339
310339
|
import os48 from "node:os";
|
|
@@ -316291,7 +316291,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
316291
316291
|
// packages/cli/src/utils/version.ts
|
|
316292
316292
|
async function getCliVersion() {
|
|
316293
316293
|
const pkgJson = await getPackageJson();
|
|
316294
|
-
return "0.0.28-alpha.
|
|
316294
|
+
return "0.0.28-alpha.12";
|
|
316295
316295
|
}
|
|
316296
316296
|
__name(getCliVersion, "getCliVersion");
|
|
316297
316297
|
|
|
@@ -320314,7 +320314,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
320314
320314
|
|
|
320315
320315
|
// packages/cli/src/generated/git-commit.ts
|
|
320316
320316
|
init_esbuild_shims();
|
|
320317
|
-
var GIT_COMMIT_INFO2 = "
|
|
320317
|
+
var GIT_COMMIT_INFO2 = "cb24f2a0";
|
|
320318
320318
|
|
|
320319
320319
|
// packages/cli/src/utils/systemInfo.ts
|
|
320320
320320
|
async function getNpmVersion() {
|
|
@@ -330721,7 +330721,7 @@ __name(runNonInteractiveStreamJson, "runNonInteractiveStreamJson");
|
|
|
330721
330721
|
|
|
330722
330722
|
// packages/cli/src/ui/AppContainer.tsx
|
|
330723
330723
|
init_esbuild_shims();
|
|
330724
|
-
var
|
|
330724
|
+
var import_react135 = __toESM(require_react(), 1);
|
|
330725
330725
|
|
|
330726
330726
|
// packages/cli/src/ui/App.tsx
|
|
330727
330727
|
init_esbuild_shims();
|
|
@@ -354342,7 +354342,6 @@ init_esbuild_shims();
|
|
|
354342
354342
|
|
|
354343
354343
|
// packages/cli/src/ui/components/Notifications.tsx
|
|
354344
354344
|
init_esbuild_shims();
|
|
354345
|
-
var import_react70 = __toESM(require_react(), 1);
|
|
354346
354345
|
|
|
354347
354346
|
// packages/cli/src/ui/contexts/AppContext.tsx
|
|
354348
354347
|
init_esbuild_shims();
|
|
@@ -354372,29 +354371,10 @@ var UpdateNotification = /* @__PURE__ */ __name(({ message }) => /* @__PURE__ */
|
|
|
354372
354371
|
|
|
354373
354372
|
// packages/cli/src/ui/components/Notifications.tsx
|
|
354374
354373
|
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
|
|
354375
|
-
var L4_WARNING_AUTO_HIDE_DELAY = 3e3;
|
|
354376
354374
|
var Notifications = /* @__PURE__ */ __name(() => {
|
|
354377
354375
|
const { startupWarnings } = useAppContext();
|
|
354378
354376
|
const { initError, streamingState, updateInfo } = useUIState();
|
|
354379
|
-
const
|
|
354380
|
-
const visibleWarnings = startupWarnings.filter(
|
|
354381
|
-
(warning) => !hiddenWarnings.has(warning)
|
|
354382
|
-
);
|
|
354383
|
-
(0, import_react70.useEffect)(() => {
|
|
354384
|
-
const timers = [];
|
|
354385
|
-
startupWarnings.forEach((warning) => {
|
|
354386
|
-
if (warning.includes("L4\u7B49\u7EA7\u4ED3\u5E93") || warning.includes("\u5207\u6362\u5230QS\u5E73\u53F0\u6A21\u578B")) {
|
|
354387
|
-
const timer = setTimeout(() => {
|
|
354388
|
-
setHiddenWarnings((prev) => new Set(prev).add(warning));
|
|
354389
|
-
}, L4_WARNING_AUTO_HIDE_DELAY);
|
|
354390
|
-
timers.push(timer);
|
|
354391
|
-
}
|
|
354392
|
-
});
|
|
354393
|
-
return () => {
|
|
354394
|
-
timers.forEach((timer) => clearTimeout(timer));
|
|
354395
|
-
};
|
|
354396
|
-
}, [startupWarnings]);
|
|
354397
|
-
const showStartupWarnings = visibleWarnings.length > 0;
|
|
354377
|
+
const showStartupWarnings = startupWarnings.length > 0;
|
|
354398
354378
|
const showInitError = initError && streamingState !== "responding" /* Responding */;
|
|
354399
354379
|
if (!showStartupWarnings && !showInitError && !updateInfo) {
|
|
354400
354380
|
return null;
|
|
@@ -354409,7 +354389,7 @@ var Notifications = /* @__PURE__ */ __name(() => {
|
|
|
354409
354389
|
paddingX: 1,
|
|
354410
354390
|
marginY: 1,
|
|
354411
354391
|
flexDirection: "column",
|
|
354412
|
-
children:
|
|
354392
|
+
children: startupWarnings.map((warning, index) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text3, { color: theme.status.warning, children: warning }, index))
|
|
354413
354393
|
}
|
|
354414
354394
|
),
|
|
354415
354395
|
showInitError && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
@@ -354529,7 +354509,7 @@ init_esbuild_shims();
|
|
|
354529
354509
|
|
|
354530
354510
|
// node_modules/ink-link/dist/index.js
|
|
354531
354511
|
init_esbuild_shims();
|
|
354532
|
-
var
|
|
354512
|
+
var import_react70 = __toESM(require_react(), 1);
|
|
354533
354513
|
var import_prop_types2 = __toESM(require_prop_types(), 1);
|
|
354534
354514
|
|
|
354535
354515
|
// node_modules/terminal-link/index.js
|
|
@@ -354677,10 +354657,10 @@ terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
|
|
|
354677
354657
|
// node_modules/ink-link/dist/index.js
|
|
354678
354658
|
var Link = /* @__PURE__ */ __name(({ children, url: url2, fallback = true }) => (
|
|
354679
354659
|
// eslint-disable-line react/function-component-definition
|
|
354680
|
-
|
|
354660
|
+
import_react70.default.createElement(
|
|
354681
354661
|
Transform,
|
|
354682
354662
|
{ transform: /* @__PURE__ */ __name((children2) => terminalLink(children2, url2, { fallback }), "transform") },
|
|
354683
|
-
|
|
354663
|
+
import_react70.default.createElement(Text3, null, children)
|
|
354684
354664
|
)
|
|
354685
354665
|
), "Link");
|
|
354686
354666
|
Link.propTypes = {
|
|
@@ -354746,7 +354726,7 @@ var Tips = /* @__PURE__ */ __name(({ config }) => {
|
|
|
354746
354726
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Text3, { color: theme.text.primary, children: [
|
|
354747
354727
|
geminiMdFileCount === 0 ? "4." : "3.",
|
|
354748
354728
|
" ",
|
|
354749
|
-
t2("
|
|
354729
|
+
t2("PressEsc"),
|
|
354750
354730
|
" ",
|
|
354751
354731
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Text3, { bold: true, color: theme.text.accent, children: "Esc" }),
|
|
354752
354732
|
" ",
|
|
@@ -354964,7 +354944,7 @@ __name(LoopDetectionConfirmation, "LoopDetectionConfirmation");
|
|
|
354964
354944
|
|
|
354965
354945
|
// packages/cli/src/ui/components/FolderTrustDialog.tsx
|
|
354966
354946
|
init_esbuild_shims();
|
|
354967
|
-
var
|
|
354947
|
+
var import_react71 = __toESM(require_react(), 1);
|
|
354968
354948
|
import * as process31 from "node:process";
|
|
354969
354949
|
import * as path97 from "node:path";
|
|
354970
354950
|
|
|
@@ -355019,7 +354999,7 @@ var FolderTrustDialog = /* @__PURE__ */ __name(({
|
|
|
355019
354999
|
onSelect,
|
|
355020
355000
|
isRestarting
|
|
355021
355001
|
}) => {
|
|
355022
|
-
(0,
|
|
355002
|
+
(0, import_react71.useEffect)(() => {
|
|
355023
355003
|
const doRelaunch = /* @__PURE__ */ __name(async () => {
|
|
355024
355004
|
if (isRestarting) {
|
|
355025
355005
|
setTimeout(async () => {
|
|
@@ -355158,7 +355138,7 @@ var ShellConfirmationDialog = /* @__PURE__ */ __name(({ request: request4 }) =>
|
|
|
355158
355138
|
|
|
355159
355139
|
// packages/cli/src/ui/components/ConsentPrompt.tsx
|
|
355160
355140
|
init_esbuild_shims();
|
|
355161
|
-
var
|
|
355141
|
+
var import_react72 = __toESM(require_react(), 1);
|
|
355162
355142
|
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
|
|
355163
355143
|
var ConsentPrompt = /* @__PURE__ */ __name((props) => {
|
|
355164
355144
|
const { prompt, onConfirm, terminalWidth } = props;
|
|
@@ -355196,7 +355176,7 @@ var ConsentPrompt = /* @__PURE__ */ __name((props) => {
|
|
|
355196
355176
|
|
|
355197
355177
|
// packages/cli/src/ui/components/ThemeDialog.tsx
|
|
355198
355178
|
init_esbuild_shims();
|
|
355199
|
-
var
|
|
355179
|
+
var import_react73 = __toESM(require_react(), 1);
|
|
355200
355180
|
init_settings();
|
|
355201
355181
|
|
|
355202
355182
|
// packages/cli/src/utils/dialogScopeUtils.ts
|
|
@@ -355461,10 +355441,10 @@ function ThemeDialog({
|
|
|
355461
355441
|
availableTerminalHeight,
|
|
355462
355442
|
terminalWidth
|
|
355463
355443
|
}) {
|
|
355464
|
-
const [selectedScope, setSelectedScope] = (0,
|
|
355444
|
+
const [selectedScope, setSelectedScope] = (0, import_react73.useState)(
|
|
355465
355445
|
"User" /* User */
|
|
355466
355446
|
);
|
|
355467
|
-
const [highlightedThemeName, setHighlightedThemeName] = (0,
|
|
355447
|
+
const [highlightedThemeName, setHighlightedThemeName] = (0, import_react73.useState)(settings.merged.ui?.theme || DEFAULT_THEME.name);
|
|
355468
355448
|
const customThemes = selectedScope === "User" /* User */ ? settings.user.settings.ui?.customThemes || {} : settings.merged.ui?.customThemes || {};
|
|
355469
355449
|
const builtInThemes = themeManager.getAvailableThemes().filter((theme2) => theme2.type !== "custom");
|
|
355470
355450
|
const customThemeNames = Object.keys(customThemes);
|
|
@@ -355489,7 +355469,7 @@ function ThemeDialog({
|
|
|
355489
355469
|
(item) => item.value === highlightedThemeName
|
|
355490
355470
|
);
|
|
355491
355471
|
const safeInitialThemeIndex = initialThemeIndex >= 0 ? initialThemeIndex : 0;
|
|
355492
|
-
const handleThemeSelect = (0,
|
|
355472
|
+
const handleThemeSelect = (0, import_react73.useCallback)(
|
|
355493
355473
|
(themeName) => {
|
|
355494
355474
|
onSelect(themeName, selectedScope);
|
|
355495
355475
|
},
|
|
@@ -355499,16 +355479,16 @@ function ThemeDialog({
|
|
|
355499
355479
|
setHighlightedThemeName(themeName);
|
|
355500
355480
|
onHighlight(themeName);
|
|
355501
355481
|
}, "handleThemeHighlight");
|
|
355502
|
-
const handleScopeHighlight = (0,
|
|
355482
|
+
const handleScopeHighlight = (0, import_react73.useCallback)((scope) => {
|
|
355503
355483
|
setSelectedScope(scope);
|
|
355504
355484
|
}, []);
|
|
355505
|
-
const handleScopeSelect = (0,
|
|
355485
|
+
const handleScopeSelect = (0, import_react73.useCallback)(
|
|
355506
355486
|
(scope) => {
|
|
355507
355487
|
onSelect(highlightedThemeName, scope);
|
|
355508
355488
|
},
|
|
355509
355489
|
[onSelect, highlightedThemeName]
|
|
355510
355490
|
);
|
|
355511
|
-
const [mode, setMode] = (0,
|
|
355491
|
+
const [mode, setMode] = (0, import_react73.useState)("theme");
|
|
355512
355492
|
useKeypress(
|
|
355513
355493
|
(key) => {
|
|
355514
355494
|
if (key.name === "tab") {
|
|
@@ -355658,32 +355638,32 @@ __name(ThemeDialog, "ThemeDialog");
|
|
|
355658
355638
|
|
|
355659
355639
|
// packages/cli/src/ui/components/SettingsDialog.tsx
|
|
355660
355640
|
init_esbuild_shims();
|
|
355661
|
-
var
|
|
355641
|
+
var import_react75 = __toESM(require_react(), 1);
|
|
355662
355642
|
init_settings();
|
|
355663
355643
|
|
|
355664
355644
|
// packages/cli/src/ui/contexts/VimModeContext.tsx
|
|
355665
355645
|
init_esbuild_shims();
|
|
355666
|
-
var
|
|
355646
|
+
var import_react74 = __toESM(require_react(), 1);
|
|
355667
355647
|
init_settings();
|
|
355668
355648
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
355669
|
-
var VimModeContext = (0,
|
|
355649
|
+
var VimModeContext = (0, import_react74.createContext)(void 0);
|
|
355670
355650
|
var VimModeProvider = /* @__PURE__ */ __name(({
|
|
355671
355651
|
children,
|
|
355672
355652
|
settings
|
|
355673
355653
|
}) => {
|
|
355674
355654
|
const initialVimEnabled = settings.merged.general?.vimMode ?? false;
|
|
355675
|
-
const [vimEnabled, setVimEnabled] = (0,
|
|
355676
|
-
const [vimMode, setVimMode] = (0,
|
|
355655
|
+
const [vimEnabled, setVimEnabled] = (0, import_react74.useState)(initialVimEnabled);
|
|
355656
|
+
const [vimMode, setVimMode] = (0, import_react74.useState)(
|
|
355677
355657
|
initialVimEnabled ? "NORMAL" : "INSERT"
|
|
355678
355658
|
);
|
|
355679
|
-
(0,
|
|
355659
|
+
(0, import_react74.useEffect)(() => {
|
|
355680
355660
|
const enabled = settings.merged.general?.vimMode ?? false;
|
|
355681
355661
|
setVimEnabled(enabled);
|
|
355682
355662
|
if (enabled) {
|
|
355683
355663
|
setVimMode("NORMAL");
|
|
355684
355664
|
}
|
|
355685
355665
|
}, [settings.merged.general?.vimMode]);
|
|
355686
|
-
const toggleVimEnabled = (0,
|
|
355666
|
+
const toggleVimEnabled = (0, import_react74.useCallback)(async () => {
|
|
355687
355667
|
const newValue = !vimEnabled;
|
|
355688
355668
|
setVimEnabled(newValue);
|
|
355689
355669
|
if (newValue) {
|
|
@@ -355701,7 +355681,7 @@ var VimModeProvider = /* @__PURE__ */ __name(({
|
|
|
355701
355681
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(VimModeContext.Provider, { value, children });
|
|
355702
355682
|
}, "VimModeProvider");
|
|
355703
355683
|
var useVimMode = /* @__PURE__ */ __name(() => {
|
|
355704
|
-
const context2 = (0,
|
|
355684
|
+
const context2 = (0, import_react74.useContext)(VimModeContext);
|
|
355705
355685
|
if (context2 === void 0) {
|
|
355706
355686
|
throw new Error("useVimMode must be used within a VimModeProvider");
|
|
355707
355687
|
}
|
|
@@ -355722,27 +355702,27 @@ function SettingsDialog({
|
|
|
355722
355702
|
config
|
|
355723
355703
|
}) {
|
|
355724
355704
|
const { vimEnabled, toggleVimEnabled } = useVimMode();
|
|
355725
|
-
const [focusSection, setFocusSection] = (0,
|
|
355705
|
+
const [focusSection, setFocusSection] = (0, import_react75.useState)(
|
|
355726
355706
|
"settings"
|
|
355727
355707
|
);
|
|
355728
|
-
const [selectedScope, setSelectedScope] = (0,
|
|
355708
|
+
const [selectedScope, setSelectedScope] = (0, import_react75.useState)(
|
|
355729
355709
|
"User" /* User */
|
|
355730
355710
|
);
|
|
355731
|
-
const [activeSettingIndex, setActiveSettingIndex] = (0,
|
|
355732
|
-
const [scrollOffset, setScrollOffset] = (0,
|
|
355733
|
-
const [showRestartPrompt, setShowRestartPrompt] = (0,
|
|
355734
|
-
const [pendingSettings, setPendingSettings] = (0,
|
|
355711
|
+
const [activeSettingIndex, setActiveSettingIndex] = (0, import_react75.useState)(0);
|
|
355712
|
+
const [scrollOffset, setScrollOffset] = (0, import_react75.useState)(0);
|
|
355713
|
+
const [showRestartPrompt, setShowRestartPrompt] = (0, import_react75.useState)(false);
|
|
355714
|
+
const [pendingSettings, setPendingSettings] = (0, import_react75.useState)(
|
|
355735
355715
|
() => (
|
|
355736
355716
|
// Deep clone to avoid mutation
|
|
355737
355717
|
structuredClone(settings.forScope(selectedScope).settings)
|
|
355738
355718
|
)
|
|
355739
355719
|
);
|
|
355740
|
-
const [modifiedSettings, setModifiedSettings] = (0,
|
|
355720
|
+
const [modifiedSettings, setModifiedSettings] = (0, import_react75.useState)(
|
|
355741
355721
|
/* @__PURE__ */ new Set()
|
|
355742
355722
|
);
|
|
355743
|
-
const [globalPendingChanges, setGlobalPendingChanges] = (0,
|
|
355744
|
-
const [_restartRequiredSettings, setRestartRequiredSettings] = (0,
|
|
355745
|
-
(0,
|
|
355723
|
+
const [globalPendingChanges, setGlobalPendingChanges] = (0, import_react75.useState)(/* @__PURE__ */ new Map());
|
|
355724
|
+
const [_restartRequiredSettings, setRestartRequiredSettings] = (0, import_react75.useState)(/* @__PURE__ */ new Set());
|
|
355725
|
+
(0, import_react75.useEffect)(() => {
|
|
355746
355726
|
let updated = structuredClone(settings.forScope(selectedScope).settings);
|
|
355747
355727
|
const newModified = /* @__PURE__ */ new Set();
|
|
355748
355728
|
const newRestartRequired = /* @__PURE__ */ new Set();
|
|
@@ -355877,11 +355857,11 @@ function SettingsDialog({
|
|
|
355877
355857
|
});
|
|
355878
355858
|
}, "generateSettingsItems");
|
|
355879
355859
|
const items = generateSettingsItems();
|
|
355880
|
-
const [editingKey, setEditingKey] = (0,
|
|
355881
|
-
const [editBuffer, setEditBuffer] = (0,
|
|
355882
|
-
const [editCursorPos, setEditCursorPos] = (0,
|
|
355883
|
-
const [cursorVisible, setCursorVisible] = (0,
|
|
355884
|
-
(0,
|
|
355860
|
+
const [editingKey, setEditingKey] = (0, import_react75.useState)(null);
|
|
355861
|
+
const [editBuffer, setEditBuffer] = (0, import_react75.useState)("");
|
|
355862
|
+
const [editCursorPos, setEditCursorPos] = (0, import_react75.useState)(0);
|
|
355863
|
+
const [cursorVisible, setCursorVisible] = (0, import_react75.useState)(true);
|
|
355864
|
+
(0, import_react75.useEffect)(() => {
|
|
355885
355865
|
if (!editingKey) {
|
|
355886
355866
|
setCursorVisible(true);
|
|
355887
355867
|
return;
|
|
@@ -356018,7 +355998,7 @@ function SettingsDialog({
|
|
|
356018
355998
|
maxVisibleItems = Math.max(1, Math.floor(availableHeightForSettings / 2));
|
|
356019
355999
|
}
|
|
356020
356000
|
const effectiveMaxItemsToShow = availableTerminalHeight ? Math.min(maxVisibleItems, items.length) : maxItemsToShow;
|
|
356021
|
-
|
|
356001
|
+
import_react75.default.useEffect(() => {
|
|
356022
356002
|
if (!showScopeSelection && focusSection === "scope") {
|
|
356023
356003
|
setFocusSection("settings");
|
|
356024
356004
|
}
|
|
@@ -356326,7 +356306,7 @@ function SettingsDialog({
|
|
|
356326
356306
|
selectedScope,
|
|
356327
356307
|
settings
|
|
356328
356308
|
);
|
|
356329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
356309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react75.default.Fragment, { children: [
|
|
356330
356310
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Box_default, { flexDirection: "row", alignItems: "center", children: [
|
|
356331
356311
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box_default, { minWidth: 2, flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
356332
356312
|
Text3,
|
|
@@ -356386,7 +356366,7 @@ __name(SettingsDialog, "SettingsDialog");
|
|
|
356386
356366
|
|
|
356387
356367
|
// packages/cli/src/ui/components/QwenOAuthProgress.tsx
|
|
356388
356368
|
init_esbuild_shims();
|
|
356389
|
-
var
|
|
356369
|
+
var import_react76 = __toESM(require_react(), 1);
|
|
356390
356370
|
var import_qrcode_terminal = __toESM(require_main2(), 1);
|
|
356391
356371
|
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
356392
356372
|
function QrCodeDisplay({
|
|
@@ -356460,9 +356440,9 @@ function QwenOAuthProgress({
|
|
|
356460
356440
|
authMessage
|
|
356461
356441
|
}) {
|
|
356462
356442
|
const defaultTimeout = deviceAuth?.expires_in || 300;
|
|
356463
|
-
const [timeRemaining, setTimeRemaining] = (0,
|
|
356464
|
-
const [dots, setDots] = (0,
|
|
356465
|
-
const [qrCodeData, setQrCodeData] = (0,
|
|
356443
|
+
const [timeRemaining, setTimeRemaining] = (0, import_react76.useState)(defaultTimeout);
|
|
356444
|
+
const [dots, setDots] = (0, import_react76.useState)("");
|
|
356445
|
+
const [qrCodeData, setQrCodeData] = (0, import_react76.useState)(null);
|
|
356466
356446
|
useKeypress(
|
|
356467
356447
|
(key) => {
|
|
356468
356448
|
if (authStatus === "timeout" || authStatus === "error") {
|
|
@@ -356473,7 +356453,7 @@ function QwenOAuthProgress({
|
|
|
356473
356453
|
},
|
|
356474
356454
|
{ isActive: true }
|
|
356475
356455
|
);
|
|
356476
|
-
(0,
|
|
356456
|
+
(0, import_react76.useEffect)(() => {
|
|
356477
356457
|
if (!deviceAuth?.verification_uri_complete) {
|
|
356478
356458
|
return;
|
|
356479
356459
|
}
|
|
@@ -356493,7 +356473,7 @@ function QwenOAuthProgress({
|
|
|
356493
356473
|
}, "generateQR");
|
|
356494
356474
|
generateQR();
|
|
356495
356475
|
}, [deviceAuth?.verification_uri_complete]);
|
|
356496
|
-
(0,
|
|
356476
|
+
(0, import_react76.useEffect)(() => {
|
|
356497
356477
|
const timer = setInterval(() => {
|
|
356498
356478
|
setTimeRemaining((prev) => {
|
|
356499
356479
|
if (prev <= 1) {
|
|
@@ -356505,7 +356485,7 @@ function QwenOAuthProgress({
|
|
|
356505
356485
|
}, 1e3);
|
|
356506
356486
|
return () => clearInterval(timer);
|
|
356507
356487
|
}, [onTimeout]);
|
|
356508
|
-
(0,
|
|
356488
|
+
(0, import_react76.useEffect)(() => {
|
|
356509
356489
|
const dotsTimer = setInterval(() => {
|
|
356510
356490
|
setDots((prev) => {
|
|
356511
356491
|
if (prev.length >= 3) return "";
|
|
@@ -356514,7 +356494,7 @@ function QwenOAuthProgress({
|
|
|
356514
356494
|
}, 500);
|
|
356515
356495
|
return () => clearInterval(dotsTimer);
|
|
356516
356496
|
}, []);
|
|
356517
|
-
const qrCodeDisplay = (0,
|
|
356497
|
+
const qrCodeDisplay = (0, import_react76.useMemo)(() => {
|
|
356518
356498
|
if (!deviceAuth?.verification_uri_complete) return null;
|
|
356519
356499
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
356520
356500
|
QrCodeDisplay,
|
|
@@ -356600,13 +356580,13 @@ __name(QwenOAuthProgress, "QwenOAuthProgress");
|
|
|
356600
356580
|
|
|
356601
356581
|
// packages/cli/src/ui/auth/AuthDialog.tsx
|
|
356602
356582
|
init_esbuild_shims();
|
|
356603
|
-
var
|
|
356583
|
+
var import_react79 = __toESM(require_react(), 1);
|
|
356604
356584
|
init_core2();
|
|
356605
356585
|
init_settings();
|
|
356606
356586
|
|
|
356607
356587
|
// packages/cli/src/ui/contexts/UIActionsContext.tsx
|
|
356608
356588
|
init_esbuild_shims();
|
|
356609
|
-
var
|
|
356589
|
+
var import_react78 = __toESM(require_react(), 1);
|
|
356610
356590
|
init_core2();
|
|
356611
356591
|
init_settings();
|
|
356612
356592
|
|
|
@@ -356676,7 +356656,7 @@ var ModelSwitchDialog = /* @__PURE__ */ __name(({
|
|
|
356676
356656
|
|
|
356677
356657
|
// packages/cli/src/ui/components/OpenAIKeyPrompt.tsx
|
|
356678
356658
|
init_esbuild_shims();
|
|
356679
|
-
var
|
|
356659
|
+
var import_react77 = __toESM(require_react(), 1);
|
|
356680
356660
|
init_zod();
|
|
356681
356661
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
356682
356662
|
var credentialSchema = external_exports.object({
|
|
@@ -356691,11 +356671,11 @@ function OpenAIKeyPrompt({
|
|
|
356691
356671
|
defaultBaseUrl,
|
|
356692
356672
|
defaultModel
|
|
356693
356673
|
}) {
|
|
356694
|
-
const [apiKey, setApiKey] = (0,
|
|
356695
|
-
const [baseUrl, setBaseUrl] = (0,
|
|
356696
|
-
const [model, setModel] = (0,
|
|
356697
|
-
const [currentField, setCurrentField] = (0,
|
|
356698
|
-
const [validationError, setValidationError] = (0,
|
|
356674
|
+
const [apiKey, setApiKey] = (0, import_react77.useState)(defaultApiKey || "");
|
|
356675
|
+
const [baseUrl, setBaseUrl] = (0, import_react77.useState)(defaultBaseUrl || "");
|
|
356676
|
+
const [model, setModel] = (0, import_react77.useState)(defaultModel || "");
|
|
356677
|
+
const [currentField, setCurrentField] = (0, import_react77.useState)("apiKey");
|
|
356678
|
+
const [validationError, setValidationError] = (0, import_react77.useState)(null);
|
|
356699
356679
|
const validateAndSubmit = /* @__PURE__ */ __name(() => {
|
|
356700
356680
|
setValidationError(null);
|
|
356701
356681
|
try {
|
|
@@ -356872,9 +356852,9 @@ function OpenAIKeyPrompt({
|
|
|
356872
356852
|
__name(OpenAIKeyPrompt, "OpenAIKeyPrompt");
|
|
356873
356853
|
|
|
356874
356854
|
// packages/cli/src/ui/contexts/UIActionsContext.tsx
|
|
356875
|
-
var UIActionsContext = (0,
|
|
356855
|
+
var UIActionsContext = (0, import_react78.createContext)(null);
|
|
356876
356856
|
var useUIActions = /* @__PURE__ */ __name(() => {
|
|
356877
|
-
const context2 = (0,
|
|
356857
|
+
const context2 = (0, import_react78.useContext)(UIActionsContext);
|
|
356878
356858
|
if (!context2) {
|
|
356879
356859
|
throw new Error("useUIActions must be used within a UIActionsProvider");
|
|
356880
356860
|
}
|
|
@@ -356894,8 +356874,8 @@ function AuthDialog() {
|
|
|
356894
356874
|
const { pendingAuthType, authError } = useUIState();
|
|
356895
356875
|
const { handleAuthSelect: onAuthSelect } = useUIActions();
|
|
356896
356876
|
const settings = useSettings();
|
|
356897
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
356898
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
356877
|
+
const [errorMessage, setErrorMessage] = (0, import_react79.useState)(null);
|
|
356878
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react79.useState)(null);
|
|
356899
356879
|
const items = [
|
|
356900
356880
|
{
|
|
356901
356881
|
key: "xhs-sso" /* XHS_SSO */,
|
|
@@ -356995,7 +356975,7 @@ __name(AuthDialog, "AuthDialog");
|
|
|
356995
356975
|
|
|
356996
356976
|
// packages/cli/src/ui/components/EditorSettingsDialog.tsx
|
|
356997
356977
|
init_esbuild_shims();
|
|
356998
|
-
var
|
|
356978
|
+
var import_react80 = __toESM(require_react(), 1);
|
|
356999
356979
|
|
|
357000
356980
|
// packages/cli/src/ui/editors/editorSettingsManager.ts
|
|
357001
356981
|
init_esbuild_shims();
|
|
@@ -357054,10 +357034,10 @@ function EditorSettingsDialog({
|
|
|
357054
357034
|
settings,
|
|
357055
357035
|
onExit
|
|
357056
357036
|
}) {
|
|
357057
|
-
const [selectedScope, setSelectedScope] = (0,
|
|
357037
|
+
const [selectedScope, setSelectedScope] = (0, import_react80.useState)(
|
|
357058
357038
|
"User" /* User */
|
|
357059
357039
|
);
|
|
357060
|
-
const [focusedSection, setFocusedSection] = (0,
|
|
357040
|
+
const [focusedSection, setFocusedSection] = (0, import_react80.useState)(
|
|
357061
357041
|
"editor"
|
|
357062
357042
|
);
|
|
357063
357043
|
useKeypress(
|
|
@@ -357192,12 +357172,12 @@ __name(EditorSettingsDialog, "EditorSettingsDialog");
|
|
|
357192
357172
|
// packages/cli/src/ui/components/WorkspaceMigrationDialog.tsx
|
|
357193
357173
|
init_esbuild_shims();
|
|
357194
357174
|
init_extension();
|
|
357195
|
-
var
|
|
357175
|
+
var import_react81 = __toESM(require_react(), 1);
|
|
357196
357176
|
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
|
|
357197
357177
|
function WorkspaceMigrationDialog(props) {
|
|
357198
357178
|
const { workspaceExtensions, onOpen, onClose } = props;
|
|
357199
|
-
const [migrationComplete, setMigrationComplete] = (0,
|
|
357200
|
-
const [failedExtensions, setFailedExtensions] = (0,
|
|
357179
|
+
const [migrationComplete, setMigrationComplete] = (0, import_react81.useState)(false);
|
|
357180
|
+
const [failedExtensions, setFailedExtensions] = (0, import_react81.useState)([]);
|
|
357201
357181
|
onOpen();
|
|
357202
357182
|
const onMigrate = /* @__PURE__ */ __name(async () => {
|
|
357203
357183
|
const failed = await performWorkspaceExtensionMigration(
|
|
@@ -357318,7 +357298,7 @@ init_trustedFolders();
|
|
|
357318
357298
|
|
|
357319
357299
|
// packages/cli/src/ui/hooks/usePermissionsModifyTrust.ts
|
|
357320
357300
|
init_esbuild_shims();
|
|
357321
|
-
var
|
|
357301
|
+
var import_react82 = __toESM(require_react(), 1);
|
|
357322
357302
|
init_trustedFolders();
|
|
357323
357303
|
import * as process32 from "node:process";
|
|
357324
357304
|
function getInitialTrustState(settings, cwd7) {
|
|
@@ -357336,20 +357316,20 @@ __name(getInitialTrustState, "getInitialTrustState");
|
|
|
357336
357316
|
var usePermissionsModifyTrust = /* @__PURE__ */ __name((onExit, addItem) => {
|
|
357337
357317
|
const settings = useSettings();
|
|
357338
357318
|
const cwd7 = process32.cwd();
|
|
357339
|
-
const [initialState2] = (0,
|
|
357340
|
-
const [currentTrustLevel] = (0,
|
|
357319
|
+
const [initialState2] = (0, import_react82.useState)(() => getInitialTrustState(settings, cwd7));
|
|
357320
|
+
const [currentTrustLevel] = (0, import_react82.useState)(
|
|
357341
357321
|
initialState2.currentTrustLevel
|
|
357342
357322
|
);
|
|
357343
|
-
const [pendingTrustLevel, setPendingTrustLevel] = (0,
|
|
357344
|
-
const [isInheritedTrustFromParent] = (0,
|
|
357323
|
+
const [pendingTrustLevel, setPendingTrustLevel] = (0, import_react82.useState)();
|
|
357324
|
+
const [isInheritedTrustFromParent] = (0, import_react82.useState)(
|
|
357345
357325
|
initialState2.isInheritedTrustFromParent
|
|
357346
357326
|
);
|
|
357347
|
-
const [isInheritedTrustFromIde] = (0,
|
|
357327
|
+
const [isInheritedTrustFromIde] = (0, import_react82.useState)(
|
|
357348
357328
|
initialState2.isInheritedTrustFromIde
|
|
357349
357329
|
);
|
|
357350
|
-
const [needsRestart, setNeedsRestart] = (0,
|
|
357330
|
+
const [needsRestart, setNeedsRestart] = (0, import_react82.useState)(false);
|
|
357351
357331
|
const isFolderTrustEnabled2 = !!settings.merged.security?.folderTrust?.enabled;
|
|
357352
|
-
const updateTrustLevel = (0,
|
|
357332
|
+
const updateTrustLevel = (0, import_react82.useCallback)(
|
|
357353
357333
|
(trustLevel) => {
|
|
357354
357334
|
const wasTrusted = isWorkspaceTrusted(settings.merged).isTrusted;
|
|
357355
357335
|
const currentConfig = loadTrustedFolders().user.config;
|
|
@@ -357382,7 +357362,7 @@ var usePermissionsModifyTrust = /* @__PURE__ */ __name((onExit, addItem) => {
|
|
|
357382
357362
|
},
|
|
357383
357363
|
[cwd7, settings.merged, onExit, addItem]
|
|
357384
357364
|
);
|
|
357385
|
-
const commitTrustLevelChange = (0,
|
|
357365
|
+
const commitTrustLevelChange = (0, import_react82.useCallback)(() => {
|
|
357386
357366
|
if (pendingTrustLevel) {
|
|
357387
357367
|
const folders = loadTrustedFolders();
|
|
357388
357368
|
folders.setValue(cwd7, pendingTrustLevel);
|
|
@@ -357495,7 +357475,7 @@ __name(PermissionsModifyTrustDialog, "PermissionsModifyTrustDialog");
|
|
|
357495
357475
|
|
|
357496
357476
|
// packages/cli/src/ui/components/ModelDialog.tsx
|
|
357497
357477
|
init_esbuild_shims();
|
|
357498
|
-
var
|
|
357478
|
+
var import_react84 = __toESM(require_react(), 1);
|
|
357499
357479
|
|
|
357500
357480
|
// packages/cli/src/ui/components/shared/DescriptiveRadioButtonSelect.tsx
|
|
357501
357481
|
init_esbuild_shims();
|
|
@@ -357532,7 +357512,7 @@ __name(DescriptiveRadioButtonSelect, "DescriptiveRadioButtonSelect");
|
|
|
357532
357512
|
|
|
357533
357513
|
// packages/cli/src/ui/components/XhsSsoModelConfigFlow.tsx
|
|
357534
357514
|
init_esbuild_shims();
|
|
357535
|
-
var
|
|
357515
|
+
var import_react83 = __toESM(require_react(), 1);
|
|
357536
357516
|
|
|
357537
357517
|
// packages/cli/src/config/xhsSsoProviders.ts
|
|
357538
357518
|
init_esbuild_shims();
|
|
@@ -357568,9 +357548,9 @@ function XhsSsoModelConfigFlow({
|
|
|
357568
357548
|
onCancel,
|
|
357569
357549
|
rdmindSsoId
|
|
357570
357550
|
}) {
|
|
357571
|
-
const config = (0,
|
|
357572
|
-
const [isLoading, setIsLoading] = (0,
|
|
357573
|
-
const [error, setError] = (0,
|
|
357551
|
+
const config = (0, import_react83.useContext)(ConfigContext);
|
|
357552
|
+
const [isLoading, setIsLoading] = (0, import_react83.useState)(false);
|
|
357553
|
+
const [error, setError] = (0, import_react83.useState)(null);
|
|
357574
357554
|
useKeypress(
|
|
357575
357555
|
(key) => {
|
|
357576
357556
|
if (key.name === "escape" && !isLoading) {
|
|
@@ -357579,7 +357559,7 @@ function XhsSsoModelConfigFlow({
|
|
|
357579
357559
|
},
|
|
357580
357560
|
{ isActive: true }
|
|
357581
357561
|
);
|
|
357582
|
-
const modelItems = (0,
|
|
357562
|
+
const modelItems = (0, import_react83.useMemo)(
|
|
357583
357563
|
() => XHS_SSO_MODELS.map((model) => ({
|
|
357584
357564
|
key: model.id,
|
|
357585
357565
|
value: model,
|
|
@@ -357589,7 +357569,7 @@ function XhsSsoModelConfigFlow({
|
|
|
357589
357569
|
[]
|
|
357590
357570
|
);
|
|
357591
357571
|
const currentModel = config?.getModel();
|
|
357592
|
-
const initialIndex = (0,
|
|
357572
|
+
const initialIndex = (0, import_react83.useMemo)(() => {
|
|
357593
357573
|
if (!currentModel) {
|
|
357594
357574
|
return 0;
|
|
357595
357575
|
}
|
|
@@ -357679,14 +357659,14 @@ init_settings();
|
|
|
357679
357659
|
init_core2();
|
|
357680
357660
|
var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
|
|
357681
357661
|
function ModelDialog({ onClose }) {
|
|
357682
|
-
const config = (0,
|
|
357683
|
-
const settings = (0,
|
|
357662
|
+
const config = (0, import_react84.useContext)(ConfigContext);
|
|
357663
|
+
const settings = (0, import_react84.useContext)(SettingsContext);
|
|
357684
357664
|
const authType = config?.getAuthType() ?? "qwen-oauth" /* QWEN_OAUTH */;
|
|
357685
|
-
const availableModels = (0,
|
|
357665
|
+
const availableModels = (0, import_react84.useMemo)(
|
|
357686
357666
|
() => getAvailableModelsForAuthType(authType),
|
|
357687
357667
|
[authType]
|
|
357688
357668
|
);
|
|
357689
|
-
const MODEL_OPTIONS = (0,
|
|
357669
|
+
const MODEL_OPTIONS = (0, import_react84.useMemo)(
|
|
357690
357670
|
() => availableModels.map((model) => ({
|
|
357691
357671
|
value: model.id,
|
|
357692
357672
|
title: model.label,
|
|
@@ -357696,11 +357676,11 @@ function ModelDialog({ onClose }) {
|
|
|
357696
357676
|
[availableModels]
|
|
357697
357677
|
);
|
|
357698
357678
|
const preferredModel = config?.getModel() || MAINLINE_CODER;
|
|
357699
|
-
const initialIndex = (0,
|
|
357679
|
+
const initialIndex = (0, import_react84.useMemo)(
|
|
357700
357680
|
() => MODEL_OPTIONS.findIndex((option2) => option2.value === preferredModel),
|
|
357701
357681
|
[MODEL_OPTIONS, preferredModel]
|
|
357702
357682
|
);
|
|
357703
|
-
const handleSelect = (0,
|
|
357683
|
+
const handleSelect = (0, import_react84.useCallback)(
|
|
357704
357684
|
(model) => {
|
|
357705
357685
|
if (config) {
|
|
357706
357686
|
config.setModel(model);
|
|
@@ -357719,7 +357699,7 @@ function ModelDialog({ onClose }) {
|
|
|
357719
357699
|
},
|
|
357720
357700
|
{ isActive: true }
|
|
357721
357701
|
);
|
|
357722
|
-
const handleOpenAIConfigSubmit = (0,
|
|
357702
|
+
const handleOpenAIConfigSubmit = (0, import_react84.useCallback)(
|
|
357723
357703
|
async (apiKey, baseUrl, model) => {
|
|
357724
357704
|
if (config && settings) {
|
|
357725
357705
|
config.updateCredentials({
|
|
@@ -357744,7 +357724,7 @@ function ModelDialog({ onClose }) {
|
|
|
357744
357724
|
},
|
|
357745
357725
|
[config, settings, onClose]
|
|
357746
357726
|
);
|
|
357747
|
-
const handleXhsSsoConfigComplete = (0,
|
|
357727
|
+
const handleXhsSsoConfigComplete = (0, import_react84.useCallback)(
|
|
357748
357728
|
async (xhsSsoConfig) => {
|
|
357749
357729
|
if (config && settings) {
|
|
357750
357730
|
config.updateCredentials({
|
|
@@ -357816,7 +357796,7 @@ __name(ModelDialog, "ModelDialog");
|
|
|
357816
357796
|
|
|
357817
357797
|
// packages/cli/src/ui/components/ApprovalModeDialog.tsx
|
|
357818
357798
|
init_esbuild_shims();
|
|
357819
|
-
var
|
|
357799
|
+
var import_react85 = __toESM(require_react(), 1);
|
|
357820
357800
|
init_core2();
|
|
357821
357801
|
init_settings();
|
|
357822
357802
|
var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -357840,10 +357820,10 @@ function ApprovalModeDialog({
|
|
|
357840
357820
|
currentMode,
|
|
357841
357821
|
availableTerminalHeight: _availableTerminalHeight
|
|
357842
357822
|
}) {
|
|
357843
|
-
const [selectedScope, setSelectedScope] = (0,
|
|
357823
|
+
const [selectedScope, setSelectedScope] = (0, import_react85.useState)(
|
|
357844
357824
|
"User" /* User */
|
|
357845
357825
|
);
|
|
357846
|
-
const [highlightedMode, setHighlightedMode] = (0,
|
|
357826
|
+
const [highlightedMode, setHighlightedMode] = (0, import_react85.useState)(
|
|
357847
357827
|
currentMode || "default" /* DEFAULT */
|
|
357848
357828
|
);
|
|
357849
357829
|
const modeItems = APPROVAL_MODES.map((mode) => ({
|
|
@@ -357855,7 +357835,7 @@ function ApprovalModeDialog({
|
|
|
357855
357835
|
(item) => item.value === highlightedMode
|
|
357856
357836
|
);
|
|
357857
357837
|
const safeInitialModeIndex = initialModeIndex >= 0 ? initialModeIndex : 0;
|
|
357858
|
-
const handleModeSelect = (0,
|
|
357838
|
+
const handleModeSelect = (0, import_react85.useCallback)(
|
|
357859
357839
|
(mode) => {
|
|
357860
357840
|
onSelect(mode, selectedScope);
|
|
357861
357841
|
},
|
|
@@ -357864,16 +357844,16 @@ function ApprovalModeDialog({
|
|
|
357864
357844
|
const handleModeHighlight = /* @__PURE__ */ __name((mode) => {
|
|
357865
357845
|
setHighlightedMode(mode);
|
|
357866
357846
|
}, "handleModeHighlight");
|
|
357867
|
-
const handleScopeHighlight = (0,
|
|
357847
|
+
const handleScopeHighlight = (0, import_react85.useCallback)((scope) => {
|
|
357868
357848
|
setSelectedScope(scope);
|
|
357869
357849
|
}, []);
|
|
357870
|
-
const handleScopeSelect = (0,
|
|
357850
|
+
const handleScopeSelect = (0, import_react85.useCallback)(
|
|
357871
357851
|
(scope) => {
|
|
357872
357852
|
onSelect(highlightedMode, scope);
|
|
357873
357853
|
},
|
|
357874
357854
|
[onSelect, highlightedMode]
|
|
357875
357855
|
);
|
|
357876
|
-
const [focusSection, setFocusSection] = (0,
|
|
357856
|
+
const [focusSection, setFocusSection] = (0, import_react85.useState)("mode");
|
|
357877
357857
|
useKeypress(
|
|
357878
357858
|
(key) => {
|
|
357879
357859
|
if (key.name === "tab") {
|
|
@@ -358382,7 +358362,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
358382
358362
|
|
|
358383
358363
|
// packages/cli/src/ui/components/Composer.tsx
|
|
358384
358364
|
init_esbuild_shims();
|
|
358385
|
-
var
|
|
358365
|
+
var import_react99 = __toESM(require_react(), 1);
|
|
358386
358366
|
|
|
358387
358367
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
358388
358368
|
init_esbuild_shims();
|
|
@@ -358644,14 +358624,14 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
358644
358624
|
|
|
358645
358625
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
358646
358626
|
init_esbuild_shims();
|
|
358647
|
-
var
|
|
358627
|
+
var import_react95 = __toESM(require_react(), 1);
|
|
358648
358628
|
|
|
358649
358629
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
358650
358630
|
init_esbuild_shims();
|
|
358651
358631
|
|
|
358652
358632
|
// packages/cli/src/ui/components/PrepareLabel.tsx
|
|
358653
358633
|
init_esbuild_shims();
|
|
358654
|
-
var
|
|
358634
|
+
var import_react86 = __toESM(require_react(), 1);
|
|
358655
358635
|
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
358656
358636
|
var MAX_WIDTH = 150;
|
|
358657
358637
|
var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
@@ -358717,7 +358697,7 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
358717
358697
|
after
|
|
358718
358698
|
] });
|
|
358719
358699
|
}, "_PrepareLabel");
|
|
358720
|
-
var PrepareLabel =
|
|
358700
|
+
var PrepareLabel = import_react86.default.memo(_PrepareLabel);
|
|
358721
358701
|
|
|
358722
358702
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
358723
358703
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -358796,7 +358776,7 @@ __name(SuggestionsDisplay, "SuggestionsDisplay");
|
|
|
358796
358776
|
|
|
358797
358777
|
// packages/cli/src/ui/hooks/useInputHistory.ts
|
|
358798
358778
|
init_esbuild_shims();
|
|
358799
|
-
var
|
|
358779
|
+
var import_react87 = __toESM(require_react(), 1);
|
|
358800
358780
|
function useInputHistory({
|
|
358801
358781
|
userMessages,
|
|
358802
358782
|
onSubmit,
|
|
@@ -358804,13 +358784,13 @@ function useInputHistory({
|
|
|
358804
358784
|
currentQuery,
|
|
358805
358785
|
onChange
|
|
358806
358786
|
}) {
|
|
358807
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
358808
|
-
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = (0,
|
|
358809
|
-
const resetHistoryNav = (0,
|
|
358787
|
+
const [historyIndex, setHistoryIndex] = (0, import_react87.useState)(-1);
|
|
358788
|
+
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = (0, import_react87.useState)("");
|
|
358789
|
+
const resetHistoryNav = (0, import_react87.useCallback)(() => {
|
|
358810
358790
|
setHistoryIndex(-1);
|
|
358811
358791
|
setOriginalQueryBeforeNav("");
|
|
358812
358792
|
}, []);
|
|
358813
|
-
const handleSubmit = (0,
|
|
358793
|
+
const handleSubmit = (0, import_react87.useCallback)(
|
|
358814
358794
|
(value) => {
|
|
358815
358795
|
const trimmedValue = value.trim();
|
|
358816
358796
|
if (trimmedValue) {
|
|
@@ -358820,7 +358800,7 @@ function useInputHistory({
|
|
|
358820
358800
|
},
|
|
358821
358801
|
[onSubmit, resetHistoryNav]
|
|
358822
358802
|
);
|
|
358823
|
-
const navigateUp = (0,
|
|
358803
|
+
const navigateUp = (0, import_react87.useCallback)(() => {
|
|
358824
358804
|
if (!isActive) return false;
|
|
358825
358805
|
if (userMessages.length === 0) return false;
|
|
358826
358806
|
let nextIndex = historyIndex;
|
|
@@ -358849,7 +358829,7 @@ function useInputHistory({
|
|
|
358849
358829
|
// Use currentQuery from props
|
|
358850
358830
|
setOriginalQueryBeforeNav
|
|
358851
358831
|
]);
|
|
358852
|
-
const navigateDown = (0,
|
|
358832
|
+
const navigateDown = (0, import_react87.useCallback)(() => {
|
|
358853
358833
|
if (!isActive) return false;
|
|
358854
358834
|
if (historyIndex === -1) return false;
|
|
358855
358835
|
const nextIndex = historyIndex - 1;
|
|
@@ -358882,7 +358862,7 @@ var import_chalk7 = __toESM(require_source(), 1);
|
|
|
358882
358862
|
|
|
358883
358863
|
// packages/cli/src/ui/hooks/useShellHistory.ts
|
|
358884
358864
|
init_esbuild_shims();
|
|
358885
|
-
var
|
|
358865
|
+
var import_react88 = __toESM(require_react(), 1);
|
|
358886
358866
|
init_core2();
|
|
358887
358867
|
import * as fs89 from "node:fs/promises";
|
|
358888
358868
|
import * as path98 from "node:path";
|
|
@@ -358927,10 +358907,10 @@ async function writeHistoryFile(filePath, history) {
|
|
|
358927
358907
|
}
|
|
358928
358908
|
__name(writeHistoryFile, "writeHistoryFile");
|
|
358929
358909
|
function useShellHistory(projectRoot, storage) {
|
|
358930
|
-
const [history, setHistory] = (0,
|
|
358931
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
358932
|
-
const [historyFilePath, setHistoryFilePath] = (0,
|
|
358933
|
-
(0,
|
|
358910
|
+
const [history, setHistory] = (0, import_react88.useState)([]);
|
|
358911
|
+
const [historyIndex, setHistoryIndex] = (0, import_react88.useState)(-1);
|
|
358912
|
+
const [historyFilePath, setHistoryFilePath] = (0, import_react88.useState)(null);
|
|
358913
|
+
(0, import_react88.useEffect)(() => {
|
|
358934
358914
|
async function loadHistory() {
|
|
358935
358915
|
const filePath = await getHistoryFilePath(projectRoot, storage);
|
|
358936
358916
|
setHistoryFilePath(filePath);
|
|
@@ -358940,7 +358920,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
358940
358920
|
__name(loadHistory, "loadHistory");
|
|
358941
358921
|
loadHistory();
|
|
358942
358922
|
}, [projectRoot, storage]);
|
|
358943
|
-
const addCommandToHistory = (0,
|
|
358923
|
+
const addCommandToHistory = (0, import_react88.useCallback)(
|
|
358944
358924
|
(command2) => {
|
|
358945
358925
|
if (!command2.trim() || !historyFilePath) {
|
|
358946
358926
|
return;
|
|
@@ -358952,7 +358932,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
358952
358932
|
},
|
|
358953
358933
|
[history, historyFilePath]
|
|
358954
358934
|
);
|
|
358955
|
-
const getPreviousCommand = (0,
|
|
358935
|
+
const getPreviousCommand = (0, import_react88.useCallback)(() => {
|
|
358956
358936
|
if (history.length === 0) {
|
|
358957
358937
|
return null;
|
|
358958
358938
|
}
|
|
@@ -358960,7 +358940,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
358960
358940
|
setHistoryIndex(newIndex);
|
|
358961
358941
|
return history[newIndex] ?? null;
|
|
358962
358942
|
}, [history, historyIndex]);
|
|
358963
|
-
const getNextCommand = (0,
|
|
358943
|
+
const getNextCommand = (0, import_react88.useCallback)(() => {
|
|
358964
358944
|
if (historyIndex < 0) {
|
|
358965
358945
|
return null;
|
|
358966
358946
|
}
|
|
@@ -358971,7 +358951,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
358971
358951
|
}
|
|
358972
358952
|
return history[newIndex] ?? null;
|
|
358973
358953
|
}, [history, historyIndex]);
|
|
358974
|
-
const resetHistoryPosition = (0,
|
|
358954
|
+
const resetHistoryPosition = (0, import_react88.useCallback)(() => {
|
|
358975
358955
|
setHistoryIndex(-1);
|
|
358976
358956
|
}, []);
|
|
358977
358957
|
return {
|
|
@@ -358986,19 +358966,19 @@ __name(useShellHistory, "useShellHistory");
|
|
|
358986
358966
|
|
|
358987
358967
|
// packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx
|
|
358988
358968
|
init_esbuild_shims();
|
|
358989
|
-
var
|
|
358969
|
+
var import_react90 = __toESM(require_react(), 1);
|
|
358990
358970
|
|
|
358991
358971
|
// packages/cli/src/ui/hooks/useCompletion.ts
|
|
358992
358972
|
init_esbuild_shims();
|
|
358993
|
-
var
|
|
358973
|
+
var import_react89 = __toESM(require_react(), 1);
|
|
358994
358974
|
function useCompletion() {
|
|
358995
|
-
const [suggestions, setSuggestions] = (0,
|
|
358996
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] = (0,
|
|
358997
|
-
const [visibleStartIndex, setVisibleStartIndex] = (0,
|
|
358998
|
-
const [showSuggestions, setShowSuggestions] = (0,
|
|
358999
|
-
const [isLoadingSuggestions, setIsLoadingSuggestions] = (0,
|
|
359000
|
-
const [isPerfectMatch, setIsPerfectMatch] = (0,
|
|
359001
|
-
const resetCompletionState = (0,
|
|
358975
|
+
const [suggestions, setSuggestions] = (0, import_react89.useState)([]);
|
|
358976
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = (0, import_react89.useState)(-1);
|
|
358977
|
+
const [visibleStartIndex, setVisibleStartIndex] = (0, import_react89.useState)(0);
|
|
358978
|
+
const [showSuggestions, setShowSuggestions] = (0, import_react89.useState)(false);
|
|
358979
|
+
const [isLoadingSuggestions, setIsLoadingSuggestions] = (0, import_react89.useState)(false);
|
|
358980
|
+
const [isPerfectMatch, setIsPerfectMatch] = (0, import_react89.useState)(false);
|
|
358981
|
+
const resetCompletionState = (0, import_react89.useCallback)(() => {
|
|
359002
358982
|
setSuggestions([]);
|
|
359003
358983
|
setActiveSuggestionIndex(-1);
|
|
359004
358984
|
setVisibleStartIndex(0);
|
|
@@ -359006,7 +358986,7 @@ function useCompletion() {
|
|
|
359006
358986
|
setIsLoadingSuggestions(false);
|
|
359007
358987
|
setIsPerfectMatch(false);
|
|
359008
358988
|
}, []);
|
|
359009
|
-
const navigateUp = (0,
|
|
358989
|
+
const navigateUp = (0, import_react89.useCallback)(() => {
|
|
359010
358990
|
if (suggestions.length === 0) return;
|
|
359011
358991
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
359012
358992
|
const newActiveIndex = prevActiveIndex <= 0 ? suggestions.length - 1 : prevActiveIndex - 1;
|
|
@@ -359022,7 +359002,7 @@ function useCompletion() {
|
|
|
359022
359002
|
return newActiveIndex;
|
|
359023
359003
|
});
|
|
359024
359004
|
}, [suggestions.length]);
|
|
359025
|
-
const navigateDown = (0,
|
|
359005
|
+
const navigateDown = (0, import_react89.useCallback)(() => {
|
|
359026
359006
|
if (suggestions.length === 0) return;
|
|
359027
359007
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
359028
359008
|
const newActiveIndex = prevActiveIndex >= suggestions.length - 1 ? 0 : prevActiveIndex + 1;
|
|
@@ -359061,8 +359041,8 @@ __name(useCompletion, "useCompletion");
|
|
|
359061
359041
|
|
|
359062
359042
|
// packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx
|
|
359063
359043
|
function useDebouncedValue(value, delay4 = 200) {
|
|
359064
|
-
const [debounced, setDebounced] = (0,
|
|
359065
|
-
(0,
|
|
359044
|
+
const [debounced, setDebounced] = (0, import_react90.useState)(value);
|
|
359045
|
+
(0, import_react90.useEffect)(() => {
|
|
359066
359046
|
const handle = setTimeout(() => setDebounced(value), delay4);
|
|
359067
359047
|
return () => clearTimeout(handle);
|
|
359068
359048
|
}, [value, delay4]);
|
|
@@ -359085,19 +359065,19 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
359085
359065
|
setVisibleStartIndex
|
|
359086
359066
|
} = useCompletion();
|
|
359087
359067
|
const debouncedQuery = useDebouncedValue(buffer.text, 100);
|
|
359088
|
-
const prevQueryRef = (0,
|
|
359089
|
-
const prevMatchesRef = (0,
|
|
359090
|
-
(0,
|
|
359068
|
+
const prevQueryRef = (0, import_react90.useRef)("");
|
|
359069
|
+
const prevMatchesRef = (0, import_react90.useRef)([]);
|
|
359070
|
+
(0, import_react90.useEffect)(() => {
|
|
359091
359071
|
if (reverseSearchActive) {
|
|
359092
359072
|
prevQueryRef.current = "";
|
|
359093
359073
|
prevMatchesRef.current = [];
|
|
359094
359074
|
}
|
|
359095
359075
|
}, [reverseSearchActive]);
|
|
359096
|
-
(0,
|
|
359076
|
+
(0, import_react90.useEffect)(() => {
|
|
359097
359077
|
prevQueryRef.current = "";
|
|
359098
359078
|
prevMatchesRef.current = [];
|
|
359099
359079
|
}, [history]);
|
|
359100
|
-
const searchHistory = (0,
|
|
359080
|
+
const searchHistory = (0, import_react90.useCallback)(
|
|
359101
359081
|
(query, items) => {
|
|
359102
359082
|
const out = [];
|
|
359103
359083
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -359111,7 +359091,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
359111
359091
|
},
|
|
359112
359092
|
[]
|
|
359113
359093
|
);
|
|
359114
|
-
const matches = (0,
|
|
359094
|
+
const matches = (0, import_react90.useMemo)(() => {
|
|
359115
359095
|
if (!reverseSearchActive) return [];
|
|
359116
359096
|
if (debouncedQuery.length === 0)
|
|
359117
359097
|
return history.map((cmd) => ({
|
|
@@ -359124,7 +359104,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
359124
359104
|
const source2 = canUseCache ? prevMatchesRef.current.map((m) => m.value) : history;
|
|
359125
359105
|
return searchHistory(query, source2);
|
|
359126
359106
|
}, [debouncedQuery, history, reverseSearchActive, searchHistory]);
|
|
359127
|
-
(0,
|
|
359107
|
+
(0, import_react90.useEffect)(() => {
|
|
359128
359108
|
if (!reverseSearchActive) {
|
|
359129
359109
|
resetCompletionState();
|
|
359130
359110
|
return;
|
|
@@ -359146,7 +359126,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
359146
359126
|
setVisibleStartIndex,
|
|
359147
359127
|
resetCompletionState
|
|
359148
359128
|
]);
|
|
359149
|
-
const handleAutocomplete = (0,
|
|
359129
|
+
const handleAutocomplete = (0, import_react90.useCallback)(
|
|
359150
359130
|
(i) => {
|
|
359151
359131
|
if (i < 0 || i >= suggestions.length) return;
|
|
359152
359132
|
buffer.setText(suggestions[i].value);
|
|
@@ -359170,11 +359150,11 @@ __name(useReverseSearchCompletion, "useReverseSearchCompletion");
|
|
|
359170
359150
|
|
|
359171
359151
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
359172
359152
|
init_esbuild_shims();
|
|
359173
|
-
var
|
|
359153
|
+
var import_react93 = __toESM(require_react(), 1);
|
|
359174
359154
|
|
|
359175
359155
|
// packages/cli/src/ui/hooks/useAtCompletion.ts
|
|
359176
359156
|
init_esbuild_shims();
|
|
359177
|
-
var
|
|
359157
|
+
var import_react91 = __toESM(require_react(), 1);
|
|
359178
359158
|
init_core2();
|
|
359179
359159
|
var initialState = {
|
|
359180
359160
|
status: "idle" /* IDLE */,
|
|
@@ -359233,20 +359213,20 @@ function useAtCompletion(props) {
|
|
|
359233
359213
|
setSuggestions,
|
|
359234
359214
|
setIsLoadingSuggestions
|
|
359235
359215
|
} = props;
|
|
359236
|
-
const [state, dispatch] = (0,
|
|
359237
|
-
const fileSearch = (0,
|
|
359238
|
-
const searchAbortController = (0,
|
|
359239
|
-
const slowSearchTimer = (0,
|
|
359240
|
-
(0,
|
|
359216
|
+
const [state, dispatch] = (0, import_react91.useReducer)(atCompletionReducer, initialState);
|
|
359217
|
+
const fileSearch = (0, import_react91.useRef)(null);
|
|
359218
|
+
const searchAbortController = (0, import_react91.useRef)(null);
|
|
359219
|
+
const slowSearchTimer = (0, import_react91.useRef)(null);
|
|
359220
|
+
(0, import_react91.useEffect)(() => {
|
|
359241
359221
|
setSuggestions(state.suggestions);
|
|
359242
359222
|
}, [state.suggestions, setSuggestions]);
|
|
359243
|
-
(0,
|
|
359223
|
+
(0, import_react91.useEffect)(() => {
|
|
359244
359224
|
setIsLoadingSuggestions(state.isLoading);
|
|
359245
359225
|
}, [state.isLoading, setIsLoadingSuggestions]);
|
|
359246
|
-
(0,
|
|
359226
|
+
(0, import_react91.useEffect)(() => {
|
|
359247
359227
|
dispatch({ type: "RESET" });
|
|
359248
359228
|
}, [cwd7, config]);
|
|
359249
|
-
(0,
|
|
359229
|
+
(0, import_react91.useEffect)(() => {
|
|
359250
359230
|
if (!enabled) {
|
|
359251
359231
|
if (state.status === "ready" /* READY */ || state.status === "error" /* ERROR */) {
|
|
359252
359232
|
dispatch({ type: "RESET" });
|
|
@@ -359263,7 +359243,7 @@ function useAtCompletion(props) {
|
|
|
359263
359243
|
dispatch({ type: "SEARCH", payload: pattern });
|
|
359264
359244
|
}
|
|
359265
359245
|
}, [enabled, pattern, state.status, state.pattern]);
|
|
359266
|
-
(0,
|
|
359246
|
+
(0, import_react91.useEffect)(() => {
|
|
359267
359247
|
const initialize = /* @__PURE__ */ __name(async () => {
|
|
359268
359248
|
try {
|
|
359269
359249
|
const searcher = FileSearchFactory.create({
|
|
@@ -359338,7 +359318,7 @@ __name(useAtCompletion, "useAtCompletion");
|
|
|
359338
359318
|
|
|
359339
359319
|
// packages/cli/src/ui/hooks/useSlashCompletion.ts
|
|
359340
359320
|
init_esbuild_shims();
|
|
359341
|
-
var
|
|
359321
|
+
var import_react92 = __toESM(require_react(), 1);
|
|
359342
359322
|
init_fzf_es();
|
|
359343
359323
|
function logErrorSafely(error, context2) {
|
|
359344
359324
|
if (error instanceof Error) {
|
|
@@ -359353,7 +359333,7 @@ function matchesCommand(cmd, query) {
|
|
|
359353
359333
|
}
|
|
359354
359334
|
__name(matchesCommand, "matchesCommand");
|
|
359355
359335
|
function useCommandParser(query, slashCommands) {
|
|
359356
|
-
return (0,
|
|
359336
|
+
return (0, import_react92.useMemo)(() => {
|
|
359357
359337
|
if (!query) {
|
|
359358
359338
|
return {
|
|
359359
359339
|
hasTrailingSpace: false,
|
|
@@ -359423,9 +359403,9 @@ function useCommandParser(query, slashCommands) {
|
|
|
359423
359403
|
}
|
|
359424
359404
|
__name(useCommandParser, "useCommandParser");
|
|
359425
359405
|
function useCommandSuggestions(parserResult, commandContext, getFzfForCommands, getPrefixSuggestions) {
|
|
359426
|
-
const [suggestions, setSuggestions] = (0,
|
|
359427
|
-
const [isLoading, setIsLoading] = (0,
|
|
359428
|
-
(0,
|
|
359406
|
+
const [suggestions, setSuggestions] = (0, import_react92.useState)([]);
|
|
359407
|
+
const [isLoading, setIsLoading] = (0, import_react92.useState)(false);
|
|
359408
|
+
(0, import_react92.useEffect)(() => {
|
|
359429
359409
|
const abortController = new AbortController();
|
|
359430
359410
|
const { signal } = abortController;
|
|
359431
359411
|
const {
|
|
@@ -359545,7 +359525,7 @@ function useCommandSuggestions(parserResult, commandContext, getFzfForCommands,
|
|
|
359545
359525
|
}
|
|
359546
359526
|
__name(useCommandSuggestions, "useCommandSuggestions");
|
|
359547
359527
|
function useCompletionPositions(query, parserResult) {
|
|
359548
|
-
return (0,
|
|
359528
|
+
return (0, import_react92.useMemo)(() => {
|
|
359549
359529
|
if (!query) {
|
|
359550
359530
|
return { start: -1, end: -1 };
|
|
359551
359531
|
}
|
|
@@ -359567,7 +359547,7 @@ function useCompletionPositions(query, parserResult) {
|
|
|
359567
359547
|
}
|
|
359568
359548
|
__name(useCompletionPositions, "useCompletionPositions");
|
|
359569
359549
|
function usePerfectMatch(parserResult) {
|
|
359570
|
-
return (0,
|
|
359550
|
+
return (0, import_react92.useMemo)(() => {
|
|
359571
359551
|
const { hasTrailingSpace, partial, leafCommand, currentLevel } = parserResult;
|
|
359572
359552
|
if (hasTrailingSpace) {
|
|
359573
359553
|
return { isPerfectMatch: false };
|
|
@@ -359597,13 +359577,13 @@ function useSlashCompletion(props) {
|
|
|
359597
359577
|
setIsLoadingSuggestions,
|
|
359598
359578
|
setIsPerfectMatch
|
|
359599
359579
|
} = props;
|
|
359600
|
-
const [completionStart, setCompletionStart] = (0,
|
|
359601
|
-
const [completionEnd, setCompletionEnd] = (0,
|
|
359602
|
-
const fzfInstanceCache = (0,
|
|
359580
|
+
const [completionStart, setCompletionStart] = (0, import_react92.useState)(-1);
|
|
359581
|
+
const [completionEnd, setCompletionEnd] = (0, import_react92.useState)(-1);
|
|
359582
|
+
const fzfInstanceCache = (0, import_react92.useMemo)(
|
|
359603
359583
|
() => /* @__PURE__ */ new WeakMap(),
|
|
359604
359584
|
[]
|
|
359605
359585
|
);
|
|
359606
|
-
const getFzfForCommands = (0,
|
|
359586
|
+
const getFzfForCommands = (0, import_react92.useMemo)(
|
|
359607
359587
|
() => (commands) => {
|
|
359608
359588
|
if (!commands || commands.length === 0) {
|
|
359609
359589
|
return null;
|
|
@@ -359647,7 +359627,7 @@ function useSlashCompletion(props) {
|
|
|
359647
359627
|
},
|
|
359648
359628
|
[fzfInstanceCache]
|
|
359649
359629
|
);
|
|
359650
|
-
const getPrefixSuggestions = (0,
|
|
359630
|
+
const getPrefixSuggestions = (0, import_react92.useMemo)(
|
|
359651
359631
|
() => (commands, partial) => commands.filter(
|
|
359652
359632
|
(cmd) => cmd.description && !cmd.hidden && (cmd.name.toLowerCase().startsWith(partial.toLowerCase()) || cmd.altNames?.some(
|
|
359653
359633
|
(alt) => alt.toLowerCase().startsWith(partial.toLowerCase())
|
|
@@ -359667,7 +359647,7 @@ function useSlashCompletion(props) {
|
|
|
359667
359647
|
parserResult
|
|
359668
359648
|
);
|
|
359669
359649
|
const { isPerfectMatch } = usePerfectMatch(parserResult);
|
|
359670
|
-
(0,
|
|
359650
|
+
(0, import_react92.useEffect)(() => {
|
|
359671
359651
|
if (!enabled) {
|
|
359672
359652
|
setSuggestions([]);
|
|
359673
359653
|
setIsLoadingSuggestions(false);
|
|
@@ -359676,7 +359656,7 @@ function useSlashCompletion(props) {
|
|
|
359676
359656
|
setCompletionEnd(-1);
|
|
359677
359657
|
}
|
|
359678
359658
|
}, [enabled, setSuggestions, setIsLoadingSuggestions, setIsPerfectMatch]);
|
|
359679
|
-
(0,
|
|
359659
|
+
(0, import_react92.useEffect)(() => {
|
|
359680
359660
|
if (!enabled || query === null) {
|
|
359681
359661
|
return;
|
|
359682
359662
|
}
|
|
@@ -359725,7 +359705,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
359725
359705
|
} = useCompletion();
|
|
359726
359706
|
const cursorRow = buffer.cursor[0];
|
|
359727
359707
|
const cursorCol = buffer.cursor[1];
|
|
359728
|
-
const { completionMode, query, completionStart, completionEnd } = (0,
|
|
359708
|
+
const { completionMode, query, completionStart, completionEnd } = (0, import_react93.useMemo)(() => {
|
|
359729
359709
|
const currentLine = buffer.lines[cursorRow] || "";
|
|
359730
359710
|
if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
|
|
359731
359711
|
return {
|
|
@@ -359794,11 +359774,11 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
359794
359774
|
setIsLoadingSuggestions,
|
|
359795
359775
|
setIsPerfectMatch
|
|
359796
359776
|
});
|
|
359797
|
-
(0,
|
|
359777
|
+
(0, import_react93.useEffect)(() => {
|
|
359798
359778
|
setActiveSuggestionIndex(suggestions.length > 0 ? 0 : -1);
|
|
359799
359779
|
setVisibleStartIndex(0);
|
|
359800
359780
|
}, [suggestions, setActiveSuggestionIndex, setVisibleStartIndex]);
|
|
359801
|
-
(0,
|
|
359781
|
+
(0, import_react93.useEffect)(() => {
|
|
359802
359782
|
if (completionMode === "IDLE" /* IDLE */ || reverseSearchActive) {
|
|
359803
359783
|
resetCompletionState();
|
|
359804
359784
|
return;
|
|
@@ -359812,7 +359792,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
359812
359792
|
resetCompletionState,
|
|
359813
359793
|
setShowSuggestions
|
|
359814
359794
|
]);
|
|
359815
|
-
const handleAutocomplete = (0,
|
|
359795
|
+
const handleAutocomplete = (0, import_react93.useCallback)(
|
|
359816
359796
|
(indexToUse) => {
|
|
359817
359797
|
if (indexToUse < 0 || indexToUse >= suggestions.length) {
|
|
359818
359798
|
return;
|
|
@@ -360042,9 +360022,9 @@ import * as path100 from "node:path";
|
|
|
360042
360022
|
|
|
360043
360023
|
// packages/cli/src/ui/contexts/ShellFocusContext.tsx
|
|
360044
360024
|
init_esbuild_shims();
|
|
360045
|
-
var
|
|
360046
|
-
var ShellFocusContext = (0,
|
|
360047
|
-
var useShellFocusState = /* @__PURE__ */ __name(() => (0,
|
|
360025
|
+
var import_react94 = __toESM(require_react(), 1);
|
|
360026
|
+
var ShellFocusContext = (0, import_react94.createContext)(true);
|
|
360027
|
+
var useShellFocusState = /* @__PURE__ */ __name(() => (0, import_react94.useContext)(ShellFocusContext), "useShellFocusState");
|
|
360048
360028
|
|
|
360049
360029
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
360050
360030
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -360084,29 +360064,29 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360084
360064
|
isEmbeddedShellFocused
|
|
360085
360065
|
}) => {
|
|
360086
360066
|
const isShellFocused = useShellFocusState();
|
|
360087
|
-
const [justNavigatedHistory, setJustNavigatedHistory] = (0,
|
|
360088
|
-
const [escPressCount, setEscPressCount] = (0,
|
|
360089
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
360090
|
-
const escapeTimerRef = (0,
|
|
360091
|
-
const [recentPasteTime, setRecentPasteTime] = (0,
|
|
360092
|
-
const pasteTimeoutRef = (0,
|
|
360093
|
-
const [dirs, setDirs] = (0,
|
|
360067
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = (0, import_react95.useState)(false);
|
|
360068
|
+
const [escPressCount, setEscPressCount] = (0, import_react95.useState)(0);
|
|
360069
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react95.useState)(false);
|
|
360070
|
+
const escapeTimerRef = (0, import_react95.useRef)(null);
|
|
360071
|
+
const [recentPasteTime, setRecentPasteTime] = (0, import_react95.useState)(null);
|
|
360072
|
+
const pasteTimeoutRef = (0, import_react95.useRef)(null);
|
|
360073
|
+
const [dirs, setDirs] = (0, import_react95.useState)(
|
|
360094
360074
|
config.getWorkspaceContext().getDirectories()
|
|
360095
360075
|
);
|
|
360096
360076
|
const dirsChanged = config.getWorkspaceContext().getDirectories();
|
|
360097
|
-
(0,
|
|
360077
|
+
(0, import_react95.useEffect)(() => {
|
|
360098
360078
|
if (dirs.length !== dirsChanged.length) {
|
|
360099
360079
|
setDirs(dirsChanged);
|
|
360100
360080
|
}
|
|
360101
360081
|
}, [dirs.length, dirsChanged]);
|
|
360102
|
-
const [reverseSearchActive, setReverseSearchActive] = (0,
|
|
360103
|
-
const [commandSearchActive, setCommandSearchActive] = (0,
|
|
360104
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0,
|
|
360105
|
-
const [cursorPosition, setCursorPosition] = (0,
|
|
360082
|
+
const [reverseSearchActive, setReverseSearchActive] = (0, import_react95.useState)(false);
|
|
360083
|
+
const [commandSearchActive, setCommandSearchActive] = (0, import_react95.useState)(false);
|
|
360084
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0, import_react95.useState)("");
|
|
360085
|
+
const [cursorPosition, setCursorPosition] = (0, import_react95.useState)([
|
|
360106
360086
|
0,
|
|
360107
360087
|
0
|
|
360108
360088
|
]);
|
|
360109
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0,
|
|
360089
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0, import_react95.useState)(-1);
|
|
360110
360090
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
360111
360091
|
const shellHistoryData = shellHistory.history;
|
|
360112
360092
|
const completion3 = useCommandCompletion(
|
|
@@ -360132,7 +360112,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360132
360112
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
360133
360113
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
360134
360114
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused;
|
|
360135
|
-
const resetEscapeState = (0,
|
|
360115
|
+
const resetEscapeState = (0, import_react95.useCallback)(() => {
|
|
360136
360116
|
if (escapeTimerRef.current) {
|
|
360137
360117
|
clearTimeout(escapeTimerRef.current);
|
|
360138
360118
|
escapeTimerRef.current = null;
|
|
@@ -360140,12 +360120,12 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360140
360120
|
setEscPressCount(0);
|
|
360141
360121
|
setShowEscapePrompt(false);
|
|
360142
360122
|
}, []);
|
|
360143
|
-
(0,
|
|
360123
|
+
(0, import_react95.useEffect)(() => {
|
|
360144
360124
|
if (onEscapePromptChange) {
|
|
360145
360125
|
onEscapePromptChange(showEscapePrompt);
|
|
360146
360126
|
}
|
|
360147
360127
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
360148
|
-
(0,
|
|
360128
|
+
(0, import_react95.useEffect)(
|
|
360149
360129
|
() => () => {
|
|
360150
360130
|
if (escapeTimerRef.current) {
|
|
360151
360131
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -360156,7 +360136,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360156
360136
|
},
|
|
360157
360137
|
[]
|
|
360158
360138
|
);
|
|
360159
|
-
const handleSubmitAndClear = (0,
|
|
360139
|
+
const handleSubmitAndClear = (0, import_react95.useCallback)(
|
|
360160
360140
|
(submittedValue) => {
|
|
360161
360141
|
if (shellModeActive) {
|
|
360162
360142
|
shellHistory.addCommandToHistory(submittedValue);
|
|
@@ -360175,7 +360155,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360175
360155
|
resetReverseSearchCompletionState
|
|
360176
360156
|
]
|
|
360177
360157
|
);
|
|
360178
|
-
const customSetTextAndResetCompletionSignal = (0,
|
|
360158
|
+
const customSetTextAndResetCompletionSignal = (0, import_react95.useCallback)(
|
|
360179
360159
|
(newText) => {
|
|
360180
360160
|
buffer.setText(newText);
|
|
360181
360161
|
setJustNavigatedHistory(true);
|
|
@@ -360189,7 +360169,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360189
360169
|
currentQuery: buffer.text,
|
|
360190
360170
|
onChange: customSetTextAndResetCompletionSignal
|
|
360191
360171
|
});
|
|
360192
|
-
(0,
|
|
360172
|
+
(0, import_react95.useEffect)(() => {
|
|
360193
360173
|
if (justNavigatedHistory) {
|
|
360194
360174
|
resetCompletionState();
|
|
360195
360175
|
resetReverseSearchCompletionState();
|
|
@@ -360205,7 +360185,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360205
360185
|
resetReverseSearchCompletionState,
|
|
360206
360186
|
resetCommandSearchCompletionState
|
|
360207
360187
|
]);
|
|
360208
|
-
const handleClipboardImage = (0,
|
|
360188
|
+
const handleClipboardImage = (0, import_react95.useCallback)(async () => {
|
|
360209
360189
|
try {
|
|
360210
360190
|
if (await clipboardHasImage()) {
|
|
360211
360191
|
const imagePath = await saveClipboardImage(config.getTargetDir());
|
|
@@ -360237,7 +360217,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
360237
360217
|
console.error("Error handling clipboard image:", error);
|
|
360238
360218
|
}
|
|
360239
360219
|
}, [buffer, config]);
|
|
360240
|
-
const handleInput = (0,
|
|
360220
|
+
const handleInput = (0, import_react95.useCallback)(
|
|
360241
360221
|
(key) => {
|
|
360242
360222
|
if (!focus && !key.paste) {
|
|
360243
360223
|
return;
|
|
@@ -360694,15 +360674,15 @@ import process35 from "node:process";
|
|
|
360694
360674
|
|
|
360695
360675
|
// packages/cli/src/ui/components/MemoryUsageDisplay.tsx
|
|
360696
360676
|
init_esbuild_shims();
|
|
360697
|
-
var
|
|
360677
|
+
var import_react96 = __toESM(require_react(), 1);
|
|
360698
360678
|
import process34 from "node:process";
|
|
360699
360679
|
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
360700
360680
|
var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
360701
|
-
const [memoryUsage, setMemoryUsage] = (0,
|
|
360702
|
-
const [memoryUsageColor, setMemoryUsageColor] = (0,
|
|
360681
|
+
const [memoryUsage, setMemoryUsage] = (0, import_react96.useState)("");
|
|
360682
|
+
const [memoryUsageColor, setMemoryUsageColor] = (0, import_react96.useState)(
|
|
360703
360683
|
theme.text.secondary
|
|
360704
360684
|
);
|
|
360705
|
-
(0,
|
|
360685
|
+
(0, import_react96.useEffect)(() => {
|
|
360706
360686
|
const updateMemory = /* @__PURE__ */ __name(() => {
|
|
360707
360687
|
const usage2 = process34.memoryUsage().rss;
|
|
360708
360688
|
setMemoryUsage(formatMemoryUsage2(usage2));
|
|
@@ -360742,12 +360722,12 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
360742
360722
|
|
|
360743
360723
|
// packages/cli/src/ui/components/DebugProfiler.tsx
|
|
360744
360724
|
init_esbuild_shims();
|
|
360745
|
-
var
|
|
360725
|
+
var import_react97 = __toESM(require_react(), 1);
|
|
360746
360726
|
var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
|
|
360747
360727
|
var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
360748
|
-
const numRenders = (0,
|
|
360749
|
-
const [showNumRenders, setShowNumRenders] = (0,
|
|
360750
|
-
(0,
|
|
360728
|
+
const numRenders = (0, import_react97.useRef)(0);
|
|
360729
|
+
const [showNumRenders, setShowNumRenders] = (0, import_react97.useState)(false);
|
|
360730
|
+
(0, import_react97.useEffect)(() => {
|
|
360751
360731
|
numRenders.current++;
|
|
360752
360732
|
});
|
|
360753
360733
|
useKeypress(
|
|
@@ -360926,13 +360906,13 @@ init_core2();
|
|
|
360926
360906
|
|
|
360927
360907
|
// packages/cli/src/ui/components/ConfigInitDisplay.tsx
|
|
360928
360908
|
init_esbuild_shims();
|
|
360929
|
-
var
|
|
360909
|
+
var import_react98 = __toESM(require_react(), 1);
|
|
360930
360910
|
init_core2();
|
|
360931
360911
|
var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
|
|
360932
360912
|
var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
360933
360913
|
const config = useConfig();
|
|
360934
|
-
const [message, setMessage] = (0,
|
|
360935
|
-
(0,
|
|
360914
|
+
const [message, setMessage] = (0, import_react98.useState)(t2("Initializing..."));
|
|
360915
|
+
(0, import_react98.useEffect)(() => {
|
|
360936
360916
|
const onChange = /* @__PURE__ */ __name((clients) => {
|
|
360937
360917
|
if (!clients || clients.size === 0) {
|
|
360938
360918
|
setMessage(t2("Initializing..."));
|
|
@@ -360976,7 +360956,7 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
360976
360956
|
const isNarrow = isNarrowWidth(terminalWidth);
|
|
360977
360957
|
const debugConsoleMaxHeight = Math.floor(Math.max(terminalWidth * 0.2, 5));
|
|
360978
360958
|
const { contextFileNames, showAutoAcceptIndicator } = uiState;
|
|
360979
|
-
const { containerWidth } = (0,
|
|
360959
|
+
const { containerWidth } = (0, import_react99.useMemo)(
|
|
360980
360960
|
() => calculatePromptWidths(uiState.terminalWidth),
|
|
360981
360961
|
[uiState.terminalWidth]
|
|
360982
360962
|
);
|
|
@@ -361141,12 +361121,12 @@ import process51 from "node:process";
|
|
|
361141
361121
|
|
|
361142
361122
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
361143
361123
|
init_esbuild_shims();
|
|
361144
|
-
var
|
|
361124
|
+
var import_react100 = __toESM(require_react(), 1);
|
|
361145
361125
|
import process36 from "node:process";
|
|
361146
361126
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
361147
361127
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
361148
361128
|
var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
361149
|
-
(0,
|
|
361129
|
+
(0, import_react100.useEffect)(() => {
|
|
361150
361130
|
const intervalId = setInterval(() => {
|
|
361151
361131
|
const usage2 = process36.memoryUsage().rss;
|
|
361152
361132
|
if (usage2 > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -361166,11 +361146,11 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
|
361166
361146
|
|
|
361167
361147
|
// packages/cli/src/ui/hooks/useThemeCommand.ts
|
|
361168
361148
|
init_esbuild_shims();
|
|
361169
|
-
var
|
|
361149
|
+
var import_react101 = __toESM(require_react(), 1);
|
|
361170
361150
|
import process37 from "node:process";
|
|
361171
361151
|
var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
361172
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0,
|
|
361173
|
-
const openThemeDialog = (0,
|
|
361152
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react101.useState)(!!initialThemeError);
|
|
361153
|
+
const openThemeDialog = (0, import_react101.useCallback)(() => {
|
|
361174
361154
|
if (process37.env["NO_COLOR"]) {
|
|
361175
361155
|
addItem(
|
|
361176
361156
|
{
|
|
@@ -361185,7 +361165,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
361185
361165
|
}
|
|
361186
361166
|
setIsThemeDialogOpen(true);
|
|
361187
361167
|
}, [addItem]);
|
|
361188
|
-
const applyTheme = (0,
|
|
361168
|
+
const applyTheme = (0, import_react101.useCallback)(
|
|
361189
361169
|
(themeName) => {
|
|
361190
361170
|
if (!themeManager.setActiveTheme(themeName)) {
|
|
361191
361171
|
setIsThemeDialogOpen(true);
|
|
@@ -361200,13 +361180,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
361200
361180
|
},
|
|
361201
361181
|
[setThemeError]
|
|
361202
361182
|
);
|
|
361203
|
-
const handleThemeHighlight = (0,
|
|
361183
|
+
const handleThemeHighlight = (0, import_react101.useCallback)(
|
|
361204
361184
|
(themeName) => {
|
|
361205
361185
|
applyTheme(themeName);
|
|
361206
361186
|
},
|
|
361207
361187
|
[applyTheme]
|
|
361208
361188
|
);
|
|
361209
|
-
const handleThemeSelect = (0,
|
|
361189
|
+
const handleThemeSelect = (0, import_react101.useCallback)(
|
|
361210
361190
|
(themeName, scope) => {
|
|
361211
361191
|
try {
|
|
361212
361192
|
const mergedCustomThemes = {
|
|
@@ -361247,7 +361227,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
361247
361227
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
361248
361228
|
init_esbuild_shims();
|
|
361249
361229
|
init_core2();
|
|
361250
|
-
var
|
|
361230
|
+
var import_react103 = __toESM(require_react(), 1);
|
|
361251
361231
|
init_xhsSsoConfig();
|
|
361252
361232
|
|
|
361253
361233
|
// packages/cli/src/ui/auth/performSsoAuthFlow.ts
|
|
@@ -361368,16 +361348,16 @@ __name(performSsoAuthFlow, "performSsoAuthFlow");
|
|
|
361368
361348
|
|
|
361369
361349
|
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
361370
361350
|
init_esbuild_shims();
|
|
361371
|
-
var
|
|
361351
|
+
var import_react102 = __toESM(require_react(), 1);
|
|
361372
361352
|
init_core2();
|
|
361373
361353
|
var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
361374
|
-
const [qwenAuthState, setQwenAuthState] = (0,
|
|
361354
|
+
const [qwenAuthState, setQwenAuthState] = (0, import_react102.useState)({
|
|
361375
361355
|
deviceAuth: null,
|
|
361376
361356
|
authStatus: "idle",
|
|
361377
361357
|
authMessage: null
|
|
361378
361358
|
});
|
|
361379
361359
|
const isQwenAuth = pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */;
|
|
361380
|
-
(0,
|
|
361360
|
+
(0, import_react102.useEffect)(() => {
|
|
361381
361361
|
if (!isQwenAuth || !isAuthenticating) {
|
|
361382
361362
|
setQwenAuthState({
|
|
361383
361363
|
deviceAuth: null,
|
|
@@ -361417,7 +361397,7 @@ var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) =>
|
|
|
361417
361397
|
qwenOAuth2Events.off("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
361418
361398
|
};
|
|
361419
361399
|
}, [isQwenAuth, isAuthenticating]);
|
|
361420
|
-
const cancelQwenAuth = (0,
|
|
361400
|
+
const cancelQwenAuth = (0, import_react102.useCallback)(() => {
|
|
361421
361401
|
qwenOAuth2Events.emit("auth-cancel" /* AuthCancel */);
|
|
361422
361402
|
setQwenAuthState({
|
|
361423
361403
|
deviceAuth: null,
|
|
@@ -361435,22 +361415,22 @@ var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) =>
|
|
|
361435
361415
|
var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
361436
361416
|
const unAuthenticated = settings.merged.security?.auth?.selectedType === void 0;
|
|
361437
361417
|
const isSSOAutoAuthInProgress = shouldTriggerAutoSSOAuth(settings);
|
|
361438
|
-
const [authState, setAuthState] = (0,
|
|
361418
|
+
const [authState, setAuthState] = (0, import_react103.useState)(
|
|
361439
361419
|
unAuthenticated ? "updating" /* Updating */ : "unauthenticated" /* Unauthenticated */
|
|
361440
361420
|
);
|
|
361441
|
-
const [authError, setAuthError] = (0,
|
|
361442
|
-
const [isAuthenticating, setIsAuthenticating] = (0,
|
|
361443
|
-
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0,
|
|
361421
|
+
const [authError, setAuthError] = (0, import_react103.useState)(null);
|
|
361422
|
+
const [isAuthenticating, setIsAuthenticating] = (0, import_react103.useState)(false);
|
|
361423
|
+
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react103.useState)(
|
|
361444
361424
|
unAuthenticated && !isSSOAutoAuthInProgress
|
|
361445
361425
|
);
|
|
361446
|
-
const [pendingAuthType, setPendingAuthType] = (0,
|
|
361426
|
+
const [pendingAuthType, setPendingAuthType] = (0, import_react103.useState)(
|
|
361447
361427
|
void 0
|
|
361448
361428
|
);
|
|
361449
361429
|
const { qwenAuthState, cancelQwenAuth } = useQwenAuth(
|
|
361450
361430
|
pendingAuthType,
|
|
361451
361431
|
isAuthenticating
|
|
361452
361432
|
);
|
|
361453
|
-
const onAuthError = (0,
|
|
361433
|
+
const onAuthError = (0, import_react103.useCallback)(
|
|
361454
361434
|
(error) => {
|
|
361455
361435
|
setAuthError(error);
|
|
361456
361436
|
if (error) {
|
|
@@ -361460,7 +361440,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361460
361440
|
},
|
|
361461
361441
|
[setAuthError, setAuthState]
|
|
361462
361442
|
);
|
|
361463
|
-
const handleAuthFailure = (0,
|
|
361443
|
+
const handleAuthFailure = (0, import_react103.useCallback)(
|
|
361464
361444
|
(error) => {
|
|
361465
361445
|
setIsAuthenticating(false);
|
|
361466
361446
|
setPendingAuthType(void 0);
|
|
@@ -361480,7 +361460,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361480
361460
|
},
|
|
361481
361461
|
[onAuthError, pendingAuthType, config]
|
|
361482
361462
|
);
|
|
361483
|
-
const handleAuthSuccess = (0,
|
|
361463
|
+
const handleAuthSuccess = (0, import_react103.useCallback)(
|
|
361484
361464
|
async (authType, scope, credentials) => {
|
|
361485
361465
|
try {
|
|
361486
361466
|
settings.setValue(scope, "security.auth.selectedType", authType);
|
|
@@ -361527,7 +361507,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361527
361507
|
},
|
|
361528
361508
|
[settings, handleAuthFailure, config, addItem]
|
|
361529
361509
|
);
|
|
361530
|
-
const performAuth = (0,
|
|
361510
|
+
const performAuth = (0, import_react103.useCallback)(
|
|
361531
361511
|
async (authType, scope, credentials) => {
|
|
361532
361512
|
try {
|
|
361533
361513
|
await config.refreshAuth(authType);
|
|
@@ -361538,7 +361518,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361538
361518
|
},
|
|
361539
361519
|
[config, handleAuthSuccess, handleAuthFailure]
|
|
361540
361520
|
);
|
|
361541
|
-
const handleAuthSelect = (0,
|
|
361521
|
+
const handleAuthSelect = (0, import_react103.useCallback)(
|
|
361542
361522
|
async (authType, scope, credentials) => {
|
|
361543
361523
|
if (!authType) {
|
|
361544
361524
|
setIsAuthDialogOpen(false);
|
|
@@ -361656,10 +361636,10 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361656
361636
|
addItem
|
|
361657
361637
|
]
|
|
361658
361638
|
);
|
|
361659
|
-
const openAuthDialog = (0,
|
|
361639
|
+
const openAuthDialog = (0, import_react103.useCallback)(() => {
|
|
361660
361640
|
setIsAuthDialogOpen(true);
|
|
361661
361641
|
}, []);
|
|
361662
|
-
const cancelAuthentication = (0,
|
|
361642
|
+
const cancelAuthentication = (0, import_react103.useCallback)(() => {
|
|
361663
361643
|
if (isAuthenticating && pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
361664
361644
|
cancelQwenAuth();
|
|
361665
361645
|
}
|
|
@@ -361671,7 +361651,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361671
361651
|
setIsAuthDialogOpen(true);
|
|
361672
361652
|
setAuthError(null);
|
|
361673
361653
|
}, [isAuthenticating, pendingAuthType, cancelQwenAuth, config]);
|
|
361674
|
-
(0,
|
|
361654
|
+
(0, import_react103.useEffect)(() => {
|
|
361675
361655
|
const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
|
|
361676
361656
|
if (defaultAuthType && !["qwen-oauth" /* QWEN_OAUTH */, "openai" /* USE_OPENAI */, "xhs-sso" /* XHS_SSO */].includes(
|
|
361677
361657
|
defaultAuthType
|
|
@@ -361705,7 +361685,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
361705
361685
|
// packages/cli/src/ui/hooks/useQuotaAndFallback.ts
|
|
361706
361686
|
init_esbuild_shims();
|
|
361707
361687
|
init_core2();
|
|
361708
|
-
var
|
|
361688
|
+
var import_react104 = __toESM(require_react(), 1);
|
|
361709
361689
|
function useQuotaAndFallback({
|
|
361710
361690
|
config,
|
|
361711
361691
|
historyManager,
|
|
@@ -361713,9 +361693,9 @@ function useQuotaAndFallback({
|
|
|
361713
361693
|
setAuthState,
|
|
361714
361694
|
setModelSwitchedFromQuotaError
|
|
361715
361695
|
}) {
|
|
361716
|
-
const [proQuotaRequest, setProQuotaRequest] = (0,
|
|
361717
|
-
const isDialogPending = (0,
|
|
361718
|
-
(0,
|
|
361696
|
+
const [proQuotaRequest, setProQuotaRequest] = (0, import_react104.useState)(null);
|
|
361697
|
+
const isDialogPending = (0, import_react104.useRef)(false);
|
|
361698
|
+
(0, import_react104.useEffect)(() => {
|
|
361719
361699
|
const fallbackHandler = /* @__PURE__ */ __name(async (failedModel, fallbackModel, error) => {
|
|
361720
361700
|
if (config.isInFallbackMode()) {
|
|
361721
361701
|
return null;
|
|
@@ -361793,7 +361773,7 @@ function useQuotaAndFallback({
|
|
|
361793
361773
|
}, "fallbackHandler");
|
|
361794
361774
|
config.setFallbackModelHandler(fallbackHandler);
|
|
361795
361775
|
}, [config, historyManager, userTier, setModelSwitchedFromQuotaError]);
|
|
361796
|
-
const handleProQuotaChoice = (0,
|
|
361776
|
+
const handleProQuotaChoice = (0, import_react104.useCallback)(
|
|
361797
361777
|
(choice2) => {
|
|
361798
361778
|
if (!proQuotaRequest) return;
|
|
361799
361779
|
const intent = choice2 === "auth" ? "auth" : "retry";
|
|
@@ -361823,14 +361803,14 @@ __name(useQuotaAndFallback, "useQuotaAndFallback");
|
|
|
361823
361803
|
|
|
361824
361804
|
// packages/cli/src/ui/hooks/useEditorSettings.ts
|
|
361825
361805
|
init_esbuild_shims();
|
|
361826
|
-
var
|
|
361806
|
+
var import_react105 = __toESM(require_react(), 1);
|
|
361827
361807
|
init_core2();
|
|
361828
361808
|
var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
|
|
361829
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0,
|
|
361830
|
-
const openEditorDialog = (0,
|
|
361809
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react105.useState)(false);
|
|
361810
|
+
const openEditorDialog = (0, import_react105.useCallback)(() => {
|
|
361831
361811
|
setIsEditorDialogOpen(true);
|
|
361832
361812
|
}, []);
|
|
361833
|
-
const handleEditorSelect = (0,
|
|
361813
|
+
const handleEditorSelect = (0, import_react105.useCallback)(
|
|
361834
361814
|
(editorType, scope) => {
|
|
361835
361815
|
if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
|
|
361836
361816
|
return;
|
|
@@ -361852,7 +361832,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
361852
361832
|
},
|
|
361853
361833
|
[loadedSettings, setEditorError, addItem]
|
|
361854
361834
|
);
|
|
361855
|
-
const exitEditorDialog = (0,
|
|
361835
|
+
const exitEditorDialog = (0, import_react105.useCallback)(() => {
|
|
361856
361836
|
setIsEditorDialogOpen(false);
|
|
361857
361837
|
}, []);
|
|
361858
361838
|
return {
|
|
@@ -361865,13 +361845,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
361865
361845
|
|
|
361866
361846
|
// packages/cli/src/ui/hooks/useSettingsCommand.ts
|
|
361867
361847
|
init_esbuild_shims();
|
|
361868
|
-
var
|
|
361848
|
+
var import_react106 = __toESM(require_react(), 1);
|
|
361869
361849
|
function useSettingsCommand() {
|
|
361870
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0,
|
|
361871
|
-
const openSettingsDialog = (0,
|
|
361850
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react106.useState)(false);
|
|
361851
|
+
const openSettingsDialog = (0, import_react106.useCallback)(() => {
|
|
361872
361852
|
setIsSettingsDialogOpen(true);
|
|
361873
361853
|
}, []);
|
|
361874
|
-
const closeSettingsDialog = (0,
|
|
361854
|
+
const closeSettingsDialog = (0, import_react106.useCallback)(() => {
|
|
361875
361855
|
setIsSettingsDialogOpen(false);
|
|
361876
361856
|
}, []);
|
|
361877
361857
|
return {
|
|
@@ -361884,13 +361864,13 @@ __name(useSettingsCommand, "useSettingsCommand");
|
|
|
361884
361864
|
|
|
361885
361865
|
// packages/cli/src/ui/hooks/useModelCommand.ts
|
|
361886
361866
|
init_esbuild_shims();
|
|
361887
|
-
var
|
|
361867
|
+
var import_react107 = __toESM(require_react(), 1);
|
|
361888
361868
|
var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
361889
|
-
const [isModelDialogOpen, setIsModelDialogOpen] = (0,
|
|
361890
|
-
const openModelDialog = (0,
|
|
361869
|
+
const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react107.useState)(false);
|
|
361870
|
+
const openModelDialog = (0, import_react107.useCallback)(() => {
|
|
361891
361871
|
setIsModelDialogOpen(true);
|
|
361892
361872
|
}, []);
|
|
361893
|
-
const closeModelDialog = (0,
|
|
361873
|
+
const closeModelDialog = (0, import_react107.useCallback)(() => {
|
|
361894
361874
|
setIsModelDialogOpen(false);
|
|
361895
361875
|
}, []);
|
|
361896
361876
|
return {
|
|
@@ -361902,13 +361882,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
|
361902
361882
|
|
|
361903
361883
|
// packages/cli/src/ui/hooks/useApprovalModeCommand.ts
|
|
361904
361884
|
init_esbuild_shims();
|
|
361905
|
-
var
|
|
361885
|
+
var import_react108 = __toESM(require_react(), 1);
|
|
361906
361886
|
var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
|
|
361907
|
-
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0,
|
|
361908
|
-
const openApprovalModeDialog = (0,
|
|
361887
|
+
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react108.useState)(false);
|
|
361888
|
+
const openApprovalModeDialog = (0, import_react108.useCallback)(() => {
|
|
361909
361889
|
setIsApprovalModeDialogOpen(true);
|
|
361910
361890
|
}, []);
|
|
361911
|
-
const handleApprovalModeSelect = (0,
|
|
361891
|
+
const handleApprovalModeSelect = (0, import_react108.useCallback)(
|
|
361912
361892
|
(mode, scope) => {
|
|
361913
361893
|
try {
|
|
361914
361894
|
if (!mode) {
|
|
@@ -361934,7 +361914,7 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
|
|
|
361934
361914
|
|
|
361935
361915
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
361936
361916
|
init_esbuild_shims();
|
|
361937
|
-
var
|
|
361917
|
+
var import_react109 = __toESM(require_react(), 1);
|
|
361938
361918
|
|
|
361939
361919
|
// packages/cli/node_modules/@google/genai/dist/node/index.mjs
|
|
361940
361920
|
init_esbuild_shims();
|
|
@@ -362559,41 +362539,41 @@ var McpPromptLoader = class {
|
|
|
362559
362539
|
init_extensions();
|
|
362560
362540
|
var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized) => {
|
|
362561
362541
|
const session = useSessionStats();
|
|
362562
|
-
const [commands, setCommands] = (0,
|
|
362563
|
-
const [reloadTrigger, setReloadTrigger] = (0,
|
|
362564
|
-
const reloadCommands = (0,
|
|
362542
|
+
const [commands, setCommands] = (0, import_react109.useState)([]);
|
|
362543
|
+
const [reloadTrigger, setReloadTrigger] = (0, import_react109.useState)(0);
|
|
362544
|
+
const reloadCommands = (0, import_react109.useCallback)(() => {
|
|
362565
362545
|
setReloadTrigger((v) => v + 1);
|
|
362566
362546
|
}, []);
|
|
362567
|
-
const [shellConfirmationRequest, setShellConfirmationRequest] = (0,
|
|
362568
|
-
const [confirmationRequest, setConfirmationRequest] = (0,
|
|
362569
|
-
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0,
|
|
362570
|
-
const [sessionShellAllowlist, setSessionShellAllowlist] = (0,
|
|
362547
|
+
const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react109.useState)(null);
|
|
362548
|
+
const [confirmationRequest, setConfirmationRequest] = (0, import_react109.useState)(null);
|
|
362549
|
+
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0, import_react109.useState)(null);
|
|
362550
|
+
const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react109.useState)(
|
|
362571
362551
|
/* @__PURE__ */ new Set()
|
|
362572
362552
|
);
|
|
362573
|
-
const gitService = (0,
|
|
362553
|
+
const gitService = (0, import_react109.useMemo)(() => {
|
|
362574
362554
|
if (!config?.getProjectRoot()) {
|
|
362575
362555
|
return;
|
|
362576
362556
|
}
|
|
362577
362557
|
return new GitService(config.getProjectRoot(), config.storage);
|
|
362578
362558
|
}, [config]);
|
|
362579
|
-
const logger6 = (0,
|
|
362559
|
+
const logger6 = (0, import_react109.useMemo)(() => {
|
|
362580
362560
|
const l2 = new Logger(
|
|
362581
362561
|
config?.getSessionId() || "",
|
|
362582
362562
|
config?.storage ?? new Storage(process38.cwd())
|
|
362583
362563
|
);
|
|
362584
362564
|
return l2;
|
|
362585
362565
|
}, [config]);
|
|
362586
|
-
const [pendingItem, setPendingItem] = (0,
|
|
362566
|
+
const [pendingItem, setPendingItem] = (0, import_react109.useState)(
|
|
362587
362567
|
null
|
|
362588
362568
|
);
|
|
362589
|
-
const pendingHistoryItems = (0,
|
|
362569
|
+
const pendingHistoryItems = (0, import_react109.useMemo)(() => {
|
|
362590
362570
|
const items = [];
|
|
362591
362571
|
if (pendingItem != null) {
|
|
362592
362572
|
items.push(pendingItem);
|
|
362593
362573
|
}
|
|
362594
362574
|
return items;
|
|
362595
362575
|
}, [pendingItem]);
|
|
362596
|
-
const addMessage = (0,
|
|
362576
|
+
const addMessage = (0, import_react109.useCallback)(
|
|
362597
362577
|
(message) => {
|
|
362598
362578
|
let historyItemContent;
|
|
362599
362579
|
if (message.type === "about" /* ABOUT */) {
|
|
@@ -362649,7 +362629,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
362649
362629
|
},
|
|
362650
362630
|
[addItem]
|
|
362651
362631
|
);
|
|
362652
|
-
const commandContext = (0,
|
|
362632
|
+
const commandContext = (0, import_react109.useMemo)(
|
|
362653
362633
|
() => ({
|
|
362654
362634
|
services: {
|
|
362655
362635
|
config,
|
|
@@ -362701,7 +362681,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
362701
362681
|
extensionsUpdateState
|
|
362702
362682
|
]
|
|
362703
362683
|
);
|
|
362704
|
-
(0,
|
|
362684
|
+
(0, import_react109.useEffect)(() => {
|
|
362705
362685
|
if (!config) {
|
|
362706
362686
|
return;
|
|
362707
362687
|
}
|
|
@@ -362719,7 +362699,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
362719
362699
|
})();
|
|
362720
362700
|
};
|
|
362721
362701
|
}, [config, reloadCommands]);
|
|
362722
|
-
(0,
|
|
362702
|
+
(0, import_react109.useEffect)(() => {
|
|
362723
362703
|
const controller = new AbortController();
|
|
362724
362704
|
const load = /* @__PURE__ */ __name(async () => {
|
|
362725
362705
|
const loaders = [
|
|
@@ -362738,7 +362718,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
362738
362718
|
controller.abort();
|
|
362739
362719
|
};
|
|
362740
362720
|
}, [config, reloadTrigger, isConfigInitialized]);
|
|
362741
|
-
const handleSlashCommand2 = (0,
|
|
362721
|
+
const handleSlashCommand2 = (0, import_react109.useCallback)(
|
|
362742
362722
|
async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed) => {
|
|
362743
362723
|
if (typeof rawQuery !== "string") {
|
|
362744
362724
|
return false;
|
|
@@ -363061,7 +363041,7 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
363061
363041
|
|
|
363062
363042
|
// packages/cli/src/ui/hooks/useConsoleMessages.ts
|
|
363063
363043
|
init_esbuild_shims();
|
|
363064
|
-
var
|
|
363044
|
+
var import_react110 = __toESM(require_react(), 1);
|
|
363065
363045
|
function consoleMessagesReducer(state, action) {
|
|
363066
363046
|
switch (action.type) {
|
|
363067
363047
|
case "ADD_MESSAGES": {
|
|
@@ -363087,11 +363067,11 @@ function consoleMessagesReducer(state, action) {
|
|
|
363087
363067
|
}
|
|
363088
363068
|
__name(consoleMessagesReducer, "consoleMessagesReducer");
|
|
363089
363069
|
function useConsoleMessages() {
|
|
363090
|
-
const [consoleMessages, dispatch] = (0,
|
|
363091
|
-
const messageQueueRef = (0,
|
|
363092
|
-
const timeoutRef = (0,
|
|
363093
|
-
const [, startTransition] = (0,
|
|
363094
|
-
const processQueue = (0,
|
|
363070
|
+
const [consoleMessages, dispatch] = (0, import_react110.useReducer)(consoleMessagesReducer, []);
|
|
363071
|
+
const messageQueueRef = (0, import_react110.useRef)([]);
|
|
363072
|
+
const timeoutRef = (0, import_react110.useRef)(null);
|
|
363073
|
+
const [, startTransition] = (0, import_react110.useTransition)();
|
|
363074
|
+
const processQueue = (0, import_react110.useCallback)(() => {
|
|
363095
363075
|
if (messageQueueRef.current.length > 0) {
|
|
363096
363076
|
const messagesToProcess = messageQueueRef.current;
|
|
363097
363077
|
messageQueueRef.current = [];
|
|
@@ -363101,7 +363081,7 @@ function useConsoleMessages() {
|
|
|
363101
363081
|
}
|
|
363102
363082
|
timeoutRef.current = null;
|
|
363103
363083
|
}, []);
|
|
363104
|
-
const handleNewMessage = (0,
|
|
363084
|
+
const handleNewMessage = (0, import_react110.useCallback)(
|
|
363105
363085
|
(message) => {
|
|
363106
363086
|
messageQueueRef.current.push(message);
|
|
363107
363087
|
if (!timeoutRef.current) {
|
|
@@ -363110,7 +363090,7 @@ function useConsoleMessages() {
|
|
|
363110
363090
|
},
|
|
363111
363091
|
[processQueue]
|
|
363112
363092
|
);
|
|
363113
|
-
const clearConsoleMessages = (0,
|
|
363093
|
+
const clearConsoleMessages = (0, import_react110.useCallback)(() => {
|
|
363114
363094
|
if (timeoutRef.current) {
|
|
363115
363095
|
clearTimeout(timeoutRef.current);
|
|
363116
363096
|
timeoutRef.current = null;
|
|
@@ -363120,7 +363100,7 @@ function useConsoleMessages() {
|
|
|
363120
363100
|
dispatch({ type: "CLEAR" });
|
|
363121
363101
|
});
|
|
363122
363102
|
}, []);
|
|
363123
|
-
(0,
|
|
363103
|
+
(0, import_react110.useEffect)(
|
|
363124
363104
|
() => () => {
|
|
363125
363105
|
if (timeoutRef.current) {
|
|
363126
363106
|
clearTimeout(timeoutRef.current);
|
|
@@ -363150,11 +363130,11 @@ __name(computeWindowTitle, "computeWindowTitle");
|
|
|
363150
363130
|
|
|
363151
363131
|
// packages/cli/src/ui/hooks/useLogger.ts
|
|
363152
363132
|
init_esbuild_shims();
|
|
363153
|
-
var
|
|
363133
|
+
var import_react111 = __toESM(require_react(), 1);
|
|
363154
363134
|
init_core2();
|
|
363155
363135
|
var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
363156
|
-
const [logger6, setLogger] = (0,
|
|
363157
|
-
(0,
|
|
363136
|
+
const [logger6, setLogger] = (0, import_react111.useState)(null);
|
|
363137
|
+
(0, import_react111.useEffect)(() => {
|
|
363158
363138
|
const newLogger = new Logger(sessionId, storage);
|
|
363159
363139
|
newLogger.initialize().then(() => {
|
|
363160
363140
|
setLogger(newLogger);
|
|
@@ -363166,12 +363146,12 @@ var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
|
363166
363146
|
|
|
363167
363147
|
// packages/cli/src/ui/hooks/useGeminiStream.ts
|
|
363168
363148
|
init_esbuild_shims();
|
|
363169
|
-
var
|
|
363149
|
+
var import_react116 = __toESM(require_react(), 1);
|
|
363170
363150
|
init_core2();
|
|
363171
363151
|
|
|
363172
363152
|
// packages/cli/src/ui/hooks/shellCommandProcessor.ts
|
|
363173
363153
|
init_esbuild_shims();
|
|
363174
|
-
var
|
|
363154
|
+
var import_react112 = __toESM(require_react(), 1);
|
|
363175
363155
|
init_core2();
|
|
363176
363156
|
import crypto18 from "node:crypto";
|
|
363177
363157
|
import path101 from "node:path";
|
|
@@ -363200,8 +363180,8 @@ ${modelContent}
|
|
|
363200
363180
|
}
|
|
363201
363181
|
__name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
|
|
363202
363182
|
var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
|
|
363203
|
-
const [activeShellPtyId, setActiveShellPtyId] = (0,
|
|
363204
|
-
const handleShellCommand = (0,
|
|
363183
|
+
const [activeShellPtyId, setActiveShellPtyId] = (0, import_react112.useState)(null);
|
|
363184
|
+
const handleShellCommand = (0, import_react112.useCallback)(
|
|
363205
363185
|
(rawQuery, abortSignal) => {
|
|
363206
363186
|
if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
|
|
363207
363187
|
return false;
|
|
@@ -363450,7 +363430,7 @@ ${finalOutput}`;
|
|
|
363450
363430
|
// packages/cli/src/ui/hooks/useVisionAutoSwitch.ts
|
|
363451
363431
|
init_esbuild_shims();
|
|
363452
363432
|
init_core2();
|
|
363453
|
-
var
|
|
363433
|
+
var import_react113 = __toESM(require_react(), 1);
|
|
363454
363434
|
init_core2();
|
|
363455
363435
|
function hasImageParts(parts) {
|
|
363456
363436
|
if (typeof parts === "string") {
|
|
@@ -363540,8 +363520,8 @@ function processVisionSwitchOutcome(outcome) {
|
|
|
363540
363520
|
}
|
|
363541
363521
|
__name(processVisionSwitchOutcome, "processVisionSwitchOutcome");
|
|
363542
363522
|
function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true, onVisionSwitchRequired) {
|
|
363543
|
-
const originalModelRef = (0,
|
|
363544
|
-
const handleVisionSwitch = (0,
|
|
363523
|
+
const originalModelRef = (0, import_react113.useRef)(null);
|
|
363524
|
+
const handleVisionSwitch = (0, import_react113.useCallback)(
|
|
363545
363525
|
async (query, userMessageTimestamp, isContinuation) => {
|
|
363546
363526
|
if (isContinuation || !onVisionSwitchRequired) {
|
|
363547
363527
|
return { shouldProceed: true };
|
|
@@ -363642,7 +363622,7 @@ function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true,
|
|
|
363642
363622
|
},
|
|
363643
363623
|
[config, addItem, visionModelPreviewEnabled, onVisionSwitchRequired]
|
|
363644
363624
|
);
|
|
363645
|
-
const restoreOriginalModel = (0,
|
|
363625
|
+
const restoreOriginalModel = (0, import_react113.useCallback)(async () => {
|
|
363646
363626
|
if (originalModelRef.current) {
|
|
363647
363627
|
await config.setModel(originalModelRef.current, {
|
|
363648
363628
|
reason: "vision_auto_switch",
|
|
@@ -363719,11 +363699,11 @@ var findLastSafeSplitPoint = /* @__PURE__ */ __name((content) => {
|
|
|
363719
363699
|
|
|
363720
363700
|
// packages/cli/src/ui/hooks/useStateAndRef.ts
|
|
363721
363701
|
init_esbuild_shims();
|
|
363722
|
-
var
|
|
363702
|
+
var import_react114 = __toESM(require_react(), 1);
|
|
363723
363703
|
var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
363724
|
-
const [state, setState] =
|
|
363725
|
-
const ref =
|
|
363726
|
-
const setStateInternal =
|
|
363704
|
+
const [state, setState] = import_react114.default.useState(initialValue);
|
|
363705
|
+
const ref = import_react114.default.useRef(initialValue);
|
|
363706
|
+
const setStateInternal = import_react114.default.useCallback(
|
|
363727
363707
|
(newStateOrCallback) => {
|
|
363728
363708
|
let newValue;
|
|
363729
363709
|
if (typeof newStateOrCallback === "function") {
|
|
@@ -363742,10 +363722,10 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
|
363742
363722
|
// packages/cli/src/ui/hooks/useReactToolScheduler.ts
|
|
363743
363723
|
init_esbuild_shims();
|
|
363744
363724
|
init_core2();
|
|
363745
|
-
var
|
|
363725
|
+
var import_react115 = __toESM(require_react(), 1);
|
|
363746
363726
|
function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
|
|
363747
|
-
const [toolCallsForDisplay, setToolCallsForDisplay] = (0,
|
|
363748
|
-
const outputUpdateHandler = (0,
|
|
363727
|
+
const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react115.useState)([]);
|
|
363728
|
+
const outputUpdateHandler = (0, import_react115.useCallback)(
|
|
363749
363729
|
(toolCallId, outputChunk) => {
|
|
363750
363730
|
setToolCallsForDisplay(
|
|
363751
363731
|
(prevCalls) => prevCalls.map((tc) => {
|
|
@@ -363759,13 +363739,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
363759
363739
|
},
|
|
363760
363740
|
[]
|
|
363761
363741
|
);
|
|
363762
|
-
const allToolCallsCompleteHandler = (0,
|
|
363742
|
+
const allToolCallsCompleteHandler = (0, import_react115.useCallback)(
|
|
363763
363743
|
async (completedToolCalls) => {
|
|
363764
363744
|
await onComplete(completedToolCalls);
|
|
363765
363745
|
},
|
|
363766
363746
|
[onComplete]
|
|
363767
363747
|
);
|
|
363768
|
-
const toolCallsUpdateHandler = (0,
|
|
363748
|
+
const toolCallsUpdateHandler = (0, import_react115.useCallback)(
|
|
363769
363749
|
(updatedCoreToolCalls) => {
|
|
363770
363750
|
setToolCallsForDisplay(
|
|
363771
363751
|
(prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
|
|
@@ -363792,7 +363772,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
363792
363772
|
},
|
|
363793
363773
|
[setToolCallsForDisplay]
|
|
363794
363774
|
);
|
|
363795
|
-
const scheduler = (0,
|
|
363775
|
+
const scheduler = (0, import_react115.useMemo)(
|
|
363796
363776
|
() => new CoreToolScheduler({
|
|
363797
363777
|
outputUpdateHandler,
|
|
363798
363778
|
onAllToolCallsComplete: allToolCallsCompleteHandler,
|
|
@@ -363811,13 +363791,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
363811
363791
|
onEditorClose
|
|
363812
363792
|
]
|
|
363813
363793
|
);
|
|
363814
|
-
const schedule = (0,
|
|
363794
|
+
const schedule = (0, import_react115.useCallback)(
|
|
363815
363795
|
(request4, signal) => {
|
|
363816
363796
|
void scheduler.schedule(request4, signal);
|
|
363817
363797
|
},
|
|
363818
363798
|
[scheduler]
|
|
363819
363799
|
);
|
|
363820
|
-
const markToolsAsSubmitted = (0,
|
|
363800
|
+
const markToolsAsSubmitted = (0, import_react115.useCallback)(
|
|
363821
363801
|
(callIdsToMark) => {
|
|
363822
363802
|
setToolCallsForDisplay(
|
|
363823
363803
|
(prevCalls) => prevCalls.map(
|
|
@@ -363966,18 +363946,18 @@ function showCitations(settings) {
|
|
|
363966
363946
|
}
|
|
363967
363947
|
__name(showCitations, "showCitations");
|
|
363968
363948
|
var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, config, settings, onDebugMessage, handleSlashCommand2, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, visionModelPreviewEnabled, setShellInputFocused, terminalWidth, terminalHeight, onVisionSwitchRequired, isShellFocused) => {
|
|
363969
|
-
const [initError, setInitError] = (0,
|
|
363970
|
-
const abortControllerRef = (0,
|
|
363971
|
-
const turnCancelledRef = (0,
|
|
363972
|
-
const isSubmittingQueryRef = (0,
|
|
363973
|
-
const [isResponding, setIsResponding] = (0,
|
|
363974
|
-
const [thought, setThought] = (0,
|
|
363949
|
+
const [initError, setInitError] = (0, import_react116.useState)(null);
|
|
363950
|
+
const abortControllerRef = (0, import_react116.useRef)(null);
|
|
363951
|
+
const turnCancelledRef = (0, import_react116.useRef)(false);
|
|
363952
|
+
const isSubmittingQueryRef = (0, import_react116.useRef)(false);
|
|
363953
|
+
const [isResponding, setIsResponding] = (0, import_react116.useState)(false);
|
|
363954
|
+
const [thought, setThought] = (0, import_react116.useState)(null);
|
|
363975
363955
|
const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
|
|
363976
|
-
const processedMemoryToolsRef = (0,
|
|
363956
|
+
const processedMemoryToolsRef = (0, import_react116.useRef)(/* @__PURE__ */ new Set());
|
|
363977
363957
|
const { startNewPrompt, getPromptCount } = useSessionStats();
|
|
363978
363958
|
const storage = config.storage;
|
|
363979
363959
|
const logger6 = useLogger(storage);
|
|
363980
|
-
const gitService = (0,
|
|
363960
|
+
const gitService = (0, import_react116.useMemo)(() => {
|
|
363981
363961
|
if (!config.getProjectRoot()) {
|
|
363982
363962
|
return;
|
|
363983
363963
|
}
|
|
@@ -364001,11 +363981,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364001
363981
|
getPreferredEditor,
|
|
364002
363982
|
onEditorClose
|
|
364003
363983
|
);
|
|
364004
|
-
const pendingToolCallGroupDisplay = (0,
|
|
363984
|
+
const pendingToolCallGroupDisplay = (0, import_react116.useMemo)(
|
|
364005
363985
|
() => toolCalls.length ? mapToDisplay(toolCalls) : void 0,
|
|
364006
363986
|
[toolCalls]
|
|
364007
363987
|
);
|
|
364008
|
-
const activeToolPtyId = (0,
|
|
363988
|
+
const activeToolPtyId = (0, import_react116.useMemo)(() => {
|
|
364009
363989
|
const executingShellTool = toolCalls?.find(
|
|
364010
363990
|
(tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
|
|
364011
363991
|
);
|
|
@@ -364014,12 +363994,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364014
363994
|
}
|
|
364015
363995
|
return void 0;
|
|
364016
363996
|
}, [toolCalls]);
|
|
364017
|
-
const loopDetectedRef = (0,
|
|
363997
|
+
const loopDetectedRef = (0, import_react116.useRef)(false);
|
|
364018
363998
|
const [
|
|
364019
363999
|
loopDetectionConfirmationRequest,
|
|
364020
364000
|
setLoopDetectionConfirmationRequest
|
|
364021
|
-
] = (0,
|
|
364022
|
-
const onExec = (0,
|
|
364001
|
+
] = (0, import_react116.useState)(null);
|
|
364002
|
+
const onExec = (0, import_react116.useCallback)(async (done) => {
|
|
364023
364003
|
setIsResponding(true);
|
|
364024
364004
|
await done;
|
|
364025
364005
|
setIsResponding(false);
|
|
@@ -364042,12 +364022,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364042
364022
|
onVisionSwitchRequired
|
|
364043
364023
|
);
|
|
364044
364024
|
const activePtyId = activeShellPtyId || activeToolPtyId;
|
|
364045
|
-
(0,
|
|
364025
|
+
(0, import_react116.useEffect)(() => {
|
|
364046
364026
|
if (!activePtyId) {
|
|
364047
364027
|
setShellInputFocused(false);
|
|
364048
364028
|
}
|
|
364049
364029
|
}, [activePtyId, setShellInputFocused]);
|
|
364050
|
-
const streamingState = (0,
|
|
364030
|
+
const streamingState = (0, import_react116.useMemo)(() => {
|
|
364051
364031
|
if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
|
|
364052
364032
|
return "waiting_for_confirmation" /* WaitingForConfirmation */;
|
|
364053
364033
|
}
|
|
@@ -364058,7 +364038,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364058
364038
|
}
|
|
364059
364039
|
return "idle" /* Idle */;
|
|
364060
364040
|
}, [isResponding, toolCalls]);
|
|
364061
|
-
(0,
|
|
364041
|
+
(0, import_react116.useEffect)(() => {
|
|
364062
364042
|
if (config.getApprovalMode() === "yolo" /* YOLO */ && streamingState === "idle" /* Idle */) {
|
|
364063
364043
|
const lastUserMessageIndex = history.findLastIndex(
|
|
364064
364044
|
(item) => item.type === "user" /* USER */
|
|
@@ -364072,7 +364052,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364072
364052
|
}
|
|
364073
364053
|
}
|
|
364074
364054
|
}, [streamingState, config, history]);
|
|
364075
|
-
const cancelOngoingRequest = (0,
|
|
364055
|
+
const cancelOngoingRequest = (0, import_react116.useCallback)(() => {
|
|
364076
364056
|
if (streamingState !== "responding" /* Responding */) {
|
|
364077
364057
|
return;
|
|
364078
364058
|
}
|
|
@@ -364121,7 +364101,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364121
364101
|
},
|
|
364122
364102
|
{ isActive: streamingState === "responding" /* Responding */ }
|
|
364123
364103
|
);
|
|
364124
|
-
const prepareQueryForGemini = (0,
|
|
364104
|
+
const prepareQueryForGemini = (0, import_react116.useCallback)(
|
|
364125
364105
|
async (query, userMessageTimestamp, abortSignal, prompt_id) => {
|
|
364126
364106
|
if (turnCancelledRef.current) {
|
|
364127
364107
|
return { queryToSend: null, shouldProceed: false };
|
|
@@ -364216,7 +364196,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364216
364196
|
scheduleToolCalls
|
|
364217
364197
|
]
|
|
364218
364198
|
);
|
|
364219
|
-
const handleContentEvent = (0,
|
|
364199
|
+
const handleContentEvent = (0, import_react116.useCallback)(
|
|
364220
364200
|
(eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
|
|
364221
364201
|
if (turnCancelledRef.current) {
|
|
364222
364202
|
return "";
|
|
@@ -364252,7 +364232,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364252
364232
|
},
|
|
364253
364233
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem]
|
|
364254
364234
|
);
|
|
364255
|
-
const handleUserCancelledEvent = (0,
|
|
364235
|
+
const handleUserCancelledEvent = (0, import_react116.useCallback)(
|
|
364256
364236
|
(userMessageTimestamp) => {
|
|
364257
364237
|
if (turnCancelledRef.current) {
|
|
364258
364238
|
return;
|
|
@@ -364281,7 +364261,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364281
364261
|
},
|
|
364282
364262
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought]
|
|
364283
364263
|
);
|
|
364284
|
-
const handleErrorEvent = (0,
|
|
364264
|
+
const handleErrorEvent = (0, import_react116.useCallback)(
|
|
364285
364265
|
(eventValue, userMessageTimestamp) => {
|
|
364286
364266
|
if (pendingHistoryItemRef.current) {
|
|
364287
364267
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -364304,7 +364284,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364304
364284
|
},
|
|
364305
364285
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought]
|
|
364306
364286
|
);
|
|
364307
|
-
const handleCitationEvent = (0,
|
|
364287
|
+
const handleCitationEvent = (0, import_react116.useCallback)(
|
|
364308
364288
|
(text, userMessageTimestamp) => {
|
|
364309
364289
|
if (!showCitations(settings)) {
|
|
364310
364290
|
return;
|
|
@@ -364317,7 +364297,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364317
364297
|
},
|
|
364318
364298
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, settings]
|
|
364319
364299
|
);
|
|
364320
|
-
const handleFinishedEvent = (0,
|
|
364300
|
+
const handleFinishedEvent = (0, import_react116.useCallback)(
|
|
364321
364301
|
(event, userMessageTimestamp) => {
|
|
364322
364302
|
const finishReason = event.value.reason;
|
|
364323
364303
|
if (!finishReason) {
|
|
@@ -364351,7 +364331,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364351
364331
|
},
|
|
364352
364332
|
[addItem]
|
|
364353
364333
|
);
|
|
364354
|
-
const handleChatCompressionEvent = (0,
|
|
364334
|
+
const handleChatCompressionEvent = (0, import_react116.useCallback)(
|
|
364355
364335
|
(eventValue, userMessageTimestamp) => {
|
|
364356
364336
|
if (pendingHistoryItemRef.current) {
|
|
364357
364337
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -364367,7 +364347,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364367
364347
|
},
|
|
364368
364348
|
[addItem, config, pendingHistoryItemRef, setPendingHistoryItem]
|
|
364369
364349
|
);
|
|
364370
|
-
const handleMaxSessionTurnsEvent = (0,
|
|
364350
|
+
const handleMaxSessionTurnsEvent = (0, import_react116.useCallback)(
|
|
364371
364351
|
() => addItem(
|
|
364372
364352
|
{
|
|
364373
364353
|
type: "info",
|
|
@@ -364377,7 +364357,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364377
364357
|
),
|
|
364378
364358
|
[addItem, config]
|
|
364379
364359
|
);
|
|
364380
|
-
const handleSessionTokenLimitExceededEvent = (0,
|
|
364360
|
+
const handleSessionTokenLimitExceededEvent = (0, import_react116.useCallback)(
|
|
364381
364361
|
(value) => addItem(
|
|
364382
364362
|
{
|
|
364383
364363
|
type: "error",
|
|
@@ -364392,7 +364372,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364392
364372
|
),
|
|
364393
364373
|
[addItem]
|
|
364394
364374
|
);
|
|
364395
|
-
const handleLoopDetectionConfirmation = (0,
|
|
364375
|
+
const handleLoopDetectionConfirmation = (0, import_react116.useCallback)(
|
|
364396
364376
|
(result) => {
|
|
364397
364377
|
setLoopDetectionConfirmationRequest(null);
|
|
364398
364378
|
if (result.userSelection === "disable") {
|
|
@@ -364416,12 +364396,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364416
364396
|
},
|
|
364417
364397
|
[config, addItem]
|
|
364418
364398
|
);
|
|
364419
|
-
const handleLoopDetectedEvent = (0,
|
|
364399
|
+
const handleLoopDetectedEvent = (0, import_react116.useCallback)(() => {
|
|
364420
364400
|
setLoopDetectionConfirmationRequest({
|
|
364421
364401
|
onComplete: handleLoopDetectionConfirmation
|
|
364422
364402
|
});
|
|
364423
364403
|
}, [handleLoopDetectionConfirmation]);
|
|
364424
|
-
const processGeminiStreamEvents = (0,
|
|
364404
|
+
const processGeminiStreamEvents = (0, import_react116.useCallback)(
|
|
364425
364405
|
async (stream2, userMessageTimestamp, signal) => {
|
|
364426
364406
|
let geminiMessageBuffer = "";
|
|
364427
364407
|
const toolCallRequests = [];
|
|
@@ -364495,7 +364475,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364495
364475
|
handleCitationEvent
|
|
364496
364476
|
]
|
|
364497
364477
|
);
|
|
364498
|
-
const submitQuery = (0,
|
|
364478
|
+
const submitQuery = (0, import_react116.useCallback)(
|
|
364499
364479
|
async (query, options2, prompt_id) => {
|
|
364500
364480
|
if (isSubmittingQueryRef.current && !options2?.isContinuation) {
|
|
364501
364481
|
return;
|
|
@@ -364628,7 +364608,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364628
364608
|
restoreOriginalModel
|
|
364629
364609
|
]
|
|
364630
364610
|
);
|
|
364631
|
-
const handleApprovalModeChange = (0,
|
|
364611
|
+
const handleApprovalModeChange = (0, import_react116.useCallback)(
|
|
364632
364612
|
async (newApprovalMode) => {
|
|
364633
364613
|
if (newApprovalMode === "yolo" /* YOLO */ || newApprovalMode === "auto-edit" /* AUTO_EDIT */) {
|
|
364634
364614
|
let awaitingApprovalCalls = toolCalls.filter(
|
|
@@ -364657,7 +364637,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364657
364637
|
},
|
|
364658
364638
|
[toolCalls]
|
|
364659
364639
|
);
|
|
364660
|
-
const handleCompletedTools = (0,
|
|
364640
|
+
const handleCompletedTools = (0, import_react116.useCallback)(
|
|
364661
364641
|
async (completedToolCallsFromScheduler) => {
|
|
364662
364642
|
if (isResponding) {
|
|
364663
364643
|
return;
|
|
@@ -364742,13 +364722,13 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364742
364722
|
modelSwitchedFromQuotaError
|
|
364743
364723
|
]
|
|
364744
364724
|
);
|
|
364745
|
-
const pendingHistoryItems = (0,
|
|
364725
|
+
const pendingHistoryItems = (0, import_react116.useMemo)(
|
|
364746
364726
|
() => [pendingHistoryItem, pendingToolCallGroupDisplay].filter(
|
|
364747
364727
|
(i) => i !== void 0 && i !== null
|
|
364748
364728
|
),
|
|
364749
364729
|
[pendingHistoryItem, pendingToolCallGroupDisplay]
|
|
364750
364730
|
);
|
|
364751
|
-
(0,
|
|
364731
|
+
(0, import_react116.useEffect)(() => {
|
|
364752
364732
|
const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
|
|
364753
364733
|
if (!config.getCheckpointingEnabled()) {
|
|
364754
364734
|
return;
|
|
@@ -364867,7 +364847,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
364867
364847
|
|
|
364868
364848
|
// packages/cli/src/ui/hooks/vim.ts
|
|
364869
364849
|
init_esbuild_shims();
|
|
364870
|
-
var
|
|
364850
|
+
var import_react117 = __toESM(require_react(), 1);
|
|
364871
364851
|
var DIGIT_MULTIPLIER = 10;
|
|
364872
364852
|
var DEFAULT_COUNT = 1;
|
|
364873
364853
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -364930,22 +364910,22 @@ var vimReducer = /* @__PURE__ */ __name((state, action) => {
|
|
|
364930
364910
|
}, "vimReducer");
|
|
364931
364911
|
function useVim(buffer, onSubmit) {
|
|
364932
364912
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
364933
|
-
const [state, dispatch] = (0,
|
|
364934
|
-
(0,
|
|
364913
|
+
const [state, dispatch] = (0, import_react117.useReducer)(vimReducer, initialVimState);
|
|
364914
|
+
(0, import_react117.useEffect)(() => {
|
|
364935
364915
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
364936
364916
|
}, [vimMode]);
|
|
364937
|
-
const updateMode = (0,
|
|
364917
|
+
const updateMode = (0, import_react117.useCallback)(
|
|
364938
364918
|
(mode) => {
|
|
364939
364919
|
setVimMode(mode);
|
|
364940
364920
|
dispatch({ type: "SET_MODE", mode });
|
|
364941
364921
|
},
|
|
364942
364922
|
[setVimMode]
|
|
364943
364923
|
);
|
|
364944
|
-
const getCurrentCount = (0,
|
|
364924
|
+
const getCurrentCount = (0, import_react117.useCallback)(
|
|
364945
364925
|
() => state.count || DEFAULT_COUNT,
|
|
364946
364926
|
[state.count]
|
|
364947
364927
|
);
|
|
364948
|
-
const executeCommand = (0,
|
|
364928
|
+
const executeCommand = (0, import_react117.useCallback)(
|
|
364949
364929
|
(cmdType, count) => {
|
|
364950
364930
|
switch (cmdType) {
|
|
364951
364931
|
case CMD_TYPES.DELETE_WORD_FORWARD: {
|
|
@@ -365021,7 +365001,7 @@ function useVim(buffer, onSubmit) {
|
|
|
365021
365001
|
},
|
|
365022
365002
|
[buffer, updateMode]
|
|
365023
365003
|
);
|
|
365024
|
-
const handleInsertModeInput = (0,
|
|
365004
|
+
const handleInsertModeInput = (0, import_react117.useCallback)(
|
|
365025
365005
|
(normalizedKey) => {
|
|
365026
365006
|
if (normalizedKey.name === "escape") {
|
|
365027
365007
|
buffer.vimEscapeInsertMode();
|
|
@@ -365052,7 +365032,7 @@ function useVim(buffer, onSubmit) {
|
|
|
365052
365032
|
},
|
|
365053
365033
|
[buffer, dispatch, updateMode, onSubmit]
|
|
365054
365034
|
);
|
|
365055
|
-
const normalizeKey = (0,
|
|
365035
|
+
const normalizeKey = (0, import_react117.useCallback)(
|
|
365056
365036
|
(key) => ({
|
|
365057
365037
|
name: key.name || "",
|
|
365058
365038
|
sequence: key.sequence || "",
|
|
@@ -365063,7 +365043,7 @@ function useVim(buffer, onSubmit) {
|
|
|
365063
365043
|
}),
|
|
365064
365044
|
[]
|
|
365065
365045
|
);
|
|
365066
|
-
const handleChangeMovement = (0,
|
|
365046
|
+
const handleChangeMovement = (0, import_react117.useCallback)(
|
|
365067
365047
|
(movement) => {
|
|
365068
365048
|
const count = getCurrentCount();
|
|
365069
365049
|
dispatch({ type: "CLEAR_COUNT" });
|
|
@@ -365084,7 +365064,7 @@ function useVim(buffer, onSubmit) {
|
|
|
365084
365064
|
},
|
|
365085
365065
|
[getCurrentCount, dispatch, buffer, updateMode]
|
|
365086
365066
|
);
|
|
365087
|
-
const handleOperatorMotion = (0,
|
|
365067
|
+
const handleOperatorMotion = (0, import_react117.useCallback)(
|
|
365088
365068
|
(operator2, motion) => {
|
|
365089
365069
|
const count = getCurrentCount();
|
|
365090
365070
|
const commandMap = {
|
|
@@ -365111,7 +365091,7 @@ function useVim(buffer, onSubmit) {
|
|
|
365111
365091
|
},
|
|
365112
365092
|
[getCurrentCount, executeCommand, dispatch]
|
|
365113
365093
|
);
|
|
365114
|
-
const handleInput = (0,
|
|
365094
|
+
const handleInput = (0, import_react117.useCallback)(
|
|
365115
365095
|
(key) => {
|
|
365116
365096
|
if (!vimEnabled) {
|
|
365117
365097
|
return false;
|
|
@@ -365414,14 +365394,14 @@ init_settings();
|
|
|
365414
365394
|
|
|
365415
365395
|
// packages/cli/src/ui/hooks/useBracketedPaste.ts
|
|
365416
365396
|
init_esbuild_shims();
|
|
365417
|
-
var
|
|
365397
|
+
var import_react118 = __toESM(require_react(), 1);
|
|
365418
365398
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
365419
365399
|
var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
365420
365400
|
var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
365421
365401
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
365422
365402
|
process.stdout.write(DISABLE_BRACKETED_PASTE);
|
|
365423
365403
|
}, "cleanup");
|
|
365424
|
-
(0,
|
|
365404
|
+
(0, import_react118.useEffect)(() => {
|
|
365425
365405
|
process.stdout.write(ENABLE_BRACKETED_PASTE);
|
|
365426
365406
|
process.on("exit", cleanup);
|
|
365427
365407
|
process.on("SIGINT", cleanup);
|
|
@@ -365440,13 +365420,13 @@ init_esbuild_shims();
|
|
|
365440
365420
|
|
|
365441
365421
|
// packages/cli/src/ui/hooks/useTimer.ts
|
|
365442
365422
|
init_esbuild_shims();
|
|
365443
|
-
var
|
|
365423
|
+
var import_react119 = __toESM(require_react(), 1);
|
|
365444
365424
|
var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
365445
|
-
const [elapsedTime, setElapsedTime] = (0,
|
|
365446
|
-
const timerRef = (0,
|
|
365447
|
-
const prevResetKeyRef = (0,
|
|
365448
|
-
const prevIsActiveRef = (0,
|
|
365449
|
-
(0,
|
|
365425
|
+
const [elapsedTime, setElapsedTime] = (0, import_react119.useState)(0);
|
|
365426
|
+
const timerRef = (0, import_react119.useRef)(null);
|
|
365427
|
+
const prevResetKeyRef = (0, import_react119.useRef)(resetKey);
|
|
365428
|
+
const prevIsActiveRef = (0, import_react119.useRef)(isActive);
|
|
365429
|
+
(0, import_react119.useEffect)(() => {
|
|
365450
365430
|
let shouldResetTime = false;
|
|
365451
365431
|
if (prevResetKeyRef.current !== resetKey) {
|
|
365452
365432
|
shouldResetTime = true;
|
|
@@ -365484,119 +365464,149 @@ var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
|
365484
365464
|
|
|
365485
365465
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
365486
365466
|
init_esbuild_shims();
|
|
365487
|
-
var
|
|
365467
|
+
var import_react120 = __toESM(require_react(), 1);
|
|
365488
365468
|
var WITTY_LOADING_PHRASES = [
|
|
365489
|
-
"
|
|
365490
|
-
"
|
|
365491
|
-
"
|
|
365492
|
-
"
|
|
365493
|
-
"
|
|
365494
|
-
"
|
|
365495
|
-
"
|
|
365496
|
-
"
|
|
365497
|
-
"
|
|
365498
|
-
"
|
|
365499
|
-
"
|
|
365500
|
-
"
|
|
365501
|
-
"
|
|
365502
|
-
"
|
|
365503
|
-
"
|
|
365504
|
-
"
|
|
365505
|
-
"
|
|
365506
|
-
"
|
|
365507
|
-
"
|
|
365508
|
-
"
|
|
365509
|
-
"
|
|
365510
|
-
"
|
|
365511
|
-
"
|
|
365512
|
-
"
|
|
365513
|
-
"
|
|
365514
|
-
"
|
|
365515
|
-
"
|
|
365516
|
-
"
|
|
365517
|
-
"
|
|
365518
|
-
"
|
|
365519
|
-
"
|
|
365520
|
-
"
|
|
365521
|
-
"
|
|
365522
|
-
"
|
|
365523
|
-
"
|
|
365524
|
-
"
|
|
365525
|
-
"
|
|
365526
|
-
"
|
|
365527
|
-
"
|
|
365528
|
-
"
|
|
365529
|
-
"
|
|
365530
|
-
"
|
|
365531
|
-
"
|
|
365532
|
-
"
|
|
365533
|
-
"
|
|
365534
|
-
"
|
|
365535
|
-
"
|
|
365536
|
-
"
|
|
365537
|
-
"
|
|
365538
|
-
"
|
|
365539
|
-
"
|
|
365540
|
-
"
|
|
365541
|
-
"
|
|
365542
|
-
"
|
|
365543
|
-
"
|
|
365544
|
-
"
|
|
365545
|
-
"
|
|
365546
|
-
"
|
|
365547
|
-
"
|
|
365548
|
-
"
|
|
365549
|
-
"
|
|
365550
|
-
"
|
|
365551
|
-
"
|
|
365552
|
-
"
|
|
365553
|
-
"
|
|
365554
|
-
"
|
|
365555
|
-
"
|
|
365556
|
-
"
|
|
365557
|
-
"
|
|
365558
|
-
"
|
|
365559
|
-
"
|
|
365560
|
-
"
|
|
365561
|
-
"
|
|
365562
|
-
"
|
|
365563
|
-
"
|
|
365564
|
-
"
|
|
365565
|
-
"
|
|
365566
|
-
"
|
|
365567
|
-
"
|
|
365568
|
-
"
|
|
365569
|
-
"
|
|
365570
|
-
"
|
|
365571
|
-
"
|
|
365572
|
-
"
|
|
365573
|
-
"
|
|
365574
|
-
"
|
|
365575
|
-
|
|
365576
|
-
"
|
|
365577
|
-
"
|
|
365578
|
-
"
|
|
365579
|
-
"
|
|
365580
|
-
"
|
|
365581
|
-
'
|
|
365582
|
-
"
|
|
365583
|
-
"
|
|
365584
|
-
"
|
|
365585
|
-
"
|
|
365586
|
-
"
|
|
365587
|
-
"
|
|
365469
|
+
"I'm Feeling Lucky",
|
|
365470
|
+
"Shipping awesomeness... ",
|
|
365471
|
+
"Painting the serifs back on...",
|
|
365472
|
+
"Navigating the slime mold...",
|
|
365473
|
+
"Consulting the digital spirits...",
|
|
365474
|
+
"Reticulating splines...",
|
|
365475
|
+
"Warming up the AI hamsters...",
|
|
365476
|
+
"Asking the magic conch shell...",
|
|
365477
|
+
"Generating witty retort...",
|
|
365478
|
+
"Polishing the algorithms...",
|
|
365479
|
+
"Don't rush perfection (or my code)...",
|
|
365480
|
+
"Brewing fresh bytes...",
|
|
365481
|
+
"Counting electrons...",
|
|
365482
|
+
"Engaging cognitive processors...",
|
|
365483
|
+
"Checking for syntax errors in the universe...",
|
|
365484
|
+
"One moment, optimizing humor...",
|
|
365485
|
+
"Shuffling punchlines...",
|
|
365486
|
+
"Untangling neural nets...",
|
|
365487
|
+
"Compiling brilliance...",
|
|
365488
|
+
"Loading wit.exe...",
|
|
365489
|
+
"Summoning the cloud of wisdom...",
|
|
365490
|
+
"Preparing a witty response...",
|
|
365491
|
+
"Just a sec, I'm debugging reality...",
|
|
365492
|
+
"Confuzzling the options...",
|
|
365493
|
+
"Tuning the cosmic frequencies...",
|
|
365494
|
+
"Crafting a response worthy of your patience...",
|
|
365495
|
+
"Compiling the 1s and 0s...",
|
|
365496
|
+
"Resolving dependencies... and existential crises...",
|
|
365497
|
+
"Defragmenting memories... both RAM and personal...",
|
|
365498
|
+
"Rebooting the humor module...",
|
|
365499
|
+
"Caching the essentials (mostly cat memes)...",
|
|
365500
|
+
"Optimizing for ludicrous speed",
|
|
365501
|
+
"Swapping bits... don't tell the bytes...",
|
|
365502
|
+
"Garbage collecting... be right back...",
|
|
365503
|
+
"Assembling the interwebs...",
|
|
365504
|
+
"Converting coffee into code...",
|
|
365505
|
+
"Updating the syntax for reality...",
|
|
365506
|
+
"Rewiring the synapses...",
|
|
365507
|
+
"Looking for a misplaced semicolon...",
|
|
365508
|
+
"Greasin' the cogs of the machine...",
|
|
365509
|
+
"Pre-heating the servers...",
|
|
365510
|
+
"Calibrating the flux capacitor...",
|
|
365511
|
+
"Engaging the improbability drive...",
|
|
365512
|
+
"Channeling the Force...",
|
|
365513
|
+
"Aligning the stars for optimal response...",
|
|
365514
|
+
"So say we all...",
|
|
365515
|
+
"Loading the next great idea...",
|
|
365516
|
+
"Just a moment, I'm in the zone...",
|
|
365517
|
+
"Preparing to dazzle you with brilliance...",
|
|
365518
|
+
"Just a tick, I'm polishing my wit...",
|
|
365519
|
+
"Hold tight, I'm crafting a masterpiece...",
|
|
365520
|
+
"Just a jiffy, I'm debugging the universe...",
|
|
365521
|
+
"Just a moment, I'm aligning the pixels...",
|
|
365522
|
+
"Just a sec, I'm optimizing the humor...",
|
|
365523
|
+
"Just a moment, I'm tuning the algorithms...",
|
|
365524
|
+
"Warp speed engaged...",
|
|
365525
|
+
"Mining for more Dilithium crystals...",
|
|
365526
|
+
"Don't panic...",
|
|
365527
|
+
"Following the white rabbit...",
|
|
365528
|
+
"The truth is in here... somewhere...",
|
|
365529
|
+
"Blowing on the cartridge...",
|
|
365530
|
+
"Loading... Do a barrel roll!",
|
|
365531
|
+
"Waiting for the respawn...",
|
|
365532
|
+
"Finishing the Kessel Run in less than 12 parsecs...",
|
|
365533
|
+
"The cake is not a lie, it's just still loading...",
|
|
365534
|
+
"Fiddling with the character creation screen...",
|
|
365535
|
+
"Just a moment, I'm finding the right meme...",
|
|
365536
|
+
"Pressing 'A' to continue...",
|
|
365537
|
+
"Herding digital cats...",
|
|
365538
|
+
"Polishing the pixels...",
|
|
365539
|
+
"Finding a suitable loading screen pun...",
|
|
365540
|
+
"Distracting you with this witty phrase...",
|
|
365541
|
+
"Almost there... probably...",
|
|
365542
|
+
"Our hamsters are working as fast as they can...",
|
|
365543
|
+
"Giving Cloudy a pat on the head...",
|
|
365544
|
+
"Petting the cat...",
|
|
365545
|
+
"Rickrolling my boss...",
|
|
365546
|
+
"Never gonna give you up, never gonna let you down...",
|
|
365547
|
+
"Slapping the bass...",
|
|
365548
|
+
"Tasting the snozberries...",
|
|
365549
|
+
"I'm going the distance, I'm going for speed...",
|
|
365550
|
+
"Is this the real life? Is this just fantasy?...",
|
|
365551
|
+
"I've got a good feeling about this...",
|
|
365552
|
+
"Poking the bear...",
|
|
365553
|
+
"Doing research on the latest memes...",
|
|
365554
|
+
"Figuring out how to make this more witty...",
|
|
365555
|
+
"Hmmm... let me think...",
|
|
365556
|
+
"What do you call a fish with no eyes? A fsh...",
|
|
365557
|
+
"Why did the computer go to therapy? It had too many bytes...",
|
|
365558
|
+
"Why don't programmers like nature? It has too many bugs...",
|
|
365559
|
+
"Why do programmers prefer dark mode? Because light attracts bugs...",
|
|
365560
|
+
"Why did the developer go broke? Because they used up all their cache...",
|
|
365561
|
+
"What can you do with a broken pencil? Nothing, it's pointless...",
|
|
365562
|
+
"Applying percussive maintenance...",
|
|
365563
|
+
"Searching for the correct USB orientation...",
|
|
365564
|
+
"Ensuring the magic smoke stays inside the wires...",
|
|
365565
|
+
"Rewriting in Rust for no particular reason...",
|
|
365566
|
+
"Trying to exit Vim...",
|
|
365567
|
+
"Spinning up the hamster wheel...",
|
|
365568
|
+
"That's not a bug, it's an undocumented feature...",
|
|
365569
|
+
"Engage.",
|
|
365570
|
+
"I'll be back... with an answer.",
|
|
365571
|
+
"My other process is a TARDIS...",
|
|
365572
|
+
"Communing with the machine spirit...",
|
|
365573
|
+
"Letting the thoughts marinate...",
|
|
365574
|
+
"Just remembered where I put my keys...",
|
|
365575
|
+
"Pondering the orb...",
|
|
365576
|
+
"I've seen things you people wouldn't believe... like a user who reads loading messages.",
|
|
365577
|
+
"Initiating thoughtful gaze...",
|
|
365578
|
+
"What's a computer's favorite snack? Microchips.",
|
|
365579
|
+
"Why do Java developers wear glasses? Because they don't C#.",
|
|
365580
|
+
"Charging the laser... pew pew!",
|
|
365581
|
+
"Dividing by zero... just kidding!",
|
|
365582
|
+
"Looking for an adult superviso... I mean, processing.",
|
|
365583
|
+
"Making it go beep boop.",
|
|
365584
|
+
"Buffering... because even AIs need a moment.",
|
|
365585
|
+
"Entangling quantum particles for a faster response...",
|
|
365586
|
+
"Polishing the chrome... on the algorithms.",
|
|
365587
|
+
"Are you not entertained? (Working on it!)",
|
|
365588
|
+
"Summoning the code gremlins... to help, of course.",
|
|
365589
|
+
"Just waiting for the dial-up tone to finish...",
|
|
365590
|
+
"Recalibrating the humor-o-meter.",
|
|
365591
|
+
"My other loading screen is even funnier.",
|
|
365592
|
+
"Pretty sure there's a cat walking on the keyboard somewhere...",
|
|
365593
|
+
"Enhancing... Enhancing... Still loading.",
|
|
365594
|
+
"It's not a bug, it's a feature... of this loading screen.",
|
|
365595
|
+
"Have you tried turning it off and on again? (The loading screen, not me.)",
|
|
365596
|
+
"Constructing additional pylons...",
|
|
365597
|
+
"New line? That\u2019s Ctrl+J."
|
|
365588
365598
|
];
|
|
365589
365599
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
365590
365600
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
365591
|
-
const loadingPhrases = (0,
|
|
365601
|
+
const loadingPhrases = (0, import_react120.useMemo)(
|
|
365592
365602
|
() => customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES.map((phrase) => t2(phrase)),
|
|
365593
365603
|
[customPhrases]
|
|
365594
365604
|
);
|
|
365595
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
365605
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react120.useState)(
|
|
365596
365606
|
loadingPhrases[0]
|
|
365597
365607
|
);
|
|
365598
|
-
const phraseIntervalRef = (0,
|
|
365599
|
-
(0,
|
|
365608
|
+
const phraseIntervalRef = (0, import_react120.useRef)(null);
|
|
365609
|
+
(0, import_react120.useEffect)(() => {
|
|
365600
365610
|
if (isWaiting) {
|
|
365601
365611
|
setCurrentLoadingPhrase(t2("Waiting for user confirmation..."));
|
|
365602
365612
|
if (phraseIntervalRef.current) {
|
|
@@ -365633,9 +365643,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
365633
365643
|
}, "usePhraseCycler");
|
|
365634
365644
|
|
|
365635
365645
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
365636
|
-
var
|
|
365646
|
+
var import_react121 = __toESM(require_react(), 1);
|
|
365637
365647
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases) => {
|
|
365638
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
365648
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react121.useState)(0);
|
|
365639
365649
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
365640
365650
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
365641
365651
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -365645,9 +365655,9 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
365645
365655
|
isWaiting,
|
|
365646
365656
|
customWittyPhrases
|
|
365647
365657
|
);
|
|
365648
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
365649
|
-
const prevStreamingStateRef = (0,
|
|
365650
|
-
(0,
|
|
365658
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react121.useState)(0);
|
|
365659
|
+
const prevStreamingStateRef = (0, import_react121.useRef)(null);
|
|
365660
|
+
(0, import_react121.useEffect)(() => {
|
|
365651
365661
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
365652
365662
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
365653
365663
|
setRetainedElapsedTime(0);
|
|
@@ -365667,21 +365677,21 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
365667
365677
|
|
|
365668
365678
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
365669
365679
|
init_esbuild_shims();
|
|
365670
|
-
var
|
|
365680
|
+
var import_react122 = __toESM(require_react(), 1);
|
|
365671
365681
|
init_trustedFolders();
|
|
365672
365682
|
import * as process39 from "node:process";
|
|
365673
365683
|
var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
365674
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
365675
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
365676
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
365684
|
+
const [isTrusted, setIsTrusted] = (0, import_react122.useState)(void 0);
|
|
365685
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react122.useState)(false);
|
|
365686
|
+
const [isRestarting, setIsRestarting] = (0, import_react122.useState)(false);
|
|
365677
365687
|
const folderTrust = settings.merged.security?.folderTrust?.enabled;
|
|
365678
|
-
(0,
|
|
365688
|
+
(0, import_react122.useEffect)(() => {
|
|
365679
365689
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
|
|
365680
365690
|
setIsTrusted(trusted);
|
|
365681
365691
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
365682
365692
|
onTrustChange(trusted);
|
|
365683
365693
|
}, [folderTrust, onTrustChange, settings.merged]);
|
|
365684
|
-
const handleFolderTrustSelect = (0,
|
|
365694
|
+
const handleFolderTrustSelect = (0, import_react122.useCallback)(
|
|
365685
365695
|
(choice2) => {
|
|
365686
365696
|
const trustedFolders = loadTrustedFolders();
|
|
365687
365697
|
const cwd7 = process39.cwd();
|
|
@@ -368815,27 +368825,27 @@ __name(setUpdateHandler, "setUpdateHandler");
|
|
|
368815
368825
|
|
|
368816
368826
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
368817
368827
|
init_esbuild_shims();
|
|
368818
|
-
var
|
|
368828
|
+
var import_react123 = __toESM(require_react(), 1);
|
|
368819
368829
|
function useMessageQueue({
|
|
368820
368830
|
isConfigInitialized,
|
|
368821
368831
|
streamingState,
|
|
368822
368832
|
submitQuery
|
|
368823
368833
|
}) {
|
|
368824
|
-
const [messageQueue, setMessageQueue] = (0,
|
|
368825
|
-
const addMessage = (0,
|
|
368834
|
+
const [messageQueue, setMessageQueue] = (0, import_react123.useState)([]);
|
|
368835
|
+
const addMessage = (0, import_react123.useCallback)((message) => {
|
|
368826
368836
|
const trimmedMessage = message.trim();
|
|
368827
368837
|
if (trimmedMessage.length > 0) {
|
|
368828
368838
|
setMessageQueue((prev) => [...prev, trimmedMessage]);
|
|
368829
368839
|
}
|
|
368830
368840
|
}, []);
|
|
368831
|
-
const clearQueue = (0,
|
|
368841
|
+
const clearQueue = (0, import_react123.useCallback)(() => {
|
|
368832
368842
|
setMessageQueue([]);
|
|
368833
368843
|
}, []);
|
|
368834
|
-
const getQueuedMessagesText = (0,
|
|
368844
|
+
const getQueuedMessagesText = (0, import_react123.useCallback)(() => {
|
|
368835
368845
|
if (messageQueue.length === 0) return "";
|
|
368836
368846
|
return messageQueue.join("\n\n");
|
|
368837
368847
|
}, [messageQueue]);
|
|
368838
|
-
(0,
|
|
368848
|
+
(0, import_react123.useEffect)(() => {
|
|
368839
368849
|
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
368840
368850
|
const combinedMessage = messageQueue.join("\n\n");
|
|
368841
368851
|
setMessageQueue([]);
|
|
@@ -368854,15 +368864,15 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
368854
368864
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
368855
368865
|
init_esbuild_shims();
|
|
368856
368866
|
init_core2();
|
|
368857
|
-
var
|
|
368867
|
+
var import_react124 = __toESM(require_react(), 1);
|
|
368858
368868
|
function useAutoAcceptIndicator({
|
|
368859
368869
|
config,
|
|
368860
368870
|
addItem,
|
|
368861
368871
|
onApprovalModeChange
|
|
368862
368872
|
}) {
|
|
368863
368873
|
const currentConfigValue = config.getApprovalMode();
|
|
368864
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
368865
|
-
(0,
|
|
368874
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react124.useState)(currentConfigValue);
|
|
368875
|
+
(0, import_react124.useEffect)(() => {
|
|
368866
368876
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
368867
368877
|
}, [currentConfigValue]);
|
|
368868
368878
|
useKeypress(
|
|
@@ -368895,16 +368905,16 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
368895
368905
|
|
|
368896
368906
|
// packages/cli/src/ui/hooks/useWorkspaceMigration.ts
|
|
368897
368907
|
init_esbuild_shims();
|
|
368898
|
-
var
|
|
368908
|
+
var import_react125 = __toESM(require_react(), 1);
|
|
368899
368909
|
init_extension();
|
|
368900
368910
|
init_settings();
|
|
368901
368911
|
import process49 from "node:process";
|
|
368902
368912
|
function useWorkspaceMigration(settings) {
|
|
368903
|
-
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0,
|
|
368904
|
-
const [workspaceExtensions, setWorkspaceExtensions] = (0,
|
|
368913
|
+
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0, import_react125.useState)(false);
|
|
368914
|
+
const [workspaceExtensions, setWorkspaceExtensions] = (0, import_react125.useState)(
|
|
368905
368915
|
[]
|
|
368906
368916
|
);
|
|
368907
|
-
(0,
|
|
368917
|
+
(0, import_react125.useEffect)(() => {
|
|
368908
368918
|
if (!(settings.merged.experimental?.extensionManagement ?? true)) {
|
|
368909
368919
|
return;
|
|
368910
368920
|
}
|
|
@@ -368946,14 +368956,14 @@ __name(useWorkspaceMigration, "useWorkspaceMigration");
|
|
|
368946
368956
|
|
|
368947
368957
|
// packages/cli/src/ui/hooks/useGitBranchName.ts
|
|
368948
368958
|
init_esbuild_shims();
|
|
368949
|
-
var
|
|
368959
|
+
var import_react126 = __toESM(require_react(), 1);
|
|
368950
368960
|
init_core2();
|
|
368951
368961
|
import fs98 from "node:fs";
|
|
368952
368962
|
import fsPromises7 from "node:fs/promises";
|
|
368953
368963
|
import path112 from "node:path";
|
|
368954
368964
|
function useGitBranchName(cwd7) {
|
|
368955
|
-
const [branchName, setBranchName] = (0,
|
|
368956
|
-
const fetchBranchName = (0,
|
|
368965
|
+
const [branchName, setBranchName] = (0, import_react126.useState)(void 0);
|
|
368966
|
+
const fetchBranchName = (0, import_react126.useCallback)(async () => {
|
|
368957
368967
|
try {
|
|
368958
368968
|
if (!isCommandAvailable("git").available) {
|
|
368959
368969
|
return;
|
|
@@ -368978,7 +368988,7 @@ function useGitBranchName(cwd7) {
|
|
|
368978
368988
|
setBranchName(void 0);
|
|
368979
368989
|
}
|
|
368980
368990
|
}, [cwd7, setBranchName]);
|
|
368981
|
-
(0,
|
|
368991
|
+
(0, import_react126.useEffect)(() => {
|
|
368982
368992
|
fetchBranchName();
|
|
368983
368993
|
const gitLogsHeadPath = path112.join(cwd7, ".git", "logs", "HEAD");
|
|
368984
368994
|
let watcher;
|
|
@@ -369006,7 +369016,7 @@ __name(useGitBranchName, "useGitBranchName");
|
|
|
369006
369016
|
init_esbuild_shims();
|
|
369007
369017
|
init_errors4();
|
|
369008
369018
|
init_extensions();
|
|
369009
|
-
var
|
|
369019
|
+
var import_react127 = __toESM(require_react(), 1);
|
|
369010
369020
|
init_extension();
|
|
369011
369021
|
init_checks();
|
|
369012
369022
|
function confirmationRequestsReducer(state, action) {
|
|
@@ -369022,15 +369032,15 @@ function confirmationRequestsReducer(state, action) {
|
|
|
369022
369032
|
}
|
|
369023
369033
|
__name(confirmationRequestsReducer, "confirmationRequestsReducer");
|
|
369024
369034
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) => {
|
|
369025
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
369035
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react127.useReducer)(
|
|
369026
369036
|
extensionUpdatesReducer,
|
|
369027
369037
|
initialExtensionUpdatesState
|
|
369028
369038
|
);
|
|
369029
369039
|
const [
|
|
369030
369040
|
confirmUpdateExtensionRequests,
|
|
369031
369041
|
dispatchConfirmUpdateExtensionRequests
|
|
369032
|
-
] = (0,
|
|
369033
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
369042
|
+
] = (0, import_react127.useReducer)(confirmationRequestsReducer, []);
|
|
369043
|
+
const addConfirmUpdateExtensionRequest = (0, import_react127.useCallback)(
|
|
369034
369044
|
(original) => {
|
|
369035
369045
|
const wrappedRequest = {
|
|
369036
369046
|
prompt: original.prompt,
|
|
@@ -369049,7 +369059,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
369049
369059
|
},
|
|
369050
369060
|
[dispatchConfirmUpdateExtensionRequests]
|
|
369051
369061
|
);
|
|
369052
|
-
(0,
|
|
369062
|
+
(0, import_react127.useEffect)(() => {
|
|
369053
369063
|
(async () => {
|
|
369054
369064
|
await checkForAllExtensionUpdates(
|
|
369055
369065
|
extensions,
|
|
@@ -369057,7 +369067,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
369057
369067
|
);
|
|
369058
369068
|
})();
|
|
369059
369069
|
}, [extensions, extensions.length, dispatchExtensionStateUpdate]);
|
|
369060
|
-
(0,
|
|
369070
|
+
(0, import_react127.useEffect)(() => {
|
|
369061
369071
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
369062
369072
|
return;
|
|
369063
369073
|
}
|
|
@@ -369122,7 +369132,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
369122
369132
|
addItem,
|
|
369123
369133
|
cwd7
|
|
369124
369134
|
]);
|
|
369125
|
-
const extensionsUpdateStateComputed = (0,
|
|
369135
|
+
const extensionsUpdateStateComputed = (0, import_react127.useMemo)(() => {
|
|
369126
369136
|
const result = /* @__PURE__ */ new Map();
|
|
369127
369137
|
for (const [
|
|
369128
369138
|
key,
|
|
@@ -369143,13 +369153,13 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
369143
369153
|
|
|
369144
369154
|
// packages/cli/src/ui/hooks/useQuitConfirmation.ts
|
|
369145
369155
|
init_esbuild_shims();
|
|
369146
|
-
var
|
|
369156
|
+
var import_react128 = __toESM(require_react(), 1);
|
|
369147
369157
|
var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
369148
|
-
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0,
|
|
369149
|
-
const showQuitConfirmation = (0,
|
|
369158
|
+
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0, import_react128.useState)(false);
|
|
369159
|
+
const showQuitConfirmation = (0, import_react128.useCallback)(() => {
|
|
369150
369160
|
setIsQuitConfirmationOpen(true);
|
|
369151
369161
|
}, []);
|
|
369152
|
-
const handleQuitConfirmationSelect = (0,
|
|
369162
|
+
const handleQuitConfirmationSelect = (0, import_react128.useCallback)((choice2) => {
|
|
369153
369163
|
setIsQuitConfirmationOpen(false);
|
|
369154
369164
|
if (choice2 === "cancel" /* CANCEL */) {
|
|
369155
369165
|
return { shouldQuit: false, action: "cancel" };
|
|
@@ -369171,16 +369181,16 @@ var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
|
369171
369181
|
|
|
369172
369182
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
369173
369183
|
init_esbuild_shims();
|
|
369174
|
-
var
|
|
369184
|
+
var import_react129 = __toESM(require_react(), 1);
|
|
369175
369185
|
init_core2();
|
|
369176
369186
|
init_settingsSchema();
|
|
369177
369187
|
function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
369178
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
369179
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
369180
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
369181
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
369182
|
-
const [inputFillText, setInputFillText] = (0,
|
|
369183
|
-
const checkWelcomeBack = (0,
|
|
369188
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react129.useState)(null);
|
|
369189
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react129.useState)(false);
|
|
369190
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react129.useState)(null);
|
|
369191
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react129.useState)(false);
|
|
369192
|
+
const [inputFillText, setInputFillText] = (0, import_react129.useState)(null);
|
|
369193
|
+
const checkWelcomeBack = (0, import_react129.useCallback)(async () => {
|
|
369184
369194
|
if (settings.ui?.enableWelcomeBack === false) {
|
|
369185
369195
|
return;
|
|
369186
369196
|
}
|
|
@@ -369194,7 +369204,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
369194
369204
|
console.debug("Welcome back check failed:", error);
|
|
369195
369205
|
}
|
|
369196
369206
|
}, [settings.ui?.enableWelcomeBack]);
|
|
369197
|
-
const handleWelcomeBackSelection = (0,
|
|
369207
|
+
const handleWelcomeBackSelection = (0, import_react129.useCallback)(
|
|
369198
369208
|
(choice2) => {
|
|
369199
369209
|
setWelcomeBackChoice(choice2);
|
|
369200
369210
|
setShowWelcomeBackDialog(false);
|
|
@@ -369206,21 +369216,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
369206
369216
|
},
|
|
369207
369217
|
[welcomeBackInfo]
|
|
369208
369218
|
);
|
|
369209
|
-
const handleWelcomeBackClose = (0,
|
|
369219
|
+
const handleWelcomeBackClose = (0, import_react129.useCallback)(() => {
|
|
369210
369220
|
setWelcomeBackChoice("restart");
|
|
369211
369221
|
setShowWelcomeBackDialog(false);
|
|
369212
369222
|
}, []);
|
|
369213
|
-
const clearInputFill = (0,
|
|
369223
|
+
const clearInputFill = (0, import_react129.useCallback)(() => {
|
|
369214
369224
|
setShouldFillInput(false);
|
|
369215
369225
|
setInputFillText(null);
|
|
369216
369226
|
}, []);
|
|
369217
|
-
(0,
|
|
369227
|
+
(0, import_react129.useEffect)(() => {
|
|
369218
369228
|
if (shouldFillInput && inputFillText) {
|
|
369219
369229
|
buffer.setText(inputFillText);
|
|
369220
369230
|
clearInputFill();
|
|
369221
369231
|
}
|
|
369222
369232
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
369223
|
-
(0,
|
|
369233
|
+
(0, import_react129.useEffect)(() => {
|
|
369224
369234
|
checkWelcomeBack();
|
|
369225
369235
|
}, [checkWelcomeBack]);
|
|
369226
369236
|
return {
|
|
@@ -369241,10 +369251,10 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
369241
369251
|
|
|
369242
369252
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
369243
369253
|
init_esbuild_shims();
|
|
369244
|
-
var
|
|
369254
|
+
var import_react130 = __toESM(require_react(), 1);
|
|
369245
369255
|
init_settings();
|
|
369246
369256
|
function useDialogClose(options2) {
|
|
369247
|
-
const closeAnyOpenDialog = (0,
|
|
369257
|
+
const closeAnyOpenDialog = (0, import_react130.useCallback)(() => {
|
|
369248
369258
|
if (options2.isThemeDialogOpen) {
|
|
369249
369259
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
369250
369260
|
return true;
|
|
@@ -369276,13 +369286,13 @@ __name(useDialogClose, "useDialogClose");
|
|
|
369276
369286
|
|
|
369277
369287
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
369278
369288
|
init_esbuild_shims();
|
|
369279
|
-
var
|
|
369289
|
+
var import_react131 = __toESM(require_react(), 1);
|
|
369280
369290
|
function useSubagentCreateDialog() {
|
|
369281
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
369282
|
-
const openSubagentCreateDialog = (0,
|
|
369291
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react131.useState)(false);
|
|
369292
|
+
const openSubagentCreateDialog = (0, import_react131.useCallback)(() => {
|
|
369283
369293
|
setIsSubagentCreateDialogOpen(true);
|
|
369284
369294
|
}, []);
|
|
369285
|
-
const closeSubagentCreateDialog = (0,
|
|
369295
|
+
const closeSubagentCreateDialog = (0, import_react131.useCallback)(() => {
|
|
369286
369296
|
setIsSubagentCreateDialogOpen(false);
|
|
369287
369297
|
}, []);
|
|
369288
369298
|
return {
|
|
@@ -369295,13 +369305,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
369295
369305
|
|
|
369296
369306
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
369297
369307
|
init_esbuild_shims();
|
|
369298
|
-
var
|
|
369308
|
+
var import_react132 = __toESM(require_react(), 1);
|
|
369299
369309
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
369300
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
369301
|
-
const openAgentsManagerDialog = (0,
|
|
369310
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react132.useState)(false);
|
|
369311
|
+
const openAgentsManagerDialog = (0, import_react132.useCallback)(() => {
|
|
369302
369312
|
setIsAgentsManagerDialogOpen(true);
|
|
369303
369313
|
}, []);
|
|
369304
|
-
const closeAgentsManagerDialog = (0,
|
|
369314
|
+
const closeAgentsManagerDialog = (0, import_react132.useCallback)(() => {
|
|
369305
369315
|
setIsAgentsManagerDialogOpen(false);
|
|
369306
369316
|
}, []);
|
|
369307
369317
|
return {
|
|
@@ -369313,7 +369323,7 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
369313
369323
|
|
|
369314
369324
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
369315
369325
|
init_esbuild_shims();
|
|
369316
|
-
var
|
|
369326
|
+
var import_react133 = __toESM(require_react(), 1);
|
|
369317
369327
|
|
|
369318
369328
|
// packages/cli/src/utils/attentionNotification.ts
|
|
369319
369329
|
init_esbuild_shims();
|
|
@@ -369341,9 +369351,9 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
369341
369351
|
streamingState,
|
|
369342
369352
|
elapsedTime
|
|
369343
369353
|
}) => {
|
|
369344
|
-
const awaitingNotificationSentRef = (0,
|
|
369345
|
-
const respondingElapsedRef = (0,
|
|
369346
|
-
(0,
|
|
369354
|
+
const awaitingNotificationSentRef = (0, import_react133.useRef)(false);
|
|
369355
|
+
const respondingElapsedRef = (0, import_react133.useRef)(0);
|
|
369356
|
+
(0, import_react133.useEffect)(() => {
|
|
369347
369357
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
369348
369358
|
notifyTerminalAttention("tool_approval" /* ToolApproval */);
|
|
369349
369359
|
awaitingNotificationSentRef.current = true;
|
|
@@ -369352,7 +369362,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
369352
369362
|
awaitingNotificationSentRef.current = false;
|
|
369353
369363
|
}
|
|
369354
369364
|
}, [isFocused, streamingState]);
|
|
369355
|
-
(0,
|
|
369365
|
+
(0, import_react133.useEffect)(() => {
|
|
369356
369366
|
if (streamingState === "responding" /* Responding */) {
|
|
369357
369367
|
respondingElapsedRef.current = elapsedTime;
|
|
369358
369368
|
return;
|
|
@@ -369370,7 +369380,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
369370
369380
|
|
|
369371
369381
|
// packages/cli/src/ui/hooks/useWebSocket.ts
|
|
369372
369382
|
init_esbuild_shims();
|
|
369373
|
-
var
|
|
369383
|
+
var import_react134 = __toESM(require_react(), 1);
|
|
369374
369384
|
|
|
369375
369385
|
// packages/cli/src/config/websocket.ts
|
|
369376
369386
|
init_esbuild_shims();
|
|
@@ -369924,8 +369934,8 @@ function getRdmindSsoId3() {
|
|
|
369924
369934
|
}
|
|
369925
369935
|
__name(getRdmindSsoId3, "getRdmindSsoId");
|
|
369926
369936
|
function useWebSocket({ onReloadCommands, debug: debug2 }) {
|
|
369927
|
-
const wsClientRef = (0,
|
|
369928
|
-
(0,
|
|
369937
|
+
const wsClientRef = (0, import_react134.useRef)(null);
|
|
369938
|
+
(0, import_react134.useEffect)(() => {
|
|
369929
369939
|
const wsRuntimeConfig = loadWebSocketRuntimeConfig(debug2);
|
|
369930
369940
|
if (!wsRuntimeConfig.enabled) {
|
|
369931
369941
|
if (debug2) {
|
|
@@ -369987,22 +369997,22 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
369987
369997
|
const { settings, config, initializationResult } = props;
|
|
369988
369998
|
const historyManager = useHistory();
|
|
369989
369999
|
useMemoryMonitor(historyManager);
|
|
369990
|
-
const [corgiMode, setCorgiMode] = (0,
|
|
369991
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
369992
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
369993
|
-
const [themeError, setThemeError] = (0,
|
|
370000
|
+
const [corgiMode, setCorgiMode] = (0, import_react135.useState)(false);
|
|
370001
|
+
const [debugMessage, setDebugMessage] = (0, import_react135.useState)("");
|
|
370002
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react135.useState)(null);
|
|
370003
|
+
const [themeError, setThemeError] = (0, import_react135.useState)(
|
|
369994
370004
|
initializationResult.themeError
|
|
369995
370005
|
);
|
|
369996
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
369997
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
369998
|
-
const [geminiMdFileCount, setGeminiMdFileCount] = (0,
|
|
370006
|
+
const [isProcessing, setIsProcessing] = (0, import_react135.useState)(false);
|
|
370007
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react135.useState)(false);
|
|
370008
|
+
const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react135.useState)(
|
|
369999
370009
|
initializationResult.geminiMdFileCount
|
|
370000
370010
|
);
|
|
370001
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
370002
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
370003
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
370004
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
370005
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
370011
|
+
const [shellModeActive, setShellModeActive] = (0, import_react135.useState)(false);
|
|
370012
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react135.useState)(false);
|
|
370013
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react135.useState)(0);
|
|
370014
|
+
const [updateInfo, setUpdateInfo] = (0, import_react135.useState)(null);
|
|
370015
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react135.useState)(
|
|
370006
370016
|
config.isTrustedFolder()
|
|
370007
370017
|
);
|
|
370008
370018
|
const extensions = config.getExtensions();
|
|
@@ -370017,38 +370027,38 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370017
370027
|
historyManager.addItem,
|
|
370018
370028
|
config.getWorkingDir()
|
|
370019
370029
|
);
|
|
370020
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
370021
|
-
const openPermissionsDialog = (0,
|
|
370030
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react135.useState)(false);
|
|
370031
|
+
const openPermissionsDialog = (0, import_react135.useCallback)(
|
|
370022
370032
|
() => setPermissionsDialogOpen(true),
|
|
370023
370033
|
[]
|
|
370024
370034
|
);
|
|
370025
|
-
const closePermissionsDialog = (0,
|
|
370035
|
+
const closePermissionsDialog = (0, import_react135.useCallback)(
|
|
370026
370036
|
() => setPermissionsDialogOpen(false),
|
|
370027
370037
|
[]
|
|
370028
370038
|
);
|
|
370029
|
-
const getEffectiveModel2 = (0,
|
|
370039
|
+
const getEffectiveModel2 = (0, import_react135.useCallback)(() => {
|
|
370030
370040
|
if (config.isInFallbackMode()) {
|
|
370031
370041
|
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
370032
370042
|
}
|
|
370033
370043
|
return config.getModel();
|
|
370034
370044
|
}, [config]);
|
|
370035
|
-
const [currentModel, setCurrentModel] = (0,
|
|
370036
|
-
const [userTier] = (0,
|
|
370037
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
370045
|
+
const [currentModel, setCurrentModel] = (0, import_react135.useState)(getEffectiveModel2());
|
|
370046
|
+
const [userTier] = (0, import_react135.useState)(void 0);
|
|
370047
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react135.useState)(false);
|
|
370038
370048
|
const logger6 = useLogger(config.storage);
|
|
370039
|
-
const [userMessages, setUserMessages] = (0,
|
|
370049
|
+
const [userMessages, setUserMessages] = (0, import_react135.useState)([]);
|
|
370040
370050
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
370041
370051
|
const { stdin, setRawMode } = use_stdin_default();
|
|
370042
370052
|
const { stdout } = use_stdout_default();
|
|
370043
370053
|
const { stats: sessionStats } = useSessionStats();
|
|
370044
370054
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
370045
|
-
const mainControlsRef = (0,
|
|
370046
|
-
const originalTitleRef = (0,
|
|
370055
|
+
const mainControlsRef = (0, import_react135.useRef)(null);
|
|
370056
|
+
const originalTitleRef = (0, import_react135.useRef)(
|
|
370047
370057
|
computeWindowTitle(basename16(config.getTargetDir()))
|
|
370048
370058
|
);
|
|
370049
|
-
const lastTitleRef = (0,
|
|
370059
|
+
const lastTitleRef = (0, import_react135.useRef)(null);
|
|
370050
370060
|
const staticExtraHeight = 3;
|
|
370051
|
-
(0,
|
|
370061
|
+
(0, import_react135.useEffect)(() => {
|
|
370052
370062
|
(async () => {
|
|
370053
370063
|
await config.initialize();
|
|
370054
370064
|
setConfigInitialized(true);
|
|
@@ -370058,11 +370068,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370058
370068
|
await ideClient.disconnect();
|
|
370059
370069
|
});
|
|
370060
370070
|
}, [config]);
|
|
370061
|
-
(0,
|
|
370071
|
+
(0, import_react135.useEffect)(
|
|
370062
370072
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
370063
370073
|
[historyManager.addItem]
|
|
370064
370074
|
);
|
|
370065
|
-
(0,
|
|
370075
|
+
(0, import_react135.useEffect)(() => {
|
|
370066
370076
|
const checkModelChange = /* @__PURE__ */ __name(() => {
|
|
370067
370077
|
const effectiveModel = getEffectiveModel2();
|
|
370068
370078
|
if (effectiveModel !== currentModel) {
|
|
@@ -370078,7 +370088,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370078
370088
|
handleNewMessage,
|
|
370079
370089
|
clearConsoleMessages: clearConsoleMessagesState
|
|
370080
370090
|
} = useConsoleMessages();
|
|
370081
|
-
(0,
|
|
370091
|
+
(0, import_react135.useEffect)(() => {
|
|
370082
370092
|
const consolePatcher = new ConsolePatcher({
|
|
370083
370093
|
onNewMessage: handleNewMessage,
|
|
370084
370094
|
debugMode: config.getDebugMode()
|
|
@@ -370086,13 +370096,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370086
370096
|
consolePatcher.patch();
|
|
370087
370097
|
registerCleanup(consolePatcher.cleanup);
|
|
370088
370098
|
}, [handleNewMessage, config]);
|
|
370089
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
370099
|
+
const { inputWidth, suggestionsWidth } = (0, import_react135.useMemo)(() => {
|
|
370090
370100
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
370091
370101
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
370092
370102
|
}, [terminalWidth]);
|
|
370093
370103
|
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
|
|
370094
370104
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
370095
|
-
const isValidPath = (0,
|
|
370105
|
+
const isValidPath = (0, import_react135.useCallback)((filePath) => {
|
|
370096
370106
|
try {
|
|
370097
370107
|
return fs101.existsSync(filePath) && fs101.statSync(filePath).isFile();
|
|
370098
370108
|
} catch (_e) {
|
|
@@ -370107,7 +370117,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370107
370117
|
isValidPath,
|
|
370108
370118
|
shellModeActive
|
|
370109
370119
|
});
|
|
370110
|
-
(0,
|
|
370120
|
+
(0, import_react135.useEffect)(() => {
|
|
370111
370121
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
370112
370122
|
const pastMessagesRaw = await logger6?.getPreviousUserMessages() || [];
|
|
370113
370123
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -370130,7 +370140,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370130
370140
|
}, "fetchUserMessages");
|
|
370131
370141
|
fetchUserMessages();
|
|
370132
370142
|
}, [historyManager.history, logger6]);
|
|
370133
|
-
const refreshStatic = (0,
|
|
370143
|
+
const refreshStatic = (0, import_react135.useCallback)(() => {
|
|
370134
370144
|
stdout.write(base_exports.clearTerminal);
|
|
370135
370145
|
setHistoryRemountKey((prev) => prev + 1);
|
|
370136
370146
|
}, [setHistoryRemountKey, stdout]);
|
|
@@ -370162,7 +370172,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370162
370172
|
openAuthDialog,
|
|
370163
370173
|
cancelAuthentication
|
|
370164
370174
|
} = useAuthCommand(settings, config, historyManager.addItem);
|
|
370165
|
-
(0,
|
|
370175
|
+
(0, import_react135.useEffect)(() => {
|
|
370166
370176
|
if (!shouldTriggerAutoSSOAuth(settings)) {
|
|
370167
370177
|
return;
|
|
370168
370178
|
}
|
|
@@ -370341,17 +370351,17 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370341
370351
|
setAuthState,
|
|
370342
370352
|
setModelSwitchedFromQuotaError
|
|
370343
370353
|
});
|
|
370344
|
-
const handleQwenAuthTimeout = (0,
|
|
370354
|
+
const handleQwenAuthTimeout = (0, import_react135.useCallback)(() => {
|
|
370345
370355
|
onAuthError("Qwen OAuth authentication timed out. Please try again.");
|
|
370346
370356
|
cancelAuthentication();
|
|
370347
370357
|
setAuthState("updating" /* Updating */);
|
|
370348
370358
|
}, [onAuthError, cancelAuthentication, setAuthState]);
|
|
370349
|
-
const handleQwenAuthCancel = (0,
|
|
370359
|
+
const handleQwenAuthCancel = (0, import_react135.useCallback)(() => {
|
|
370350
370360
|
onAuthError("Qwen OAuth authentication cancelled.");
|
|
370351
370361
|
cancelAuthentication();
|
|
370352
370362
|
setAuthState("updating" /* Updating */);
|
|
370353
370363
|
}, [onAuthError, cancelAuthentication, setAuthState]);
|
|
370354
|
-
(0,
|
|
370364
|
+
(0, import_react135.useEffect)(() => {
|
|
370355
370365
|
if (settings.merged.security?.auth?.enforcedType && settings.merged.security?.auth.selectedType && settings.merged.security?.auth.enforcedType !== settings.merged.security?.auth.selectedType) {
|
|
370356
370366
|
onAuthError(
|
|
370357
370367
|
t2(
|
|
@@ -370376,7 +370386,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370376
370386
|
settings.merged.security?.auth?.useExternal,
|
|
370377
370387
|
onAuthError
|
|
370378
370388
|
]);
|
|
370379
|
-
const [editorError, setEditorError] = (0,
|
|
370389
|
+
const [editorError, setEditorError] = (0, import_react135.useState)(null);
|
|
370380
370390
|
const {
|
|
370381
370391
|
isEditorDialogOpen,
|
|
370382
370392
|
openEditorDialog,
|
|
@@ -370403,9 +370413,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370403
370413
|
openAgentsManagerDialog,
|
|
370404
370414
|
closeAgentsManagerDialog
|
|
370405
370415
|
} = useAgentsManagerDialog();
|
|
370406
|
-
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0,
|
|
370407
|
-
const [visionSwitchResolver, setVisionSwitchResolver] = (0,
|
|
370408
|
-
const slashCommandActions = (0,
|
|
370416
|
+
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0, import_react135.useState)(false);
|
|
370417
|
+
const [visionSwitchResolver, setVisionSwitchResolver] = (0, import_react135.useState)(null);
|
|
370418
|
+
const slashCommandActions = (0, import_react135.useMemo)(
|
|
370409
370419
|
() => ({
|
|
370410
370420
|
openAuthDialog,
|
|
370411
370421
|
openThemeDialog,
|
|
@@ -370473,14 +370483,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370473
370483
|
onReloadCommands: reloadCommands,
|
|
370474
370484
|
debug: config.getDebugMode()
|
|
370475
370485
|
});
|
|
370476
|
-
const handleVisionSwitchRequired = (0,
|
|
370486
|
+
const handleVisionSwitchRequired = (0, import_react135.useCallback)(
|
|
370477
370487
|
async (_query) => new Promise((resolve26, reject) => {
|
|
370478
370488
|
setVisionSwitchResolver({ resolve: resolve26, reject });
|
|
370479
370489
|
setIsVisionSwitchDialogOpen(true);
|
|
370480
370490
|
}),
|
|
370481
370491
|
[]
|
|
370482
370492
|
);
|
|
370483
|
-
const handleVisionSwitchSelect = (0,
|
|
370493
|
+
const handleVisionSwitchSelect = (0, import_react135.useCallback)(
|
|
370484
370494
|
(outcome) => {
|
|
370485
370495
|
setIsVisionSwitchDialogOpen(false);
|
|
370486
370496
|
if (visionSwitchResolver) {
|
|
@@ -370491,10 +370501,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370491
370501
|
},
|
|
370492
370502
|
[visionSwitchResolver]
|
|
370493
370503
|
);
|
|
370494
|
-
const onDebugMessage = (0,
|
|
370504
|
+
const onDebugMessage = (0, import_react135.useCallback)((message) => {
|
|
370495
370505
|
console.debug(message);
|
|
370496
370506
|
}, []);
|
|
370497
|
-
const performMemoryRefresh = (0,
|
|
370507
|
+
const performMemoryRefresh = (0, import_react135.useCallback)(async () => {
|
|
370498
370508
|
historyManager.addItem(
|
|
370499
370509
|
{
|
|
370500
370510
|
type: "info" /* INFO */,
|
|
@@ -370545,7 +370555,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370545
370555
|
console.error("Error refreshing memory:", error);
|
|
370546
370556
|
}
|
|
370547
370557
|
}, [config, historyManager, settings.merged]);
|
|
370548
|
-
const cancelHandlerRef = (0,
|
|
370558
|
+
const cancelHandlerRef = (0, import_react135.useRef)(() => {
|
|
370549
370559
|
});
|
|
370550
370560
|
const {
|
|
370551
370561
|
streamingState,
|
|
@@ -370592,7 +370602,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370592
370602
|
streamingState,
|
|
370593
370603
|
submitQuery
|
|
370594
370604
|
});
|
|
370595
|
-
const handleFinalSubmit = (0,
|
|
370605
|
+
const handleFinalSubmit = (0, import_react135.useCallback)(
|
|
370596
370606
|
(submittedValue) => {
|
|
370597
370607
|
addMessage(submittedValue);
|
|
370598
370608
|
},
|
|
@@ -370605,7 +370615,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
370605
370615
|
handleWelcomeBackSelection,
|
|
370606
370616
|
handleWelcomeBackClose
|
|
370607
370617
|
} = useWelcomeBack(config, handleFinalSubmit, buffer, settings.merged);
|
|
370608
|
-
cancelHandlerRef.current = (0,
|
|
370618
|
+
cancelHandlerRef.current = (0, import_react135.useCallback)(() => {
|
|
370609
370619
|
const pendingHistoryItems2 = [
|
|
370610
370620
|
...pendingSlashCommandHistoryItems,
|
|
370611
370621
|
...pendingGeminiHistoryItems
|
|
@@ -370634,7 +370644,7 @@ ${queuedText}` : queuedText;
|
|
|
370634
370644
|
pendingSlashCommandHistoryItems,
|
|
370635
370645
|
pendingGeminiHistoryItems
|
|
370636
370646
|
]);
|
|
370637
|
-
const handleClearScreen = (0,
|
|
370647
|
+
const handleClearScreen = (0, import_react135.useCallback)(() => {
|
|
370638
370648
|
historyManager.clearItems();
|
|
370639
370649
|
clearConsoleMessagesState();
|
|
370640
370650
|
console.clear();
|
|
@@ -370642,8 +370652,8 @@ ${queuedText}` : queuedText;
|
|
|
370642
370652
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
370643
370653
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
370644
370654
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */) && !proQuotaRequest;
|
|
370645
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
370646
|
-
(0,
|
|
370655
|
+
const [controlsHeight, setControlsHeight] = (0, import_react135.useState)(0);
|
|
370656
|
+
(0, import_react135.useLayoutEffect)(() => {
|
|
370647
370657
|
if (mainControlsRef.current) {
|
|
370648
370658
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
370649
370659
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -370666,14 +370676,14 @@ ${queuedText}` : queuedText;
|
|
|
370666
370676
|
});
|
|
370667
370677
|
const isFocused = useFocus();
|
|
370668
370678
|
useBracketedPaste();
|
|
370669
|
-
const contextFileNames = (0,
|
|
370679
|
+
const contextFileNames = (0, import_react135.useMemo)(() => {
|
|
370670
370680
|
const fromSettings = settings.merged.context?.fileName;
|
|
370671
370681
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
|
|
370672
370682
|
}, [settings.merged.context?.fileName]);
|
|
370673
|
-
const initialPrompt = (0,
|
|
370674
|
-
const initialPromptSubmitted = (0,
|
|
370683
|
+
const initialPrompt = (0, import_react135.useMemo)(() => config.getQuestion(), [config]);
|
|
370684
|
+
const initialPromptSubmitted = (0, import_react135.useRef)(false);
|
|
370675
370685
|
const geminiClient = config.getGeminiClient();
|
|
370676
|
-
(0,
|
|
370686
|
+
(0, import_react135.useEffect)(() => {
|
|
370677
370687
|
if (activePtyId) {
|
|
370678
370688
|
ShellExecutionService.resizePty(
|
|
370679
370689
|
activePtyId,
|
|
@@ -370682,7 +370692,7 @@ ${queuedText}` : queuedText;
|
|
|
370682
370692
|
);
|
|
370683
370693
|
}
|
|
370684
370694
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
370685
|
-
(0,
|
|
370695
|
+
(0, import_react135.useEffect)(() => {
|
|
370686
370696
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && !isVisionSwitchDialogOpen && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
|
|
370687
370697
|
handleFinalSubmit(initialPrompt);
|
|
370688
370698
|
initialPromptSubmitted.current = true;
|
|
@@ -370700,9 +370710,9 @@ ${queuedText}` : queuedText;
|
|
|
370700
370710
|
welcomeBackChoice,
|
|
370701
370711
|
geminiClient
|
|
370702
370712
|
]);
|
|
370703
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0,
|
|
370704
|
-
const [currentIDE, setCurrentIDE] = (0,
|
|
370705
|
-
(0,
|
|
370713
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react135.useState)(false);
|
|
370714
|
+
const [currentIDE, setCurrentIDE] = (0, import_react135.useState)(null);
|
|
370715
|
+
(0, import_react135.useEffect)(() => {
|
|
370706
370716
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
370707
370717
|
const ideClient = await IdeClient.getInstance();
|
|
370708
370718
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -370713,28 +370723,28 @@ ${queuedText}` : queuedText;
|
|
|
370713
370723
|
const shouldShowIdePrompt = Boolean(
|
|
370714
370724
|
currentIDE && !config.getIdeMode() && !settings.merged.ide?.hasSeenNudge && !idePromptAnswered
|
|
370715
370725
|
);
|
|
370716
|
-
const [showErrorDetails, setShowErrorDetails] = (0,
|
|
370717
|
-
const [showToolDescriptions, setShowToolDescriptions] = (0,
|
|
370718
|
-
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0,
|
|
370719
|
-
const ctrlCTimerRef = (0,
|
|
370720
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0,
|
|
370721
|
-
const ctrlDTimerRef = (0,
|
|
370722
|
-
const [constrainHeight, setConstrainHeight] = (0,
|
|
370723
|
-
const [ideContextState, setIdeContextState] = (0,
|
|
370724
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
370725
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0,
|
|
370726
|
+
const [showErrorDetails, setShowErrorDetails] = (0, import_react135.useState)(false);
|
|
370727
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react135.useState)(false);
|
|
370728
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react135.useState)(false);
|
|
370729
|
+
const ctrlCTimerRef = (0, import_react135.useRef)(null);
|
|
370730
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react135.useState)(false);
|
|
370731
|
+
const ctrlDTimerRef = (0, import_react135.useRef)(null);
|
|
370732
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react135.useState)(true);
|
|
370733
|
+
const [ideContextState, setIdeContextState] = (0, import_react135.useState)();
|
|
370734
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react135.useState)(false);
|
|
370735
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react135.useState)(false);
|
|
370726
370736
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
|
|
370727
370737
|
const {
|
|
370728
370738
|
needsRestart: ideNeedsRestart,
|
|
370729
370739
|
restartReason: ideTrustRestartReason
|
|
370730
370740
|
} = useIdeTrustListener();
|
|
370731
|
-
const isInitialMount = (0,
|
|
370732
|
-
(0,
|
|
370741
|
+
const isInitialMount = (0, import_react135.useRef)(true);
|
|
370742
|
+
(0, import_react135.useEffect)(() => {
|
|
370733
370743
|
if (ideNeedsRestart) {
|
|
370734
370744
|
setShowIdeRestartPrompt(true);
|
|
370735
370745
|
}
|
|
370736
370746
|
}, [ideNeedsRestart]);
|
|
370737
|
-
(0,
|
|
370747
|
+
(0, import_react135.useEffect)(() => {
|
|
370738
370748
|
if (isInitialMount.current) {
|
|
370739
370749
|
isInitialMount.current = false;
|
|
370740
370750
|
return;
|
|
@@ -370746,12 +370756,12 @@ ${queuedText}` : queuedText;
|
|
|
370746
370756
|
clearTimeout(handler);
|
|
370747
370757
|
};
|
|
370748
370758
|
}, [terminalWidth, refreshStatic]);
|
|
370749
|
-
(0,
|
|
370759
|
+
(0, import_react135.useEffect)(() => {
|
|
370750
370760
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
370751
370761
|
setIdeContextState(ideContextStore.get());
|
|
370752
370762
|
return unsubscribe;
|
|
370753
370763
|
}, []);
|
|
370754
|
-
(0,
|
|
370764
|
+
(0, import_react135.useEffect)(() => {
|
|
370755
370765
|
const openDebugConsole = /* @__PURE__ */ __name(() => {
|
|
370756
370766
|
setShowErrorDetails(true);
|
|
370757
370767
|
setConstrainHeight(false);
|
|
@@ -370770,10 +370780,10 @@ ${queuedText}` : queuedText;
|
|
|
370770
370780
|
appEvents.off("log-error" /* LogError */, logErrorHandler);
|
|
370771
370781
|
};
|
|
370772
370782
|
}, [handleNewMessage]);
|
|
370773
|
-
const handleEscapePromptChange = (0,
|
|
370783
|
+
const handleEscapePromptChange = (0, import_react135.useCallback)((showPrompt) => {
|
|
370774
370784
|
setShowEscapePrompt(showPrompt);
|
|
370775
370785
|
}, []);
|
|
370776
|
-
const handleIdePromptComplete = (0,
|
|
370786
|
+
const handleIdePromptComplete = (0, import_react135.useCallback)(
|
|
370777
370787
|
(result) => {
|
|
370778
370788
|
if (result.userSelection === "yes") {
|
|
370779
370789
|
handleSlashCommand2("/ide install");
|
|
@@ -370811,7 +370821,7 @@ ${queuedText}` : queuedText;
|
|
|
370811
370821
|
handleWelcomeBackClose,
|
|
370812
370822
|
quitConfirmationRequest
|
|
370813
370823
|
});
|
|
370814
|
-
const handleExit = (0,
|
|
370824
|
+
const handleExit = (0, import_react135.useCallback)(
|
|
370815
370825
|
(pressedOnce, setPressedOnce, timerRef) => {
|
|
370816
370826
|
if (pressedOnce) {
|
|
370817
370827
|
if (timerRef.current) {
|
|
@@ -370854,7 +370864,7 @@ ${queuedText}` : queuedText;
|
|
|
370854
370864
|
buffer
|
|
370855
370865
|
]
|
|
370856
370866
|
);
|
|
370857
|
-
const handleGlobalKeypress = (0,
|
|
370867
|
+
const handleGlobalKeypress = (0, import_react135.useCallback)(
|
|
370858
370868
|
(key) => {
|
|
370859
370869
|
if (settings.merged.general?.debugKeystrokeLogging) {
|
|
370860
370870
|
console.log("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
@@ -370927,7 +370937,7 @@ ${queuedText}` : queuedText;
|
|
|
370927
370937
|
]
|
|
370928
370938
|
);
|
|
370929
370939
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
370930
|
-
(0,
|
|
370940
|
+
(0, import_react135.useEffect)(() => {
|
|
370931
370941
|
if (!settings.merged.ui?.showStatusInTitle || settings.merged.ui?.hideWindowTitle)
|
|
370932
370942
|
return;
|
|
370933
370943
|
let title;
|
|
@@ -370949,23 +370959,23 @@ ${queuedText}` : queuedText;
|
|
|
370949
370959
|
settings.merged.ui?.hideWindowTitle,
|
|
370950
370960
|
stdout
|
|
370951
370961
|
]);
|
|
370952
|
-
const filteredConsoleMessages = (0,
|
|
370962
|
+
const filteredConsoleMessages = (0, import_react135.useMemo)(() => {
|
|
370953
370963
|
if (config.getDebugMode()) {
|
|
370954
370964
|
return consoleMessages;
|
|
370955
370965
|
}
|
|
370956
370966
|
return consoleMessages.filter((msg) => msg.type !== "debug");
|
|
370957
370967
|
}, [consoleMessages, config]);
|
|
370958
|
-
const errorCount = (0,
|
|
370968
|
+
const errorCount = (0, import_react135.useMemo)(
|
|
370959
370969
|
() => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
|
|
370960
370970
|
[filteredConsoleMessages]
|
|
370961
370971
|
);
|
|
370962
370972
|
const nightly = props.version.includes("nightly");
|
|
370963
370973
|
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest || !!quitConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isVisionSwitchDialogOpen || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating && isQwenAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || !!proQuotaRequest || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isApprovalModeDialogOpen;
|
|
370964
|
-
const pendingHistoryItems = (0,
|
|
370974
|
+
const pendingHistoryItems = (0, import_react135.useMemo)(
|
|
370965
370975
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
370966
370976
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
370967
370977
|
);
|
|
370968
|
-
const uiState = (0,
|
|
370978
|
+
const uiState = (0, import_react135.useMemo)(
|
|
370969
370979
|
() => ({
|
|
370970
370980
|
history: historyManager.history,
|
|
370971
370981
|
historyManager,
|
|
@@ -371164,7 +371174,7 @@ ${queuedText}` : queuedText;
|
|
|
371164
371174
|
isAgentsManagerDialogOpen
|
|
371165
371175
|
]
|
|
371166
371176
|
);
|
|
371167
|
-
const uiActions = (0,
|
|
371177
|
+
const uiActions = (0, import_react135.useMemo)(
|
|
371168
371178
|
() => ({
|
|
371169
371179
|
handleThemeSelect,
|
|
371170
371180
|
handleThemeHighlight,
|
|
@@ -371261,9 +371271,9 @@ ${queuedText}` : queuedText;
|
|
|
371261
371271
|
|
|
371262
371272
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
371263
371273
|
init_esbuild_shims();
|
|
371264
|
-
var
|
|
371274
|
+
var import_react136 = __toESM(require_react(), 1);
|
|
371265
371275
|
function useKittyKeyboardProtocol() {
|
|
371266
|
-
const [status] = (0,
|
|
371276
|
+
const [status] = (0, import_react136.useState)({
|
|
371267
371277
|
supported: isKittyProtocolSupported(),
|
|
371268
371278
|
enabled: isKittyProtocolEnabled(),
|
|
371269
371279
|
checking: false
|
|
@@ -374036,7 +374046,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
374036
374046
|
) });
|
|
374037
374047
|
}, "AppWrapper");
|
|
374038
374048
|
const instance = render_default(
|
|
374039
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
374049
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_react137.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(AppWrapper, {}),
|
|
374040
374050
|
{
|
|
374041
374051
|
exitOnCtrlC: false,
|
|
374042
374052
|
isScreenReaderEnabled: config.getScreenReader()
|