deepcode-ai 1.1.14 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +233 -182
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7765,7 +7765,7 @@ import path32 from "path";
|
|
|
7765
7765
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7766
7766
|
import fs6 from "fs";
|
|
7767
7767
|
import path112 from "path";
|
|
7768
|
-
import { isValidElement, useCallback as
|
|
7768
|
+
import { isValidElement, useCallback as useCallback23, useEffect as useEffect25, useMemo as useMemo15, useRef as useRef17, useState as useState27 } from "react";
|
|
7769
7769
|
import { Box as Box39, Text as Text47, useInput as useInput4, useStdin as useStdin3 } from "ink";
|
|
7770
7770
|
import os4 from "os";
|
|
7771
7771
|
import path62 from "path";
|
|
@@ -9687,13 +9687,13 @@ import { Box as Box22, Text as Text25 } from "ink";
|
|
|
9687
9687
|
import { jsxs as jsxs21 } from "react/jsx-runtime";
|
|
9688
9688
|
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
9689
9689
|
import { Box as Box31, Text as Text39, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
|
|
9690
|
-
import { useCallback as
|
|
9690
|
+
import { useCallback as useCallback17, useState as useState222 } from "react";
|
|
9691
9691
|
import { useRef as useRef7 } from "react";
|
|
9692
9692
|
import { Box as Box24, Text as Text26 } from "ink";
|
|
9693
9693
|
import { useEffect as useEffect13, useState as useState11 } from "react";
|
|
9694
9694
|
import { useEffect as useEffect14, useRef as useRef6, useState as useState12 } from "react";
|
|
9695
9695
|
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
9696
|
-
import { useCallback as
|
|
9696
|
+
import { useCallback as useCallback15, useEffect as useEffect21, useMemo as useMemo9, useState as useState19, useRef as useRef12 } from "react";
|
|
9697
9697
|
import { Box as Box27, Text as Text30 } from "ink";
|
|
9698
9698
|
import { Box as Box25, Text as Text28 } from "ink";
|
|
9699
9699
|
import React22 from "react";
|
|
@@ -9711,11 +9711,12 @@ import { useCallback as useCallback11, useMemo as useMemo7, useEffect as useEffe
|
|
|
9711
9711
|
import { useEffect as useEffect17, useReducer as useReducer3, useRef as useRef9 } from "react";
|
|
9712
9712
|
import { useState as useState17, useEffect as useEffect18, useMemo as useMemo6 } from "react";
|
|
9713
9713
|
import { useCallback as useCallback12, useEffect as useEffect20, useMemo as useMemo8, useRef as useRef10 } from "react";
|
|
9714
|
+
import { useState as useState18, useCallback as useCallback13, useRef as useRef11 } from "react";
|
|
9714
9715
|
import * as path102 from "path";
|
|
9715
9716
|
import { createContext as createContext5, useContext as useContext6 } from "react";
|
|
9716
9717
|
import { createContext as createContext6, useContext as useContext7 } from "react";
|
|
9717
9718
|
import { createContext as createContext7, useContext as useContext8 } from "react";
|
|
9718
|
-
import { useCallback as
|
|
9719
|
+
import { useCallback as useCallback14 } from "react";
|
|
9719
9720
|
import { Box as Box26, Text as Text29 } from "ink";
|
|
9720
9721
|
import chalk2 from "chalk";
|
|
9721
9722
|
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -9731,18 +9732,18 @@ import { Text as Text34 } from "ink";
|
|
|
9731
9732
|
import { jsxs as jsxs31 } from "react/jsx-runtime";
|
|
9732
9733
|
import { Text as Text35 } from "ink";
|
|
9733
9734
|
import { jsxs as jsxs32 } from "react/jsx-runtime";
|
|
9734
|
-
import { useState as
|
|
9735
|
+
import { useState as useState20, useEffect as useEffect222 } from "react";
|
|
9735
9736
|
import { execFile as execFile22 } from "child_process";
|
|
9736
9737
|
import os42 from "os";
|
|
9737
9738
|
import {
|
|
9738
9739
|
createContext as createContext8,
|
|
9739
|
-
useCallback as
|
|
9740
|
+
useCallback as useCallback16,
|
|
9740
9741
|
useContext as useContext9,
|
|
9741
|
-
useState as
|
|
9742
|
+
useState as useState21
|
|
9742
9743
|
} from "react";
|
|
9743
9744
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
9744
9745
|
import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
9745
|
-
import { useRef as
|
|
9746
|
+
import { useRef as useRef13 } from "react";
|
|
9746
9747
|
import { Box as Box29, Text as Text37 } from "ink";
|
|
9747
9748
|
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9748
9749
|
import { Box as Box30, Text as Text38 } from "ink";
|
|
@@ -9750,19 +9751,19 @@ import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
|
9750
9751
|
import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9751
9752
|
import { Box as Box32, Text as Text40 } from "ink";
|
|
9752
9753
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9753
|
-
import { useCallback as
|
|
9754
|
+
import { useCallback as useCallback18, useMemo as useMemo10, useRef as useRef14 } from "react";
|
|
9754
9755
|
import { Box as Box33, Text as Text41 } from "ink";
|
|
9755
9756
|
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9756
|
-
import { useCallback as
|
|
9757
|
+
import { useCallback as useCallback19, useMemo as useMemo11, useState as useState23 } from "react";
|
|
9757
9758
|
import { Box as Box34, Text as Text42, useInput as useInput2 } from "ink";
|
|
9758
9759
|
import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9759
|
-
import { useCallback as
|
|
9760
|
+
import { useCallback as useCallback20, useMemo as useMemo12, useState as useState24 } from "react";
|
|
9760
9761
|
import { Box as Box35, Text as Text43 } from "ink";
|
|
9761
9762
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9762
|
-
import { useCallback as
|
|
9763
|
+
import { useCallback as useCallback21, useEffect as useEffect23, useMemo as useMemo13, useRef as useRef15, useState as useState25 } from "react";
|
|
9763
9764
|
import { Box as Box36, Text as Text44 } from "ink";
|
|
9764
9765
|
import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9765
|
-
import { useCallback as
|
|
9766
|
+
import { useCallback as useCallback22, useEffect as useEffect24, useMemo as useMemo14, useRef as useRef16, useState as useState26 } from "react";
|
|
9766
9767
|
import { Box as Box37, Text as Text45, useInput as useInput3 } from "ink";
|
|
9767
9768
|
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9768
9769
|
import { Box as Box38, Text as Text46 } from "ink";
|
|
@@ -25517,21 +25518,35 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
25517
25518
|
]
|
|
25518
25519
|
);
|
|
25519
25520
|
}
|
|
25520
|
-
|
|
25521
|
-
state
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
},
|
|
25530
|
-
|
|
25531
|
-
|
|
25532
|
-
|
|
25533
|
-
|
|
25534
|
-
|
|
25521
|
+
function useFollowupSuggestionsCLI(options) {
|
|
25522
|
+
const [state, setState] = useState18({ isVisible: false, suggestion: null });
|
|
25523
|
+
const onAcceptRef = useRef11(options?.onAccept);
|
|
25524
|
+
onAcceptRef.current = options?.onAccept;
|
|
25525
|
+
const setSuggestion = useCallback13((text) => {
|
|
25526
|
+
setState({ isVisible: text !== null && text.trim().length > 0, suggestion: text });
|
|
25527
|
+
}, []);
|
|
25528
|
+
const dismiss = useCallback13(() => {
|
|
25529
|
+
setState({ isVisible: false, suggestion: null });
|
|
25530
|
+
}, []);
|
|
25531
|
+
const accept = useCallback13(
|
|
25532
|
+
(_method, opts) => {
|
|
25533
|
+
setState((prev) => {
|
|
25534
|
+
if (prev.suggestion && !opts?.skipOnAccept) {
|
|
25535
|
+
onAcceptRef.current?.(prev.suggestion);
|
|
25536
|
+
}
|
|
25537
|
+
return { isVisible: false, suggestion: null };
|
|
25538
|
+
});
|
|
25539
|
+
},
|
|
25540
|
+
[]
|
|
25541
|
+
);
|
|
25542
|
+
return {
|
|
25543
|
+
state,
|
|
25544
|
+
setSuggestion,
|
|
25545
|
+
accept,
|
|
25546
|
+
dismiss,
|
|
25547
|
+
clear: dismiss,
|
|
25548
|
+
recordKeystroke: dismiss
|
|
25549
|
+
};
|
|
25535
25550
|
}
|
|
25536
25551
|
var HIGHLIGHT_REGEX = /(^\/[a-zA-Z][a-zA-Z0-9:_-]*)|((?<=\s)\/[a-zA-Z][a-zA-Z0-9:_-]*)|(@(?:\\ |[a-zA-Z0-9_./-])+)/g;
|
|
25537
25552
|
function parseInputForHighlighting(text, index, slashCommands) {
|
|
@@ -25710,7 +25725,7 @@ var BaseTextInput = ({
|
|
|
25710
25725
|
isActive = true,
|
|
25711
25726
|
renderLine = defaultRenderLine
|
|
25712
25727
|
}) => {
|
|
25713
|
-
const handleKey =
|
|
25728
|
+
const handleKey = useCallback14(
|
|
25714
25729
|
(key) => {
|
|
25715
25730
|
if (onKeypress?.(key)) {
|
|
25716
25731
|
return;
|
|
@@ -25941,20 +25956,20 @@ var InputPrompt = ({
|
|
|
25941
25956
|
const { setPillFocused: setBgPillFocused } = useBackgroundTaskViewActions();
|
|
25942
25957
|
const hasAgents = agents.size > 0;
|
|
25943
25958
|
const hasBgAgents = bgEntries.length > 0;
|
|
25944
|
-
const [justNavigatedHistory, setJustNavigatedHistory] =
|
|
25945
|
-
const [escPressCount, setEscPressCount] =
|
|
25946
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
25947
|
-
const escapeTimerRef =
|
|
25948
|
-
const [recentPasteTime, setRecentPasteTime] =
|
|
25949
|
-
const pasteTimeoutRef =
|
|
25950
|
-
const [attachments, setAttachments] =
|
|
25951
|
-
const [isAttachmentMode, setIsAttachmentMode] =
|
|
25952
|
-
const [selectedAttachmentIndex, setSelectedAttachmentIndex] =
|
|
25953
|
-
const [pendingPastes, setPendingPastes] =
|
|
25959
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = useState19(false);
|
|
25960
|
+
const [escPressCount, setEscPressCount] = useState19(0);
|
|
25961
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState19(false);
|
|
25962
|
+
const escapeTimerRef = useRef12(null);
|
|
25963
|
+
const [recentPasteTime, setRecentPasteTime] = useState19(null);
|
|
25964
|
+
const pasteTimeoutRef = useRef12(null);
|
|
25965
|
+
const [attachments, setAttachments] = useState19([]);
|
|
25966
|
+
const [isAttachmentMode, setIsAttachmentMode] = useState19(false);
|
|
25967
|
+
const [selectedAttachmentIndex, setSelectedAttachmentIndex] = useState19(-1);
|
|
25968
|
+
const [pendingPastes, setPendingPastes] = useState19(
|
|
25954
25969
|
/* @__PURE__ */ new Map()
|
|
25955
25970
|
);
|
|
25956
|
-
const activePlaceholderIds =
|
|
25957
|
-
const parsePlaceholder =
|
|
25971
|
+
const activePlaceholderIds = useRef12(/* @__PURE__ */ new Map());
|
|
25972
|
+
const parsePlaceholder = useCallback15(
|
|
25958
25973
|
(placeholder2) => {
|
|
25959
25974
|
const match = placeholder2.match(
|
|
25960
25975
|
/^\[Pasted Content (\d+) chars\](?: #(\d+))?$/
|
|
@@ -25966,7 +25981,7 @@ var InputPrompt = ({
|
|
|
25966
25981
|
},
|
|
25967
25982
|
[]
|
|
25968
25983
|
);
|
|
25969
|
-
const freePlaceholderId =
|
|
25984
|
+
const freePlaceholderId = useCallback15((charCount, id) => {
|
|
25970
25985
|
const activeIds = activePlaceholderIds.current.get(charCount);
|
|
25971
25986
|
if (activeIds) {
|
|
25972
25987
|
activeIds.delete(id);
|
|
@@ -25975,14 +25990,14 @@ var InputPrompt = ({
|
|
|
25975
25990
|
}
|
|
25976
25991
|
}
|
|
25977
25992
|
}, []);
|
|
25978
|
-
const [reverseSearchActive, setReverseSearchActive] =
|
|
25979
|
-
const [commandSearchActive, setCommandSearchActive] =
|
|
25980
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] =
|
|
25981
|
-
const [cursorPosition, setCursorPosition] =
|
|
25993
|
+
const [reverseSearchActive, setReverseSearchActive] = useState19(false);
|
|
25994
|
+
const [commandSearchActive, setCommandSearchActive] = useState19(false);
|
|
25995
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = useState19("");
|
|
25996
|
+
const [cursorPosition, setCursorPosition] = useState19([
|
|
25982
25997
|
0,
|
|
25983
25998
|
0
|
|
25984
25999
|
]);
|
|
25985
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] =
|
|
26000
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = useState19(-1);
|
|
25986
26001
|
const exportCompletion = useExportCompletion(buffer, slashCommands);
|
|
25987
26002
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
25988
26003
|
const shellHistoryData = shellHistory.history;
|
|
@@ -25997,7 +26012,7 @@ var InputPrompt = ({
|
|
|
25997
26012
|
!justNavigatedHistory,
|
|
25998
26013
|
recentSlashCommands
|
|
25999
26014
|
);
|
|
26000
|
-
const midInputGhostTextRef =
|
|
26015
|
+
const midInputGhostTextRef = useRef12(null);
|
|
26001
26016
|
midInputGhostTextRef.current = completion.midInputGhostText;
|
|
26002
26017
|
const reverseSearchCompletion = useReverseSearchCompletion(
|
|
26003
26018
|
buffer,
|
|
@@ -26024,7 +26039,7 @@ var InputPrompt = ({
|
|
|
26024
26039
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
26025
26040
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
26026
26041
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused;
|
|
26027
|
-
const resetEscapeState =
|
|
26042
|
+
const resetEscapeState = useCallback15(() => {
|
|
26028
26043
|
if (escapeTimerRef.current) {
|
|
26029
26044
|
clearTimeout(escapeTimerRef.current);
|
|
26030
26045
|
escapeTimerRef.current = null;
|
|
@@ -26037,7 +26052,7 @@ var InputPrompt = ({
|
|
|
26037
26052
|
onEscapePromptChange(showEscapePrompt);
|
|
26038
26053
|
}
|
|
26039
26054
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
26040
|
-
const nextLargePastePlaceholder =
|
|
26055
|
+
const nextLargePastePlaceholder = useCallback15((charCount) => {
|
|
26041
26056
|
const activeIds = activePlaceholderIds.current.get(charCount) || /* @__PURE__ */ new Set();
|
|
26042
26057
|
let id = 1;
|
|
26043
26058
|
while (activeIds.has(id)) {
|
|
@@ -26059,9 +26074,9 @@ var InputPrompt = ({
|
|
|
26059
26074
|
},
|
|
26060
26075
|
[]
|
|
26061
26076
|
);
|
|
26062
|
-
const resetHistoryNavRef =
|
|
26077
|
+
const resetHistoryNavRef = useRef12(() => {
|
|
26063
26078
|
});
|
|
26064
|
-
const handleSubmitAndClear =
|
|
26079
|
+
const handleSubmitAndClear = useCallback15(
|
|
26065
26080
|
(submittedValue) => {
|
|
26066
26081
|
exportCompletion.reset();
|
|
26067
26082
|
let finalValue = submittedValue;
|
|
@@ -26113,7 +26128,7 @@ ${finalValue.trim()}`;
|
|
|
26113
26128
|
followup
|
|
26114
26129
|
]
|
|
26115
26130
|
);
|
|
26116
|
-
const customSetTextAndResetCompletionSignal =
|
|
26131
|
+
const customSetTextAndResetCompletionSignal = useCallback15(
|
|
26117
26132
|
(newText) => {
|
|
26118
26133
|
buffer.setText(newText);
|
|
26119
26134
|
setJustNavigatedHistory(true);
|
|
@@ -26130,7 +26145,7 @@ ${finalValue.trim()}`;
|
|
|
26130
26145
|
onChange: customSetTextAndResetCompletionSignal
|
|
26131
26146
|
});
|
|
26132
26147
|
resetHistoryNavRef.current = inputHistory.resetHistoryNav;
|
|
26133
|
-
const prevHasAgentsRef =
|
|
26148
|
+
const prevHasAgentsRef = useRef12(hasAgents);
|
|
26134
26149
|
useEffect21(() => {
|
|
26135
26150
|
if (hasAgents && !prevHasAgentsRef.current) {
|
|
26136
26151
|
inputHistory.resetHistoryNav();
|
|
@@ -26153,7 +26168,7 @@ ${finalValue.trim()}`;
|
|
|
26153
26168
|
resetReverseSearchCompletionState,
|
|
26154
26169
|
resetCommandSearchCompletionState
|
|
26155
26170
|
]);
|
|
26156
|
-
const handleClipboardImage =
|
|
26171
|
+
const handleClipboardImage = useCallback15(async (validated = false) => {
|
|
26157
26172
|
try {
|
|
26158
26173
|
const hasImage = validated || await clipboardHasImage();
|
|
26159
26174
|
if (hasImage) {
|
|
@@ -26174,7 +26189,7 @@ ${finalValue.trim()}`;
|
|
|
26174
26189
|
debugLogger14.error("Error handling clipboard image:", error);
|
|
26175
26190
|
}
|
|
26176
26191
|
}, []);
|
|
26177
|
-
const handleAttachmentDelete =
|
|
26192
|
+
const handleAttachmentDelete = useCallback15((index) => {
|
|
26178
26193
|
setAttachments((prev) => {
|
|
26179
26194
|
const newList = prev.filter((_, i) => i !== index);
|
|
26180
26195
|
if (newList.length === 0) {
|
|
@@ -26186,7 +26201,7 @@ ${finalValue.trim()}`;
|
|
|
26186
26201
|
return newList;
|
|
26187
26202
|
});
|
|
26188
26203
|
}, []);
|
|
26189
|
-
const handleInput =
|
|
26204
|
+
const handleInput = useCallback15(
|
|
26190
26205
|
(key) => {
|
|
26191
26206
|
if (agentTabBarFocused || bgPillFocused) {
|
|
26192
26207
|
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
@@ -26764,7 +26779,7 @@ ${currentText}`);
|
|
|
26764
26779
|
exportCompletion
|
|
26765
26780
|
]
|
|
26766
26781
|
);
|
|
26767
|
-
const renderLineWithHighlighting =
|
|
26782
|
+
const renderLineWithHighlighting = useCallback15(
|
|
26768
26783
|
(opts) => {
|
|
26769
26784
|
const {
|
|
26770
26785
|
lineText,
|
|
@@ -27035,7 +27050,7 @@ function MCPHealthPill() {
|
|
|
27035
27050
|
function useStatusLine() {
|
|
27036
27051
|
const config = useConfig();
|
|
27037
27052
|
const cwd = config.getWorkingDir();
|
|
27038
|
-
const [line, setLine] =
|
|
27053
|
+
const [line, setLine] = useState20(null);
|
|
27039
27054
|
useEffect222(() => {
|
|
27040
27055
|
let cancelled = false;
|
|
27041
27056
|
execFile22("git", ["branch", "--show-current"], { cwd }, (err, stdout) => {
|
|
@@ -27060,11 +27075,11 @@ var VimModeProvider = ({
|
|
|
27060
27075
|
children,
|
|
27061
27076
|
initialVimEnabled = false
|
|
27062
27077
|
}) => {
|
|
27063
|
-
const [vimEnabled, setVimEnabled] =
|
|
27064
|
-
const [vimMode, setVimMode] =
|
|
27078
|
+
const [vimEnabled, setVimEnabled] = useState21(initialVimEnabled);
|
|
27079
|
+
const [vimMode, setVimMode] = useState21(
|
|
27065
27080
|
initialVimEnabled ? "NORMAL" : "INSERT"
|
|
27066
27081
|
);
|
|
27067
|
-
const toggleVimEnabled =
|
|
27082
|
+
const toggleVimEnabled = useCallback16(async () => {
|
|
27068
27083
|
const next = !vimEnabled;
|
|
27069
27084
|
setVimEnabled(next);
|
|
27070
27085
|
setVimMode(next ? "NORMAL" : "INSERT");
|
|
@@ -27166,8 +27181,8 @@ var NUM_TIMES_QUEUE_HINT_SHOWN = 3;
|
|
|
27166
27181
|
var QueuedMessageDisplay = ({
|
|
27167
27182
|
messageQueue
|
|
27168
27183
|
}) => {
|
|
27169
|
-
const hintSeenCountRef =
|
|
27170
|
-
const wasEmptyRef =
|
|
27184
|
+
const hintSeenCountRef = useRef13(0);
|
|
27185
|
+
const wasEmptyRef = useRef13(true);
|
|
27171
27186
|
if (messageQueue.length === 0) {
|
|
27172
27187
|
wasEmptyRef.current = true;
|
|
27173
27188
|
return null;
|
|
@@ -27300,12 +27315,12 @@ var Composer = () => {
|
|
|
27300
27315
|
}
|
|
27301
27316
|
}
|
|
27302
27317
|
}
|
|
27303
|
-
const [showShortcuts, setShowShortcuts] =
|
|
27304
|
-
const handleToggleShortcuts =
|
|
27318
|
+
const [showShortcuts, setShowShortcuts] = useState222(false);
|
|
27319
|
+
const handleToggleShortcuts = useCallback17(() => {
|
|
27305
27320
|
setShowShortcuts((prev) => !prev);
|
|
27306
27321
|
}, []);
|
|
27307
|
-
const [showSuggestions, setShowSuggestions] =
|
|
27308
|
-
const handleSuggestionsVisibilityChange =
|
|
27322
|
+
const [showSuggestions, setShowSuggestions] = useState222(false);
|
|
27323
|
+
const handleSuggestionsVisibilityChange = useCallback17(
|
|
27309
27324
|
(visible) => {
|
|
27310
27325
|
setShowSuggestions(visible);
|
|
27311
27326
|
uiActions.onSuggestionsVisibilityChange(visible);
|
|
@@ -27739,7 +27754,7 @@ var CommandDialog = ({
|
|
|
27739
27754
|
/* @__PURE__ */ jsx41(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx41(Text40, { color: theme.text.secondary, children: footerText }) })
|
|
27740
27755
|
] }) });
|
|
27741
27756
|
var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
27742
|
-
const originalTheme =
|
|
27757
|
+
const originalTheme = useRef14(themeManager.getActiveTheme().name);
|
|
27743
27758
|
const available = useMemo10(() => themeManager.getAvailableThemes(), []);
|
|
27744
27759
|
const items = useMemo10(
|
|
27745
27760
|
() => available.map((entry) => ({
|
|
@@ -27755,7 +27770,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
27755
27770
|
0,
|
|
27756
27771
|
available.findIndex((entry) => entry.name === originalTheme.current)
|
|
27757
27772
|
);
|
|
27758
|
-
const handleEscape =
|
|
27773
|
+
const handleEscape = useCallback18(
|
|
27759
27774
|
(key) => {
|
|
27760
27775
|
if (key.name === "escape") {
|
|
27761
27776
|
themeManager.setActiveTheme(originalTheme.current);
|
|
@@ -27766,7 +27781,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
27766
27781
|
[onClose, onPreview]
|
|
27767
27782
|
);
|
|
27768
27783
|
useKeypress(handleEscape, { isActive: true });
|
|
27769
|
-
const handleHighlight =
|
|
27784
|
+
const handleHighlight = useCallback18(
|
|
27770
27785
|
(themeName) => {
|
|
27771
27786
|
themeManager.setActiveTheme(themeName);
|
|
27772
27787
|
onPreview();
|
|
@@ -27831,12 +27846,12 @@ var ProviderDialog = ({
|
|
|
27831
27846
|
onTestProvider,
|
|
27832
27847
|
onClose
|
|
27833
27848
|
}) => {
|
|
27834
|
-
const [phase, setPhase] =
|
|
27835
|
-
const [selectedProvider, setSelectedProvider] =
|
|
27836
|
-
const [apiKeyInput, setApiKeyInput] =
|
|
27837
|
-
const [isBusy, setIsBusy] =
|
|
27838
|
-
const [status, setStatus] =
|
|
27839
|
-
const [testLatencyMs, setTestLatencyMs] =
|
|
27849
|
+
const [phase, setPhase] = useState23("providers");
|
|
27850
|
+
const [selectedProvider, setSelectedProvider] = useState23(currentProvider);
|
|
27851
|
+
const [apiKeyInput, setApiKeyInput] = useState23("");
|
|
27852
|
+
const [isBusy, setIsBusy] = useState23(false);
|
|
27853
|
+
const [status, setStatus] = useState23(null);
|
|
27854
|
+
const [testLatencyMs, setTestLatencyMs] = useState23(void 0);
|
|
27840
27855
|
const isLocal = CREDENTIAL_FREE_PROVIDERS.has(selectedProvider);
|
|
27841
27856
|
const keyIsSet = hasApiKey(selectedProvider);
|
|
27842
27857
|
const keyHint = getProviderKeyHint(selectedProvider);
|
|
@@ -27895,7 +27910,7 @@ var ProviderDialog = ({
|
|
|
27895
27910
|
],
|
|
27896
27911
|
[canTest, currentProvider, isLocal, selectedProvider]
|
|
27897
27912
|
);
|
|
27898
|
-
const selectProvider =
|
|
27913
|
+
const selectProvider = useCallback19(
|
|
27899
27914
|
(provider) => {
|
|
27900
27915
|
setSelectedProvider(provider);
|
|
27901
27916
|
setStatus(null);
|
|
@@ -27904,7 +27919,7 @@ var ProviderDialog = ({
|
|
|
27904
27919
|
},
|
|
27905
27920
|
[]
|
|
27906
27921
|
);
|
|
27907
|
-
const runTest =
|
|
27922
|
+
const runTest = useCallback19(async () => {
|
|
27908
27923
|
setIsBusy(true);
|
|
27909
27924
|
setTestLatencyMs(void 0);
|
|
27910
27925
|
setStatus({ text: `Testing ${selectedProvider}\u2026`, ok: true });
|
|
@@ -27926,7 +27941,7 @@ var ProviderDialog = ({
|
|
|
27926
27941
|
setIsBusy(false);
|
|
27927
27942
|
}
|
|
27928
27943
|
}, [onTestProvider, selectedProvider]);
|
|
27929
|
-
const selectAction =
|
|
27944
|
+
const selectAction = useCallback19(
|
|
27930
27945
|
(action) => {
|
|
27931
27946
|
if (isBusy) return;
|
|
27932
27947
|
if (action === "editKey") {
|
|
@@ -27967,7 +27982,7 @@ var ProviderDialog = ({
|
|
|
27967
27982
|
},
|
|
27968
27983
|
[isBusy, onClose, onSelectProvider, onSetDefaultProvider, runTest, selectedProvider]
|
|
27969
27984
|
);
|
|
27970
|
-
const saveApiKey =
|
|
27985
|
+
const saveApiKey = useCallback19(async () => {
|
|
27971
27986
|
const normalized2 = apiKeyInput.trim();
|
|
27972
27987
|
if (!normalized2) {
|
|
27973
27988
|
setStatus({ text: "Type a key before saving.", ok: false });
|
|
@@ -28153,7 +28168,7 @@ var PermissionsDialog = ({
|
|
|
28153
28168
|
onSave,
|
|
28154
28169
|
onClose
|
|
28155
28170
|
}) => {
|
|
28156
|
-
const [modes, setModes] =
|
|
28171
|
+
const [modes, setModes] = useState24(current);
|
|
28157
28172
|
const dirty = useMemo12(
|
|
28158
28173
|
() => PERMISSION_KEYS.some((key) => modes[key] !== current[key]),
|
|
28159
28174
|
[modes, current]
|
|
@@ -28168,7 +28183,7 @@ var PermissionsDialog = ({
|
|
|
28168
28183
|
rows.push({ key: CANCEL_VALUE, value: CANCEL_VALUE, label: "Cancel" });
|
|
28169
28184
|
return rows;
|
|
28170
28185
|
}, [modes, dirty]);
|
|
28171
|
-
const handleSelect =
|
|
28186
|
+
const handleSelect = useCallback20(
|
|
28172
28187
|
(value) => {
|
|
28173
28188
|
if (value === SAVE_VALUE) {
|
|
28174
28189
|
onSave(modes);
|
|
@@ -28183,7 +28198,7 @@ var PermissionsDialog = ({
|
|
|
28183
28198
|
},
|
|
28184
28199
|
[modes, onClose, onSave]
|
|
28185
28200
|
);
|
|
28186
|
-
const handleEscape =
|
|
28201
|
+
const handleEscape = useCallback20(
|
|
28187
28202
|
(key) => {
|
|
28188
28203
|
if (key.name === "escape") {
|
|
28189
28204
|
onClose();
|
|
@@ -28219,10 +28234,10 @@ var AuthDialog = ({
|
|
|
28219
28234
|
onPersistToken,
|
|
28220
28235
|
onClose
|
|
28221
28236
|
}) => {
|
|
28222
|
-
const [phase, setPhase] =
|
|
28223
|
-
const [deviceCode, setDeviceCode] =
|
|
28224
|
-
const [message, setMessage] =
|
|
28225
|
-
const abortRef =
|
|
28237
|
+
const [phase, setPhase] = useState25("menu");
|
|
28238
|
+
const [deviceCode, setDeviceCode] = useState25(null);
|
|
28239
|
+
const [message, setMessage] = useState25("");
|
|
28240
|
+
const abortRef = useRef15(null);
|
|
28226
28241
|
const items = useMemo13(
|
|
28227
28242
|
() => [
|
|
28228
28243
|
{ key: "login", value: "login", label: "Login with GitHub" },
|
|
@@ -28231,7 +28246,7 @@ var AuthDialog = ({
|
|
|
28231
28246
|
],
|
|
28232
28247
|
[hasToken]
|
|
28233
28248
|
);
|
|
28234
|
-
const startLogin =
|
|
28249
|
+
const startLogin = useCallback21(async () => {
|
|
28235
28250
|
if (!clientId) {
|
|
28236
28251
|
setMessage(
|
|
28237
28252
|
"No OAuth client configured. Set github.oauthClientId in .deepcode/config.json, or run `deepcode github login` in a terminal."
|
|
@@ -28275,7 +28290,7 @@ var AuthDialog = ({
|
|
|
28275
28290
|
abortRef.current = null;
|
|
28276
28291
|
}
|
|
28277
28292
|
}, [clientId, enterpriseUrl, onPersistToken, scopes, worktree]);
|
|
28278
|
-
const clearToken =
|
|
28293
|
+
const clearToken = useCallback21(async () => {
|
|
28279
28294
|
try {
|
|
28280
28295
|
await onPersistToken(void 0);
|
|
28281
28296
|
setPhase("done");
|
|
@@ -28285,7 +28300,7 @@ var AuthDialog = ({
|
|
|
28285
28300
|
setMessage(error instanceof Error ? error.message : String(error));
|
|
28286
28301
|
}
|
|
28287
28302
|
}, [onPersistToken]);
|
|
28288
|
-
const handleSelect =
|
|
28303
|
+
const handleSelect = useCallback21(
|
|
28289
28304
|
(value) => {
|
|
28290
28305
|
if (value === "login") {
|
|
28291
28306
|
void startLogin();
|
|
@@ -28300,7 +28315,7 @@ var AuthDialog = ({
|
|
|
28300
28315
|
useEffect23(() => () => {
|
|
28301
28316
|
abortRef.current?.abort();
|
|
28302
28317
|
}, []);
|
|
28303
|
-
const handleEscape =
|
|
28318
|
+
const handleEscape = useCallback21(
|
|
28304
28319
|
(key) => {
|
|
28305
28320
|
if (key.name !== "escape") return;
|
|
28306
28321
|
if (phase === "running") {
|
|
@@ -28393,12 +28408,12 @@ var ModelDialog = ({
|
|
|
28393
28408
|
onSelectModel,
|
|
28394
28409
|
onClose
|
|
28395
28410
|
}) => {
|
|
28396
|
-
const [loadState, setLoadState] =
|
|
28397
|
-
const [models, setModels] =
|
|
28398
|
-
const [errorMsg, setErrorMsg] =
|
|
28399
|
-
const [search, setSearch] =
|
|
28400
|
-
const [activeSelIndex, setActiveSelIndex] =
|
|
28401
|
-
const abortRef =
|
|
28411
|
+
const [loadState, setLoadState] = useState26("loading");
|
|
28412
|
+
const [models, setModels] = useState26([]);
|
|
28413
|
+
const [errorMsg, setErrorMsg] = useState26("");
|
|
28414
|
+
const [search, setSearch] = useState26("");
|
|
28415
|
+
const [activeSelIndex, setActiveSelIndex] = useState26(0);
|
|
28416
|
+
const abortRef = useRef16(null);
|
|
28402
28417
|
useEffect24(() => {
|
|
28403
28418
|
const ctrl = new AbortController();
|
|
28404
28419
|
abortRef.current = ctrl;
|
|
@@ -28431,7 +28446,7 @@ var ModelDialog = ({
|
|
|
28431
28446
|
[activeRowPos, rows.length]
|
|
28432
28447
|
);
|
|
28433
28448
|
const visibleRows = rows.slice(scrollTop, scrollTop + MAX_VISIBLE);
|
|
28434
|
-
const confirm =
|
|
28449
|
+
const confirm = useCallback22(() => {
|
|
28435
28450
|
const row = rows.find((r) => r.kind === "item" && r.selIndex === clampedIndex);
|
|
28436
28451
|
if (row?.kind === "item") onSelectModel(row.model.id);
|
|
28437
28452
|
}, [rows, clampedIndex, onSelectModel]);
|
|
@@ -28751,68 +28766,94 @@ function resolveSlashInvocation(rawInput, commands) {
|
|
|
28751
28766
|
args: tokens.slice(consumed).join(" ")
|
|
28752
28767
|
};
|
|
28753
28768
|
}
|
|
28769
|
+
async function generateFollowupSuggestion(runtime, session, lastOutput, signal) {
|
|
28770
|
+
if (!lastOutput.trim()) return null;
|
|
28771
|
+
try {
|
|
28772
|
+
const provider = runtime.providers.get(session.provider);
|
|
28773
|
+
const model = session.model;
|
|
28774
|
+
if (!model) return null;
|
|
28775
|
+
const snippet = lastOutput.trim().slice(-300);
|
|
28776
|
+
const prompt = `[Task: suggest ONE concise follow-up question or action the user might ask next, in under 10 words. Return ONLY the suggestion text, no explanation, no quotes, no punctuation at the end.]
|
|
28777
|
+
|
|
28778
|
+
Assistant just said:
|
|
28779
|
+
${snippet}
|
|
28780
|
+
|
|
28781
|
+
Follow-up suggestion:`;
|
|
28782
|
+
const suggestion = await provider.complete(prompt, {
|
|
28783
|
+
model,
|
|
28784
|
+
maxTokens: 20,
|
|
28785
|
+
temperature: 0.7,
|
|
28786
|
+
signal
|
|
28787
|
+
});
|
|
28788
|
+
const clean = suggestion.trim().replace(/^["']|["']$/g, "").replace(/[.!?]$/, "").split("\n")[0].trim();
|
|
28789
|
+
if (!clean || clean.length < 3 || clean.length > 80) return null;
|
|
28790
|
+
return clean;
|
|
28791
|
+
} catch {
|
|
28792
|
+
return null;
|
|
28793
|
+
}
|
|
28794
|
+
}
|
|
28754
28795
|
var AppContainer = ({ cwd, config, provider, model }) => {
|
|
28755
28796
|
const historyManager = useHistory();
|
|
28756
28797
|
const addHistoryItem = historyManager.addItem;
|
|
28757
|
-
const [initError, setInitError] =
|
|
28758
|
-
const [isInitializing, setIsInitializing] =
|
|
28759
|
-
const [isRunning, setIsRunning] =
|
|
28760
|
-
const [pendingAssistantText, setPendingAssistantText] =
|
|
28761
|
-
const [approvalQueue, setApprovalQueue] =
|
|
28762
|
-
const [providerLabel, setProviderLabel] =
|
|
28763
|
-
const [targetSource, setTargetSource] =
|
|
28764
|
-
const [currentModel, setCurrentModel] =
|
|
28765
|
-
const [agentMode, setAgentMode] =
|
|
28766
|
-
const [streamingState, setStreamingState] =
|
|
28798
|
+
const [initError, setInitError] = useState27(null);
|
|
28799
|
+
const [isInitializing, setIsInitializing] = useState27(true);
|
|
28800
|
+
const [isRunning, setIsRunning] = useState27(false);
|
|
28801
|
+
const [pendingAssistantText, setPendingAssistantText] = useState27("");
|
|
28802
|
+
const [approvalQueue, setApprovalQueue] = useState27([]);
|
|
28803
|
+
const [providerLabel, setProviderLabel] = useState27("(unconfigured)");
|
|
28804
|
+
const [targetSource, setTargetSource] = useState27("config");
|
|
28805
|
+
const [currentModel, setCurrentModel] = useState27("(unconfigured)");
|
|
28806
|
+
const [agentMode, setAgentMode] = useState27("build");
|
|
28807
|
+
const [streamingState, setStreamingState] = useState27(
|
|
28767
28808
|
"idle"
|
|
28768
28809
|
/* Idle */
|
|
28769
28810
|
);
|
|
28770
|
-
const [compactMode, setCompactMode] =
|
|
28771
|
-
const [shellModeActive, setShellModeActive] =
|
|
28772
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
28773
|
-
const [messageQueue, setMessageQueue] =
|
|
28774
|
-
const [historyRemountKey, setHistoryRemountKey] =
|
|
28775
|
-
const [pendingItem, setPendingItem] =
|
|
28776
|
-
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] =
|
|
28777
|
-
const [lastPromptTokenCount, setLastPromptTokenCount] =
|
|
28778
|
-
const [lastOutputTokenCount, setLastOutputTokenCount] =
|
|
28779
|
-
const [elapsedTime, setElapsedTime] =
|
|
28780
|
-
const [isReceivingContent, setIsReceivingContent] =
|
|
28781
|
-
const [iterationInfo, setIterationInfo] =
|
|
28782
|
-
const [liveToolCalls, setLiveToolCalls] =
|
|
28783
|
-
const [taskPlan, setTaskPlan] =
|
|
28784
|
-
const [taskStreams, setTaskStreams] =
|
|
28785
|
-
const [recentSlashCommandsState, setRecentSlashCommandsState] =
|
|
28786
|
-
const [activeDialog, setActiveDialog] =
|
|
28787
|
-
const [themeName, setThemeName] =
|
|
28788
|
-
const [permissionSummary, setPermissionSummary] =
|
|
28789
|
-
const [authSummary, setAuthSummary] =
|
|
28790
|
-
const [permissionModes, setPermissionModes] =
|
|
28811
|
+
const [compactMode, setCompactMode] = useState27(false);
|
|
28812
|
+
const [shellModeActive, setShellModeActive] = useState27(false);
|
|
28813
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState27(false);
|
|
28814
|
+
const [messageQueue, setMessageQueue] = useState27([]);
|
|
28815
|
+
const [historyRemountKey, setHistoryRemountKey] = useState27(0);
|
|
28816
|
+
const [pendingItem, setPendingItem] = useState27(null);
|
|
28817
|
+
const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = useState27(false);
|
|
28818
|
+
const [lastPromptTokenCount, setLastPromptTokenCount] = useState27(0);
|
|
28819
|
+
const [lastOutputTokenCount, setLastOutputTokenCount] = useState27(0);
|
|
28820
|
+
const [elapsedTime, setElapsedTime] = useState27(0);
|
|
28821
|
+
const [isReceivingContent, setIsReceivingContent] = useState27(false);
|
|
28822
|
+
const [iterationInfo, setIterationInfo] = useState27(null);
|
|
28823
|
+
const [liveToolCalls, setLiveToolCalls] = useState27([]);
|
|
28824
|
+
const [taskPlan, setTaskPlan] = useState27(null);
|
|
28825
|
+
const [taskStreams, setTaskStreams] = useState27({});
|
|
28826
|
+
const [recentSlashCommandsState, setRecentSlashCommandsState] = useState27(/* @__PURE__ */ new Map());
|
|
28827
|
+
const [activeDialog, setActiveDialog] = useState27(null);
|
|
28828
|
+
const [themeName, setThemeName] = useState27("(unknown)");
|
|
28829
|
+
const [permissionSummary, setPermissionSummary] = useState27("(unknown)");
|
|
28830
|
+
const [authSummary, setAuthSummary] = useState27("(unknown)");
|
|
28831
|
+
const [permissionModes, setPermissionModes] = useState27({
|
|
28791
28832
|
read: "allow",
|
|
28792
28833
|
write: "ask",
|
|
28793
28834
|
gitLocal: "allow",
|
|
28794
28835
|
shell: "ask",
|
|
28795
28836
|
dangerous: "ask"
|
|
28796
28837
|
});
|
|
28797
|
-
const [providerConfigVersion, setProviderConfigVersion] =
|
|
28798
|
-
const [, setThemeVersion] =
|
|
28799
|
-
const [mcpConnected, setMcpConnected] =
|
|
28800
|
-
const [mcpTotal, setMcpTotal] =
|
|
28801
|
-
const [subagentMap, setSubagentMap] =
|
|
28802
|
-
const [, setDrainTick] =
|
|
28803
|
-
const [pendingCommandConfirmation, setPendingCommandConfirmation] =
|
|
28804
|
-
const runtimeRef =
|
|
28805
|
-
const sessionRef =
|
|
28806
|
-
const configAdapterRef =
|
|
28807
|
-
const abortRef =
|
|
28808
|
-
const unsubscribeRef =
|
|
28809
|
-
const lastSubmittedPromptRef =
|
|
28810
|
-
const runStartedAtRef =
|
|
28811
|
-
const streamingResponseLengthRef =
|
|
28812
|
-
const drainingQueueRef =
|
|
28813
|
-
const messageQueueRef =
|
|
28814
|
-
const sessionShellAllowlistRef =
|
|
28815
|
-
const mainControlsRef =
|
|
28838
|
+
const [providerConfigVersion, setProviderConfigVersion] = useState27(0);
|
|
28839
|
+
const [, setThemeVersion] = useState27(0);
|
|
28840
|
+
const [mcpConnected, setMcpConnected] = useState27(0);
|
|
28841
|
+
const [mcpTotal, setMcpTotal] = useState27(0);
|
|
28842
|
+
const [subagentMap, setSubagentMap] = useState27(/* @__PURE__ */ new Map());
|
|
28843
|
+
const [, setDrainTick] = useState27(0);
|
|
28844
|
+
const [pendingCommandConfirmation, setPendingCommandConfirmation] = useState27(null);
|
|
28845
|
+
const runtimeRef = useRef17(null);
|
|
28846
|
+
const sessionRef = useRef17(null);
|
|
28847
|
+
const configAdapterRef = useRef17(null);
|
|
28848
|
+
const abortRef = useRef17(null);
|
|
28849
|
+
const unsubscribeRef = useRef17([]);
|
|
28850
|
+
const lastSubmittedPromptRef = useRef17(null);
|
|
28851
|
+
const runStartedAtRef = useRef17(null);
|
|
28852
|
+
const streamingResponseLengthRef = useRef17(0);
|
|
28853
|
+
const drainingQueueRef = useRef17(false);
|
|
28854
|
+
const messageQueueRef = useRef17([]);
|
|
28855
|
+
const sessionShellAllowlistRef = useRef17(/* @__PURE__ */ new Set());
|
|
28856
|
+
const mainControlsRef = useRef17(null);
|
|
28816
28857
|
const { stdin, setRawMode } = useStdin3();
|
|
28817
28858
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
28818
28859
|
const mainAreaWidth = Math.min(Math.max(terminalWidth - 4, 20), 120);
|
|
@@ -28833,7 +28874,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28833
28874
|
[]
|
|
28834
28875
|
);
|
|
28835
28876
|
const configAdapter = configAdapterRef.current ?? new DeepCodeConfigAdapter(cwd);
|
|
28836
|
-
const isValidPath =
|
|
28877
|
+
const isValidPath = useCallback23(
|
|
28837
28878
|
(candidate) => {
|
|
28838
28879
|
const resolved = path112.resolve(cwd, candidate);
|
|
28839
28880
|
const relative2 = path112.relative(cwd, resolved);
|
|
@@ -28878,9 +28919,9 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28878
28919
|
() => recentSlashCommandsState,
|
|
28879
28920
|
[recentSlashCommandsState]
|
|
28880
28921
|
);
|
|
28881
|
-
const
|
|
28882
|
-
|
|
28883
|
-
const registerSlashCommandUsage =
|
|
28922
|
+
const [promptSuggestion, setPromptSuggestion] = useState27(null);
|
|
28923
|
+
const dismissPromptSuggestion = useCallback23(() => setPromptSuggestion(null), []);
|
|
28924
|
+
const registerSlashCommandUsage = useCallback23((name) => {
|
|
28884
28925
|
setRecentSlashCommandsState((prev) => {
|
|
28885
28926
|
const next = new Map(prev);
|
|
28886
28927
|
const existing = next.get(name);
|
|
@@ -28892,8 +28933,8 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28892
28933
|
return next;
|
|
28893
28934
|
});
|
|
28894
28935
|
}, []);
|
|
28895
|
-
const listAvailableProviders =
|
|
28896
|
-
const getSessionCommandState =
|
|
28936
|
+
const listAvailableProviders = useCallback23(() => PROVIDER_IDS, []);
|
|
28937
|
+
const getSessionCommandState = useCallback23(() => {
|
|
28897
28938
|
const runtime = runtimeRef.current;
|
|
28898
28939
|
const session = sessionRef.current;
|
|
28899
28940
|
const fallbackProvider = runtime?.config.defaultProvider ?? PROVIDER_IDS[0];
|
|
@@ -28905,7 +28946,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28905
28946
|
mode: agentMode
|
|
28906
28947
|
};
|
|
28907
28948
|
}, [agentMode]);
|
|
28908
|
-
const setSessionProvider =
|
|
28949
|
+
const setSessionProvider = useCallback23((provider2) => {
|
|
28909
28950
|
const runtime = runtimeRef.current;
|
|
28910
28951
|
const session = sessionRef.current;
|
|
28911
28952
|
if (!runtime || !session) return;
|
|
@@ -28925,7 +28966,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28925
28966
|
);
|
|
28926
28967
|
}
|
|
28927
28968
|
}, [historyManager]);
|
|
28928
|
-
const setSessionModel =
|
|
28969
|
+
const setSessionModel = useCallback23((model2) => {
|
|
28929
28970
|
const runtime = runtimeRef.current;
|
|
28930
28971
|
const session = sessionRef.current;
|
|
28931
28972
|
if (!runtime || !session) return;
|
|
@@ -28936,7 +28977,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
28936
28977
|
setCurrentModel(session.model ?? "(unconfigured)");
|
|
28937
28978
|
setProviderLabel(formatProviderLabel(session.provider, session.model));
|
|
28938
28979
|
}, []);
|
|
28939
|
-
const setSessionMode =
|
|
28980
|
+
const setSessionMode = useCallback23((mode) => {
|
|
28940
28981
|
setAgentMode(mode);
|
|
28941
28982
|
}, []);
|
|
28942
28983
|
const sessionCommandServices = useMemo15(
|
|
@@ -29172,7 +29213,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29172
29213
|
unsubscribeRef.current = [];
|
|
29173
29214
|
};
|
|
29174
29215
|
}, [addHistoryItem, config, cwd, model, provider]);
|
|
29175
|
-
const resolveApproval =
|
|
29216
|
+
const resolveApproval = useCallback23(
|
|
29176
29217
|
(decision) => {
|
|
29177
29218
|
const runtime = runtimeRef.current;
|
|
29178
29219
|
const current = approvalQueue[0];
|
|
@@ -29185,7 +29226,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29185
29226
|
},
|
|
29186
29227
|
[approvalQueue]
|
|
29187
29228
|
);
|
|
29188
|
-
const appendTurnItems =
|
|
29229
|
+
const appendTurnItems = useCallback23(
|
|
29189
29230
|
(items) => {
|
|
29190
29231
|
const base = Date.now();
|
|
29191
29232
|
for (const item of items) {
|
|
@@ -29194,7 +29235,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29194
29235
|
},
|
|
29195
29236
|
[historyManager]
|
|
29196
29237
|
);
|
|
29197
|
-
const runPrompt =
|
|
29238
|
+
const runPrompt = useCallback23(
|
|
29198
29239
|
async (rawPrompt) => {
|
|
29199
29240
|
const runtime = runtimeRef.current;
|
|
29200
29241
|
const session = sessionRef.current;
|
|
@@ -29203,6 +29244,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29203
29244
|
if (!prompt) return;
|
|
29204
29245
|
historyManager.addItem({ type: "user", text: prompt }, Date.now());
|
|
29205
29246
|
lastSubmittedPromptRef.current = prompt;
|
|
29247
|
+
setPromptSuggestion(null);
|
|
29206
29248
|
setPendingAssistantText("");
|
|
29207
29249
|
setIsRunning(true);
|
|
29208
29250
|
setIsReceivingContent(false);
|
|
@@ -29255,6 +29297,14 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29255
29297
|
turnItems.push({ type: "gemini", text: output.trim() });
|
|
29256
29298
|
}
|
|
29257
29299
|
appendTurnItems(turnItems);
|
|
29300
|
+
const rt = runtimeRef.current;
|
|
29301
|
+
const sess = sessionRef.current;
|
|
29302
|
+
if (rt && sess && output.trim()) {
|
|
29303
|
+
generateFollowupSuggestion(rt, sess, output, controller.signal).then((s) => {
|
|
29304
|
+
if (s) setPromptSuggestion(s);
|
|
29305
|
+
}).catch(() => {
|
|
29306
|
+
});
|
|
29307
|
+
}
|
|
29258
29308
|
} catch (error) {
|
|
29259
29309
|
const aborted = controller.signal.aborted;
|
|
29260
29310
|
const partialMessages = session.messages.slice(startIndex);
|
|
@@ -29276,7 +29326,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29276
29326
|
},
|
|
29277
29327
|
[agentMode, appendTurnItems, historyManager]
|
|
29278
29328
|
);
|
|
29279
|
-
const executeClientToolCommand =
|
|
29329
|
+
const executeClientToolCommand = useCallback23(
|
|
29280
29330
|
async (toolName, toolArgs) => {
|
|
29281
29331
|
const runtime = runtimeRef.current;
|
|
29282
29332
|
const session = sessionRef.current;
|
|
@@ -29369,7 +29419,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29369
29419
|
},
|
|
29370
29420
|
[agentMode, historyManager]
|
|
29371
29421
|
);
|
|
29372
|
-
const applySlashCommandResult =
|
|
29422
|
+
const applySlashCommandResult = useCallback23(
|
|
29373
29423
|
async (result, _rawInvocation) => {
|
|
29374
29424
|
if (!result) return;
|
|
29375
29425
|
switch (result.type) {
|
|
@@ -29430,7 +29480,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29430
29480
|
},
|
|
29431
29481
|
[appendTurnItems, executeClientToolCommand, historyManager, runPrompt]
|
|
29432
29482
|
);
|
|
29433
|
-
const executeSlashCommand =
|
|
29483
|
+
const executeSlashCommand = useCallback23(
|
|
29434
29484
|
async (rawInput, overwriteConfirmed = false) => {
|
|
29435
29485
|
const trimmed = rawInput.trim();
|
|
29436
29486
|
if (!trimmed.startsWith("/")) return false;
|
|
@@ -29503,7 +29553,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29503
29553
|
slashCommands
|
|
29504
29554
|
]
|
|
29505
29555
|
);
|
|
29506
|
-
const executeSubmission =
|
|
29556
|
+
const executeSubmission = useCallback23(
|
|
29507
29557
|
async (value) => {
|
|
29508
29558
|
const trimmed = value.trim();
|
|
29509
29559
|
if (!trimmed) return;
|
|
@@ -29513,7 +29563,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29513
29563
|
},
|
|
29514
29564
|
[executeSlashCommand, runPrompt]
|
|
29515
29565
|
);
|
|
29516
|
-
const handleFinalSubmit =
|
|
29566
|
+
const handleFinalSubmit = useCallback23(
|
|
29517
29567
|
(value) => {
|
|
29518
29568
|
const prompt = value.trim();
|
|
29519
29569
|
if (!prompt) return;
|
|
@@ -29539,7 +29589,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29539
29589
|
isRunning
|
|
29540
29590
|
]
|
|
29541
29591
|
);
|
|
29542
|
-
const handleRetryLastPrompt =
|
|
29592
|
+
const handleRetryLastPrompt = useCallback23(() => {
|
|
29543
29593
|
const lastPrompt = lastSubmittedPromptRef.current;
|
|
29544
29594
|
if (!lastPrompt) {
|
|
29545
29595
|
historyManager.addItem(
|
|
@@ -29554,7 +29604,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29554
29604
|
}
|
|
29555
29605
|
void runPrompt(lastPrompt);
|
|
29556
29606
|
}, [approvalQueue.length, historyManager, isInitializing, isRunning, runPrompt]);
|
|
29557
|
-
const resolveCommandConfirmation =
|
|
29607
|
+
const resolveCommandConfirmation = useCallback23(
|
|
29558
29608
|
(confirmed) => {
|
|
29559
29609
|
const pending = pendingCommandConfirmation;
|
|
29560
29610
|
if (!pending) return;
|
|
@@ -29585,7 +29635,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29585
29635
|
pendingCommandConfirmation
|
|
29586
29636
|
]
|
|
29587
29637
|
);
|
|
29588
|
-
const persistConfig =
|
|
29638
|
+
const persistConfig = useCallback23(
|
|
29589
29639
|
async (mutate) => {
|
|
29590
29640
|
const loader = new ConfigLoader();
|
|
29591
29641
|
const options = { cwd, configPath: config };
|
|
@@ -29594,7 +29644,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29594
29644
|
},
|
|
29595
29645
|
[config, cwd]
|
|
29596
29646
|
);
|
|
29597
|
-
const handleSelectTheme =
|
|
29647
|
+
const handleSelectTheme = useCallback23(
|
|
29598
29648
|
(nextThemeName) => {
|
|
29599
29649
|
themeManager.setActiveTheme(nextThemeName);
|
|
29600
29650
|
setThemeName(themeManager.getActiveTheme().name);
|
|
@@ -29615,7 +29665,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29615
29665
|
},
|
|
29616
29666
|
[cwd, historyManager]
|
|
29617
29667
|
);
|
|
29618
|
-
const handleSavePermissions =
|
|
29668
|
+
const handleSavePermissions = useCallback23(
|
|
29619
29669
|
(modes) => {
|
|
29620
29670
|
setPermissionModes(modes);
|
|
29621
29671
|
setPermissionSummary(formatPermissionSummary(modes));
|
|
@@ -29644,7 +29694,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29644
29694
|
},
|
|
29645
29695
|
[historyManager, persistConfig]
|
|
29646
29696
|
);
|
|
29647
|
-
const handlePersistToken =
|
|
29697
|
+
const handlePersistToken = useCallback23(
|
|
29648
29698
|
async (token) => {
|
|
29649
29699
|
await persistConfig((cfg) => ({
|
|
29650
29700
|
...cfg,
|
|
@@ -29658,12 +29708,12 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29658
29708
|
},
|
|
29659
29709
|
[persistConfig]
|
|
29660
29710
|
);
|
|
29661
|
-
const providerHasApiKey =
|
|
29711
|
+
const providerHasApiKey = useCallback23((provider2) => {
|
|
29662
29712
|
const runtime = runtimeRef.current;
|
|
29663
29713
|
void providerConfigVersion;
|
|
29664
29714
|
return Boolean(runtime?.config.providers[provider2]?.apiKey?.trim());
|
|
29665
29715
|
}, [providerConfigVersion]);
|
|
29666
|
-
const getProviderKeyHint =
|
|
29716
|
+
const getProviderKeyHint = useCallback23((provider2) => {
|
|
29667
29717
|
const runtime = runtimeRef.current;
|
|
29668
29718
|
void providerConfigVersion;
|
|
29669
29719
|
const key = runtime?.config.providers[provider2]?.apiKey?.trim();
|
|
@@ -29671,7 +29721,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29671
29721
|
if (key.length <= 8) return "\u25CF".repeat(key.length);
|
|
29672
29722
|
return `${key.slice(0, 6)}\u25CF\u25CF\u25CF\u25CF${key.slice(-4)}`;
|
|
29673
29723
|
}, [providerConfigVersion]);
|
|
29674
|
-
const handleSaveProviderApiKey =
|
|
29724
|
+
const handleSaveProviderApiKey = useCallback23(
|
|
29675
29725
|
async (provider2, apiKey) => {
|
|
29676
29726
|
await persistConfig((cfg) => ({
|
|
29677
29727
|
...cfg,
|
|
@@ -29696,7 +29746,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29696
29746
|
},
|
|
29697
29747
|
[historyManager, persistConfig]
|
|
29698
29748
|
);
|
|
29699
|
-
const handleSetDefaultProvider =
|
|
29749
|
+
const handleSetDefaultProvider = useCallback23(
|
|
29700
29750
|
async (provider2) => {
|
|
29701
29751
|
const runtime = runtimeRef.current;
|
|
29702
29752
|
const session = sessionRef.current;
|
|
@@ -29738,7 +29788,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29738
29788
|
},
|
|
29739
29789
|
[historyManager, persistConfig]
|
|
29740
29790
|
);
|
|
29741
|
-
const handleTestProvider =
|
|
29791
|
+
const handleTestProvider = useCallback23(
|
|
29742
29792
|
async (provider2) => {
|
|
29743
29793
|
const runtime = runtimeRef.current;
|
|
29744
29794
|
const session = sessionRef.current;
|
|
@@ -29786,7 +29836,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29786
29836
|
},
|
|
29787
29837
|
[]
|
|
29788
29838
|
);
|
|
29789
|
-
const handleFetchModels =
|
|
29839
|
+
const handleFetchModels = useCallback23(
|
|
29790
29840
|
async (provider2, signal) => {
|
|
29791
29841
|
const runtime = runtimeRef.current;
|
|
29792
29842
|
if (!runtime) throw new Error("Runtime not ready.");
|
|
@@ -29794,15 +29844,15 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29794
29844
|
},
|
|
29795
29845
|
[]
|
|
29796
29846
|
);
|
|
29797
|
-
const handleSelectModel =
|
|
29847
|
+
const handleSelectModel = useCallback23(
|
|
29798
29848
|
(modelId) => {
|
|
29799
29849
|
setSessionModel(modelId);
|
|
29800
29850
|
setActiveDialog(null);
|
|
29801
29851
|
},
|
|
29802
29852
|
[setSessionModel]
|
|
29803
29853
|
);
|
|
29804
|
-
const closeDialog =
|
|
29805
|
-
const previewTheme =
|
|
29854
|
+
const closeDialog = useCallback23(() => setActiveDialog(null), []);
|
|
29855
|
+
const previewTheme = useCallback23(() => setThemeVersion((version) => version + 1), []);
|
|
29806
29856
|
useEffect25(() => {
|
|
29807
29857
|
if (drainingQueueRef.current || isRunning || isInitializing || Boolean(initError) || approvalQueue.length > 0 || messageQueue.length === 0) {
|
|
29808
29858
|
return;
|
|
@@ -29958,7 +30008,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29958
30008
|
commandContext,
|
|
29959
30009
|
recentSlashCommands,
|
|
29960
30010
|
embeddedShellFocused: false,
|
|
29961
|
-
promptSuggestion
|
|
30011
|
+
promptSuggestion,
|
|
29962
30012
|
dismissPromptSuggestion,
|
|
29963
30013
|
terminalWidth,
|
|
29964
30014
|
terminalHeight,
|
|
@@ -29997,6 +30047,7 @@ var AppContainer = ({ cwd, config, provider, model }) => {
|
|
|
29997
30047
|
currentModel,
|
|
29998
30048
|
cwd,
|
|
29999
30049
|
dismissPromptSuggestion,
|
|
30050
|
+
promptSuggestion,
|
|
30000
30051
|
elapsedTime,
|
|
30001
30052
|
historyManager,
|
|
30002
30053
|
historyRemountKey,
|