@protolabsai/proto 0.25.1 → 0.25.3
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 +1061 -909
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -46875,9 +46875,9 @@ var require_logging_utils = __commonJS({
|
|
|
46875
46875
|
this.debugPkg = pkg2;
|
|
46876
46876
|
}
|
|
46877
46877
|
makeLogger(namespace) {
|
|
46878
|
-
const
|
|
46878
|
+
const debugLogger157 = this.debugPkg(namespace);
|
|
46879
46879
|
return (fields, ...args2) => {
|
|
46880
|
-
|
|
46880
|
+
debugLogger157(args2[0], ...args2.slice(1));
|
|
46881
46881
|
};
|
|
46882
46882
|
}
|
|
46883
46883
|
setFilters() {
|
|
@@ -46901,7 +46901,7 @@ var require_logging_utils = __commonJS({
|
|
|
46901
46901
|
}
|
|
46902
46902
|
makeLogger(namespace) {
|
|
46903
46903
|
var _a7;
|
|
46904
|
-
const
|
|
46904
|
+
const debugLogger157 = (_a7 = this.upstream) === null || _a7 === void 0 ? void 0 : _a7.makeLogger(namespace);
|
|
46905
46905
|
return (fields, ...args2) => {
|
|
46906
46906
|
var _a8;
|
|
46907
46907
|
const severity = (_a8 = fields.severity) !== null && _a8 !== void 0 ? _a8 : LogSeverity.INFO;
|
|
@@ -46910,8 +46910,8 @@ var require_logging_utils = __commonJS({
|
|
|
46910
46910
|
message: util3.format(...args2)
|
|
46911
46911
|
}, fields);
|
|
46912
46912
|
const jsonString = JSON.stringify(json3);
|
|
46913
|
-
if (
|
|
46914
|
-
|
|
46913
|
+
if (debugLogger157) {
|
|
46914
|
+
debugLogger157(fields, jsonString);
|
|
46915
46915
|
} else {
|
|
46916
46916
|
console.log("%s", jsonString);
|
|
46917
46917
|
}
|
|
@@ -143152,7 +143152,7 @@ function initializeTelemetry(config2) {
|
|
|
143152
143152
|
if (telemetryInitialized || !config2.getTelemetryEnabled() && !langfuseProcessor) {
|
|
143153
143153
|
return;
|
|
143154
143154
|
}
|
|
143155
|
-
const
|
|
143155
|
+
const debugLogger157 = createDebugLogger("OTEL");
|
|
143156
143156
|
const resource = (0, import_resources.resourceFromAttributes)({
|
|
143157
143157
|
[SemanticResourceAttributes.SERVICE_NAME]: SERVICE_NAME,
|
|
143158
143158
|
[SemanticResourceAttributes.SERVICE_VERSION]: process.version,
|
|
@@ -143221,7 +143221,7 @@ function initializeTelemetry(config2) {
|
|
|
143221
143221
|
}
|
|
143222
143222
|
if (langfuseProcessor) {
|
|
143223
143223
|
spanProcessors.push(langfuseProcessor);
|
|
143224
|
-
|
|
143224
|
+
debugLogger157.debug("Langfuse span processor enabled.");
|
|
143225
143225
|
}
|
|
143226
143226
|
sdk = new import_sdk_node.NodeSDK({
|
|
143227
143227
|
resource,
|
|
@@ -143232,11 +143232,11 @@ function initializeTelemetry(config2) {
|
|
|
143232
143232
|
});
|
|
143233
143233
|
try {
|
|
143234
143234
|
sdk.start();
|
|
143235
|
-
|
|
143235
|
+
debugLogger157.debug("OpenTelemetry SDK started successfully.");
|
|
143236
143236
|
telemetryInitialized = true;
|
|
143237
143237
|
initializeMetrics(config2);
|
|
143238
143238
|
} catch (error40) {
|
|
143239
|
-
|
|
143239
|
+
debugLogger157.error("Error starting OpenTelemetry SDK:", error40);
|
|
143240
143240
|
}
|
|
143241
143241
|
process.on("SIGTERM", () => {
|
|
143242
143242
|
shutdownTelemetry();
|
|
@@ -143252,12 +143252,12 @@ async function shutdownTelemetry() {
|
|
|
143252
143252
|
if (!telemetryInitialized || !sdk) {
|
|
143253
143253
|
return;
|
|
143254
143254
|
}
|
|
143255
|
-
const
|
|
143255
|
+
const debugLogger157 = createDebugLogger("OTEL");
|
|
143256
143256
|
try {
|
|
143257
143257
|
await sdk.shutdown();
|
|
143258
|
-
|
|
143258
|
+
debugLogger157.debug("OpenTelemetry SDK shut down successfully.");
|
|
143259
143259
|
} catch (error40) {
|
|
143260
|
-
|
|
143260
|
+
debugLogger157.error("Error shutting down SDK:", error40);
|
|
143261
143261
|
} finally {
|
|
143262
143262
|
telemetryInitialized = false;
|
|
143263
143263
|
}
|
|
@@ -170887,7 +170887,7 @@ __export(geminiContentGenerator_exports, {
|
|
|
170887
170887
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
170888
170888
|
});
|
|
170889
170889
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
170890
|
-
const version2 = "0.25.
|
|
170890
|
+
const version2 = "0.25.3";
|
|
170891
170891
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
170892
170892
|
const baseHeaders = {
|
|
170893
170893
|
"User-Agent": userAgent2
|
|
@@ -277716,6 +277716,8 @@ async function ensureNotesFile(projectDir) {
|
|
|
277716
277716
|
async function extractSessionMemory(config2, history, tokenCount) {
|
|
277717
277717
|
if (!(config2.getSessionMemory()?.enabled ?? true))
|
|
277718
277718
|
return;
|
|
277719
|
+
if (isExtractionInProgress())
|
|
277720
|
+
return;
|
|
277719
277721
|
if (!shouldExtractSessionMemory(tokenCount))
|
|
277720
277722
|
return;
|
|
277721
277723
|
markExtractionStarted();
|
|
@@ -277761,7 +277763,8 @@ async function _runExtraction(config2, history, tokenCount) {
|
|
|
277761
277763
|
// Restrict to Edit only — the agent should only touch the notes file
|
|
277762
277764
|
{ tools: [ToolNames.EDIT] }
|
|
277763
277765
|
);
|
|
277764
|
-
|
|
277766
|
+
const timeoutSignal = AbortSignal.timeout(MAX_EXTRACTOR_MINUTES2 * 60 * 1e3);
|
|
277767
|
+
await agent.execute(new ContextState(), timeoutSignal);
|
|
277765
277768
|
recordExtractionTokenCount(tokenCount);
|
|
277766
277769
|
if (history.length > 0) {
|
|
277767
277770
|
setLastSummarizedCursorIndex(history.length - 1);
|
|
@@ -312254,7 +312257,7 @@ var require_backend = __commonJS({
|
|
|
312254
312257
|
return function() {
|
|
312255
312258
|
};
|
|
312256
312259
|
}, "useCacheRefresh"),
|
|
312257
|
-
useCallback: /* @__PURE__ */ __name(function
|
|
312260
|
+
useCallback: /* @__PURE__ */ __name(function useCallback78(a2) {
|
|
312258
312261
|
var b2 = C3();
|
|
312259
312262
|
x3.push({
|
|
312260
312263
|
primitive: "Callback",
|
|
@@ -312271,7 +312274,7 @@ var require_backend = __commonJS({
|
|
|
312271
312274
|
});
|
|
312272
312275
|
return a2._currentValue;
|
|
312273
312276
|
}, "useContext"),
|
|
312274
|
-
useEffect: /* @__PURE__ */ __name(function
|
|
312277
|
+
useEffect: /* @__PURE__ */ __name(function useEffect74(a2) {
|
|
312275
312278
|
C3();
|
|
312276
312279
|
x3.push({
|
|
312277
312280
|
primitive: "Effect",
|
|
@@ -312336,7 +312339,7 @@ var require_backend = __commonJS({
|
|
|
312336
312339
|
return [b2, function() {
|
|
312337
312340
|
}];
|
|
312338
312341
|
}, "useReducer"),
|
|
312339
|
-
useRef: /* @__PURE__ */ __name(function
|
|
312342
|
+
useRef: /* @__PURE__ */ __name(function useRef29(a2) {
|
|
312340
312343
|
var b2 = C3();
|
|
312341
312344
|
a2 = null !== b2 ? b2.memoizedState : {
|
|
312342
312345
|
current: a2
|
|
@@ -312348,7 +312351,7 @@ var require_backend = __commonJS({
|
|
|
312348
312351
|
});
|
|
312349
312352
|
return a2;
|
|
312350
312353
|
}, "useRef"),
|
|
312351
|
-
useState: /* @__PURE__ */ __name(function
|
|
312354
|
+
useState: /* @__PURE__ */ __name(function useState97(a2) {
|
|
312352
312355
|
var b2 = C3();
|
|
312353
312356
|
a2 = null !== b2 ? b2.memoizedState : "function" === typeof a2 ? a2() : a2;
|
|
312354
312357
|
x3.push({
|
|
@@ -383886,9 +383889,9 @@ var require_logging_utils2 = __commonJS({
|
|
|
383886
383889
|
this.debugPkg = pkg2;
|
|
383887
383890
|
}
|
|
383888
383891
|
makeLogger(namespace) {
|
|
383889
|
-
const
|
|
383892
|
+
const debugLogger157 = this.debugPkg(namespace);
|
|
383890
383893
|
return (fields, ...args2) => {
|
|
383891
|
-
|
|
383894
|
+
debugLogger157(args2[0], ...args2.slice(1));
|
|
383892
383895
|
};
|
|
383893
383896
|
}
|
|
383894
383897
|
setFilters() {
|
|
@@ -383912,7 +383915,7 @@ var require_logging_utils2 = __commonJS({
|
|
|
383912
383915
|
}
|
|
383913
383916
|
makeLogger(namespace) {
|
|
383914
383917
|
var _a7;
|
|
383915
|
-
const
|
|
383918
|
+
const debugLogger157 = (_a7 = this.upstream) === null || _a7 === void 0 ? void 0 : _a7.makeLogger(namespace);
|
|
383916
383919
|
return (fields, ...args2) => {
|
|
383917
383920
|
var _a8;
|
|
383918
383921
|
const severity = (_a8 = fields.severity) !== null && _a8 !== void 0 ? _a8 : LogSeverity.INFO;
|
|
@@ -383921,8 +383924,8 @@ var require_logging_utils2 = __commonJS({
|
|
|
383921
383924
|
message: util3.format(...args2)
|
|
383922
383925
|
}, fields);
|
|
383923
383926
|
const jsonString = JSON.stringify(json3);
|
|
383924
|
-
if (
|
|
383925
|
-
|
|
383927
|
+
if (debugLogger157) {
|
|
383928
|
+
debugLogger157(fields, jsonString);
|
|
383926
383929
|
} else {
|
|
383927
383930
|
console.log("%s", jsonString);
|
|
383928
383931
|
}
|
|
@@ -402954,7 +402957,7 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
|
|
|
402954
402957
|
var measure_element_default = measureElement;
|
|
402955
402958
|
|
|
402956
402959
|
// packages/cli/src/gemini.tsx
|
|
402957
|
-
var
|
|
402960
|
+
var import_react176 = __toESM(require_react(), 1);
|
|
402958
402961
|
import dns2 from "node:dns";
|
|
402959
402962
|
import os50 from "node:os";
|
|
402960
402963
|
import { basename as basename31 } from "node:path";
|
|
@@ -414695,7 +414698,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
414695
414698
|
// packages/cli/src/utils/version.ts
|
|
414696
414699
|
async function getCliVersion() {
|
|
414697
414700
|
const pkgJson = await getPackageJson();
|
|
414698
|
-
return "0.25.
|
|
414701
|
+
return "0.25.3";
|
|
414699
414702
|
}
|
|
414700
414703
|
__name(getCliVersion, "getCliVersion");
|
|
414701
414704
|
|
|
@@ -422467,7 +422470,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
422467
422470
|
|
|
422468
422471
|
// packages/cli/src/generated/git-commit.ts
|
|
422469
422472
|
init_esbuild_shims();
|
|
422470
|
-
var GIT_COMMIT_INFO = "
|
|
422473
|
+
var GIT_COMMIT_INFO = "ad304b2ec";
|
|
422471
422474
|
|
|
422472
422475
|
// packages/cli/src/utils/systemInfo.ts
|
|
422473
422476
|
async function getNpmVersion() {
|
|
@@ -436056,7 +436059,7 @@ __name(runNonInteractiveStreamJson, "runNonInteractiveStreamJson");
|
|
|
436056
436059
|
|
|
436057
436060
|
// packages/cli/src/ui/AppContainer.tsx
|
|
436058
436061
|
init_esbuild_shims();
|
|
436059
|
-
var
|
|
436062
|
+
var import_react173 = __toESM(require_react(), 1);
|
|
436060
436063
|
|
|
436061
436064
|
// packages/cli/src/ui/App.tsx
|
|
436062
436065
|
init_esbuild_shims();
|
|
@@ -474985,305 +474988,6 @@ var App2 = /* @__PURE__ */ __name(() => {
|
|
|
474985
474988
|
|
|
474986
474989
|
// packages/cli/src/ui/AppContainer.tsx
|
|
474987
474990
|
init_dist4();
|
|
474988
|
-
|
|
474989
|
-
// packages/cli/src/ui/utils/resumeHistoryUtils.ts
|
|
474990
|
-
init_esbuild_shims();
|
|
474991
|
-
import * as path131 from "node:path";
|
|
474992
|
-
function extractTextFromParts(parts2) {
|
|
474993
|
-
if (!parts2) return "";
|
|
474994
|
-
const textParts = [];
|
|
474995
|
-
for (const part of parts2) {
|
|
474996
|
-
if ("text" in part && part.text) {
|
|
474997
|
-
if (!("thought" in part && part.thought)) {
|
|
474998
|
-
textParts.push(part.text);
|
|
474999
|
-
}
|
|
475000
|
-
}
|
|
475001
|
-
}
|
|
475002
|
-
return textParts.join("\n");
|
|
475003
|
-
}
|
|
475004
|
-
__name(extractTextFromParts, "extractTextFromParts");
|
|
475005
|
-
function extractThoughtTextFromParts(parts2) {
|
|
475006
|
-
if (!parts2) return "";
|
|
475007
|
-
const thoughtParts = [];
|
|
475008
|
-
for (const part of parts2) {
|
|
475009
|
-
if ("text" in part && part.text && "thought" in part && part.thought) {
|
|
475010
|
-
thoughtParts.push(part.text);
|
|
475011
|
-
}
|
|
475012
|
-
}
|
|
475013
|
-
return thoughtParts.join("\n");
|
|
475014
|
-
}
|
|
475015
|
-
__name(extractThoughtTextFromParts, "extractThoughtTextFromParts");
|
|
475016
|
-
function extractFunctionCalls(parts2) {
|
|
475017
|
-
if (!parts2) return [];
|
|
475018
|
-
const calls = [];
|
|
475019
|
-
for (const part of parts2) {
|
|
475020
|
-
if ("functionCall" in part && part.functionCall) {
|
|
475021
|
-
const fc = part.functionCall;
|
|
475022
|
-
calls.push({
|
|
475023
|
-
id: fc.id || `call-${calls.length}`,
|
|
475024
|
-
name: fc.name || "unknown",
|
|
475025
|
-
args: fc.args || {}
|
|
475026
|
-
});
|
|
475027
|
-
}
|
|
475028
|
-
}
|
|
475029
|
-
return calls;
|
|
475030
|
-
}
|
|
475031
|
-
__name(extractFunctionCalls, "extractFunctionCalls");
|
|
475032
|
-
function getTool(config2, name4) {
|
|
475033
|
-
const toolRegistry = config2.getToolRegistry();
|
|
475034
|
-
return toolRegistry.getTool(name4);
|
|
475035
|
-
}
|
|
475036
|
-
__name(getTool, "getTool");
|
|
475037
|
-
function formatToolDescription(tool, args2) {
|
|
475038
|
-
try {
|
|
475039
|
-
const invocation = tool.build(args2);
|
|
475040
|
-
return invocation.getDescription();
|
|
475041
|
-
} catch {
|
|
475042
|
-
if (typeof args2["description"] === "string") {
|
|
475043
|
-
return args2["description"];
|
|
475044
|
-
}
|
|
475045
|
-
return "";
|
|
475046
|
-
}
|
|
475047
|
-
}
|
|
475048
|
-
__name(formatToolDescription, "formatToolDescription");
|
|
475049
|
-
function restoreHistoryItem(raw2) {
|
|
475050
|
-
if (!raw2 || typeof raw2 !== "object") {
|
|
475051
|
-
return;
|
|
475052
|
-
}
|
|
475053
|
-
const clone4 = { ...raw2 };
|
|
475054
|
-
if ("timestamp" in clone4) {
|
|
475055
|
-
const ts = clone4["timestamp"];
|
|
475056
|
-
if (typeof ts === "string" || typeof ts === "number") {
|
|
475057
|
-
clone4["timestamp"] = new Date(ts);
|
|
475058
|
-
}
|
|
475059
|
-
}
|
|
475060
|
-
if (typeof clone4["type"] !== "string") {
|
|
475061
|
-
return;
|
|
475062
|
-
}
|
|
475063
|
-
return clone4;
|
|
475064
|
-
}
|
|
475065
|
-
__name(restoreHistoryItem, "restoreHistoryItem");
|
|
475066
|
-
function convertToHistoryItems(conversation, config2) {
|
|
475067
|
-
const items = [];
|
|
475068
|
-
const pendingAtCommands = [];
|
|
475069
|
-
let atCommandCounter = 0;
|
|
475070
|
-
const pendingToolCalls = /* @__PURE__ */ new Map();
|
|
475071
|
-
let currentToolGroup = [];
|
|
475072
|
-
const buildAtCommandDisplays = /* @__PURE__ */ __name((payload) => {
|
|
475073
|
-
if (payload.status === "error") {
|
|
475074
|
-
atCommandCounter += 1;
|
|
475075
|
-
const filesLabel = payload.filesRead?.length ? payload.filesRead.join(", ") : "files";
|
|
475076
|
-
return [
|
|
475077
|
-
{
|
|
475078
|
-
callId: `at-command-${atCommandCounter}`,
|
|
475079
|
-
name: "Read File(s)",
|
|
475080
|
-
description: "Error attempting to read files",
|
|
475081
|
-
status: "Error" /* Error */,
|
|
475082
|
-
resultDisplay: payload.message || `Error reading files (${filesLabel})`,
|
|
475083
|
-
confirmationDetails: void 0
|
|
475084
|
-
}
|
|
475085
|
-
];
|
|
475086
|
-
}
|
|
475087
|
-
if (!payload.filesRead?.length) {
|
|
475088
|
-
atCommandCounter += 1;
|
|
475089
|
-
return [
|
|
475090
|
-
{
|
|
475091
|
-
callId: `at-command-${atCommandCounter}`,
|
|
475092
|
-
name: "Read File",
|
|
475093
|
-
description: "Read File(s)",
|
|
475094
|
-
status: "Success" /* Success */,
|
|
475095
|
-
resultDisplay: void 0,
|
|
475096
|
-
confirmationDetails: void 0
|
|
475097
|
-
}
|
|
475098
|
-
];
|
|
475099
|
-
}
|
|
475100
|
-
return payload.filesRead.map((filePath) => {
|
|
475101
|
-
atCommandCounter += 1;
|
|
475102
|
-
const isDir = filePath.endsWith("/");
|
|
475103
|
-
return {
|
|
475104
|
-
callId: `at-command-${atCommandCounter}`,
|
|
475105
|
-
name: isDir ? "Read Directory" : "Read File",
|
|
475106
|
-
description: isDir ? `Read directory ${path131.basename(filePath)}` : `Read file ${path131.basename(filePath)}`,
|
|
475107
|
-
status: "Success" /* Success */,
|
|
475108
|
-
resultDisplay: void 0,
|
|
475109
|
-
confirmationDetails: void 0
|
|
475110
|
-
};
|
|
475111
|
-
});
|
|
475112
|
-
}, "buildAtCommandDisplays");
|
|
475113
|
-
for (const record2 of conversation.messages) {
|
|
475114
|
-
if (record2.type === "system") {
|
|
475115
|
-
if (record2.subtype === "slash_command") {
|
|
475116
|
-
if (currentToolGroup.length > 0) {
|
|
475117
|
-
items.push({
|
|
475118
|
-
type: "tool_group",
|
|
475119
|
-
tools: [...currentToolGroup]
|
|
475120
|
-
});
|
|
475121
|
-
currentToolGroup = [];
|
|
475122
|
-
}
|
|
475123
|
-
const payload = record2.systemPayload;
|
|
475124
|
-
if (!payload) continue;
|
|
475125
|
-
if (payload.phase === "invocation" && payload.rawCommand) {
|
|
475126
|
-
items.push({ type: "user", text: payload.rawCommand });
|
|
475127
|
-
}
|
|
475128
|
-
if (payload.phase === "result") {
|
|
475129
|
-
const outputs = payload.outputHistoryItems ?? [];
|
|
475130
|
-
for (const raw2 of outputs) {
|
|
475131
|
-
const restored = restoreHistoryItem(raw2);
|
|
475132
|
-
if (restored) {
|
|
475133
|
-
items.push(restored);
|
|
475134
|
-
}
|
|
475135
|
-
}
|
|
475136
|
-
}
|
|
475137
|
-
}
|
|
475138
|
-
if (record2.subtype === "at_command") {
|
|
475139
|
-
const payload = record2.systemPayload;
|
|
475140
|
-
if (!payload) continue;
|
|
475141
|
-
pendingAtCommands.push(payload);
|
|
475142
|
-
}
|
|
475143
|
-
continue;
|
|
475144
|
-
}
|
|
475145
|
-
switch (record2.type) {
|
|
475146
|
-
case "user": {
|
|
475147
|
-
if (pendingAtCommands.length > 0) {
|
|
475148
|
-
if (currentToolGroup.length > 0) {
|
|
475149
|
-
items.push({
|
|
475150
|
-
type: "tool_group",
|
|
475151
|
-
tools: [...currentToolGroup]
|
|
475152
|
-
});
|
|
475153
|
-
currentToolGroup = [];
|
|
475154
|
-
}
|
|
475155
|
-
const payload = pendingAtCommands.shift();
|
|
475156
|
-
const text2 = payload.userText || extractTextFromParts(record2.message?.parts);
|
|
475157
|
-
if (text2) {
|
|
475158
|
-
items.push({ type: "user", text: text2 });
|
|
475159
|
-
}
|
|
475160
|
-
const toolDisplays = buildAtCommandDisplays(payload);
|
|
475161
|
-
if (toolDisplays.length > 0) {
|
|
475162
|
-
items.push({
|
|
475163
|
-
type: "tool_group",
|
|
475164
|
-
tools: toolDisplays
|
|
475165
|
-
});
|
|
475166
|
-
}
|
|
475167
|
-
break;
|
|
475168
|
-
}
|
|
475169
|
-
if (currentToolGroup.length > 0) {
|
|
475170
|
-
items.push({
|
|
475171
|
-
type: "tool_group",
|
|
475172
|
-
tools: [...currentToolGroup]
|
|
475173
|
-
});
|
|
475174
|
-
currentToolGroup = [];
|
|
475175
|
-
}
|
|
475176
|
-
const text = extractTextFromParts(record2.message?.parts);
|
|
475177
|
-
if (text) {
|
|
475178
|
-
items.push({ type: "user", text });
|
|
475179
|
-
}
|
|
475180
|
-
break;
|
|
475181
|
-
}
|
|
475182
|
-
case "assistant": {
|
|
475183
|
-
const parts2 = record2.message?.parts;
|
|
475184
|
-
const thoughtText = !config2.getContentGenerator().useSummarizedThinking() ? extractThoughtTextFromParts(parts2) : "";
|
|
475185
|
-
const text = extractTextFromParts(parts2);
|
|
475186
|
-
const functionCalls = extractFunctionCalls(parts2);
|
|
475187
|
-
if (thoughtText) {
|
|
475188
|
-
if (currentToolGroup.length > 0) {
|
|
475189
|
-
items.push({
|
|
475190
|
-
type: "tool_group",
|
|
475191
|
-
tools: [...currentToolGroup]
|
|
475192
|
-
});
|
|
475193
|
-
currentToolGroup = [];
|
|
475194
|
-
}
|
|
475195
|
-
items.push({ type: "gemini_thought", text: thoughtText });
|
|
475196
|
-
}
|
|
475197
|
-
if (text) {
|
|
475198
|
-
if (currentToolGroup.length > 0) {
|
|
475199
|
-
items.push({
|
|
475200
|
-
type: "tool_group",
|
|
475201
|
-
tools: [...currentToolGroup]
|
|
475202
|
-
});
|
|
475203
|
-
currentToolGroup = [];
|
|
475204
|
-
}
|
|
475205
|
-
items.push({ type: "gemini", text });
|
|
475206
|
-
}
|
|
475207
|
-
for (const fc of functionCalls) {
|
|
475208
|
-
const tool = getTool(config2, fc.name);
|
|
475209
|
-
pendingToolCalls.set(fc.id, { name: fc.name, args: fc.args });
|
|
475210
|
-
currentToolGroup.push({
|
|
475211
|
-
callId: fc.id,
|
|
475212
|
-
name: tool?.displayName || fc.name,
|
|
475213
|
-
description: tool ? formatToolDescription(tool, fc.args) : "",
|
|
475214
|
-
resultDisplay: void 0,
|
|
475215
|
-
status: "Success" /* Success */,
|
|
475216
|
-
// Will be updated by tool_result
|
|
475217
|
-
confirmationDetails: void 0
|
|
475218
|
-
});
|
|
475219
|
-
}
|
|
475220
|
-
break;
|
|
475221
|
-
}
|
|
475222
|
-
case "tool_result": {
|
|
475223
|
-
if (record2.toolCallResult) {
|
|
475224
|
-
const callId = record2.toolCallResult.callId;
|
|
475225
|
-
const toolCall = currentToolGroup.find((t5) => t5.callId === callId);
|
|
475226
|
-
if (toolCall) {
|
|
475227
|
-
const rawDisplay = record2.toolCallResult.resultDisplay;
|
|
475228
|
-
toolCall.resultDisplay = rawDisplay;
|
|
475229
|
-
const rawStatus = record2.toolCallResult["status"];
|
|
475230
|
-
toolCall.status = rawStatus === "error" ? "Error" /* Error */ : "Success" /* Success */;
|
|
475231
|
-
}
|
|
475232
|
-
pendingToolCalls.delete(callId || "");
|
|
475233
|
-
}
|
|
475234
|
-
break;
|
|
475235
|
-
}
|
|
475236
|
-
default:
|
|
475237
|
-
break;
|
|
475238
|
-
}
|
|
475239
|
-
}
|
|
475240
|
-
if (pendingAtCommands.length > 0) {
|
|
475241
|
-
for (const payload of pendingAtCommands) {
|
|
475242
|
-
if (currentToolGroup.length > 0) {
|
|
475243
|
-
items.push({
|
|
475244
|
-
type: "tool_group",
|
|
475245
|
-
tools: [...currentToolGroup]
|
|
475246
|
-
});
|
|
475247
|
-
currentToolGroup = [];
|
|
475248
|
-
}
|
|
475249
|
-
const text = payload.userText;
|
|
475250
|
-
if (text) {
|
|
475251
|
-
items.push({ type: "user", text });
|
|
475252
|
-
}
|
|
475253
|
-
const toolDisplays = buildAtCommandDisplays(payload);
|
|
475254
|
-
if (toolDisplays.length > 0) {
|
|
475255
|
-
items.push({
|
|
475256
|
-
type: "tool_group",
|
|
475257
|
-
tools: toolDisplays
|
|
475258
|
-
});
|
|
475259
|
-
}
|
|
475260
|
-
}
|
|
475261
|
-
}
|
|
475262
|
-
if (currentToolGroup.length > 0) {
|
|
475263
|
-
items.push({
|
|
475264
|
-
type: "tool_group",
|
|
475265
|
-
tools: currentToolGroup
|
|
475266
|
-
});
|
|
475267
|
-
}
|
|
475268
|
-
return items;
|
|
475269
|
-
}
|
|
475270
|
-
__name(convertToHistoryItems, "convertToHistoryItems");
|
|
475271
|
-
function buildResumedHistoryItems(sessionData, config2, baseTimestamp = Date.now()) {
|
|
475272
|
-
const items = [];
|
|
475273
|
-
let idCounter = 1;
|
|
475274
|
-
const getNextId = /* @__PURE__ */ __name(() => baseTimestamp + idCounter++, "getNextId");
|
|
475275
|
-
const historyItems = convertToHistoryItems(sessionData.conversation, config2);
|
|
475276
|
-
for (const item of historyItems) {
|
|
475277
|
-
items.push({
|
|
475278
|
-
...item,
|
|
475279
|
-
id: getNextId()
|
|
475280
|
-
});
|
|
475281
|
-
}
|
|
475282
|
-
return items;
|
|
475283
|
-
}
|
|
475284
|
-
__name(buildResumedHistoryItems, "buildResumedHistoryItems");
|
|
475285
|
-
|
|
475286
|
-
// packages/cli/src/ui/AppContainer.tsx
|
|
475287
474991
|
import process47 from "node:process";
|
|
475288
474992
|
|
|
475289
474993
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
@@ -476029,6 +475733,305 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config2) =>
|
|
|
476029
475733
|
init_esbuild_shims();
|
|
476030
475734
|
var import_react141 = __toESM(require_react(), 1);
|
|
476031
475735
|
init_dist4();
|
|
475736
|
+
|
|
475737
|
+
// packages/cli/src/ui/utils/resumeHistoryUtils.ts
|
|
475738
|
+
init_esbuild_shims();
|
|
475739
|
+
import * as path131 from "node:path";
|
|
475740
|
+
function extractTextFromParts(parts2) {
|
|
475741
|
+
if (!parts2) return "";
|
|
475742
|
+
const textParts = [];
|
|
475743
|
+
for (const part of parts2) {
|
|
475744
|
+
if ("text" in part && part.text) {
|
|
475745
|
+
if (!("thought" in part && part.thought)) {
|
|
475746
|
+
textParts.push(part.text);
|
|
475747
|
+
}
|
|
475748
|
+
}
|
|
475749
|
+
}
|
|
475750
|
+
return textParts.join("\n");
|
|
475751
|
+
}
|
|
475752
|
+
__name(extractTextFromParts, "extractTextFromParts");
|
|
475753
|
+
function extractThoughtTextFromParts(parts2) {
|
|
475754
|
+
if (!parts2) return "";
|
|
475755
|
+
const thoughtParts = [];
|
|
475756
|
+
for (const part of parts2) {
|
|
475757
|
+
if ("text" in part && part.text && "thought" in part && part.thought) {
|
|
475758
|
+
thoughtParts.push(part.text);
|
|
475759
|
+
}
|
|
475760
|
+
}
|
|
475761
|
+
return thoughtParts.join("\n");
|
|
475762
|
+
}
|
|
475763
|
+
__name(extractThoughtTextFromParts, "extractThoughtTextFromParts");
|
|
475764
|
+
function extractFunctionCalls(parts2) {
|
|
475765
|
+
if (!parts2) return [];
|
|
475766
|
+
const calls = [];
|
|
475767
|
+
for (const part of parts2) {
|
|
475768
|
+
if ("functionCall" in part && part.functionCall) {
|
|
475769
|
+
const fc = part.functionCall;
|
|
475770
|
+
calls.push({
|
|
475771
|
+
id: fc.id || `call-${calls.length}`,
|
|
475772
|
+
name: fc.name || "unknown",
|
|
475773
|
+
args: fc.args || {}
|
|
475774
|
+
});
|
|
475775
|
+
}
|
|
475776
|
+
}
|
|
475777
|
+
return calls;
|
|
475778
|
+
}
|
|
475779
|
+
__name(extractFunctionCalls, "extractFunctionCalls");
|
|
475780
|
+
function getTool(config2, name4) {
|
|
475781
|
+
const toolRegistry = config2.getToolRegistry();
|
|
475782
|
+
return toolRegistry.getTool(name4);
|
|
475783
|
+
}
|
|
475784
|
+
__name(getTool, "getTool");
|
|
475785
|
+
function formatToolDescription(tool, args2) {
|
|
475786
|
+
try {
|
|
475787
|
+
const invocation = tool.build(args2);
|
|
475788
|
+
return invocation.getDescription();
|
|
475789
|
+
} catch {
|
|
475790
|
+
if (typeof args2["description"] === "string") {
|
|
475791
|
+
return args2["description"];
|
|
475792
|
+
}
|
|
475793
|
+
return "";
|
|
475794
|
+
}
|
|
475795
|
+
}
|
|
475796
|
+
__name(formatToolDescription, "formatToolDescription");
|
|
475797
|
+
function restoreHistoryItem(raw2) {
|
|
475798
|
+
if (!raw2 || typeof raw2 !== "object") {
|
|
475799
|
+
return;
|
|
475800
|
+
}
|
|
475801
|
+
const clone4 = { ...raw2 };
|
|
475802
|
+
if ("timestamp" in clone4) {
|
|
475803
|
+
const ts = clone4["timestamp"];
|
|
475804
|
+
if (typeof ts === "string" || typeof ts === "number") {
|
|
475805
|
+
clone4["timestamp"] = new Date(ts);
|
|
475806
|
+
}
|
|
475807
|
+
}
|
|
475808
|
+
if (typeof clone4["type"] !== "string") {
|
|
475809
|
+
return;
|
|
475810
|
+
}
|
|
475811
|
+
return clone4;
|
|
475812
|
+
}
|
|
475813
|
+
__name(restoreHistoryItem, "restoreHistoryItem");
|
|
475814
|
+
function convertToHistoryItems(conversation, config2) {
|
|
475815
|
+
const items = [];
|
|
475816
|
+
const pendingAtCommands = [];
|
|
475817
|
+
let atCommandCounter = 0;
|
|
475818
|
+
const pendingToolCalls = /* @__PURE__ */ new Map();
|
|
475819
|
+
let currentToolGroup = [];
|
|
475820
|
+
const buildAtCommandDisplays = /* @__PURE__ */ __name((payload) => {
|
|
475821
|
+
if (payload.status === "error") {
|
|
475822
|
+
atCommandCounter += 1;
|
|
475823
|
+
const filesLabel = payload.filesRead?.length ? payload.filesRead.join(", ") : "files";
|
|
475824
|
+
return [
|
|
475825
|
+
{
|
|
475826
|
+
callId: `at-command-${atCommandCounter}`,
|
|
475827
|
+
name: "Read File(s)",
|
|
475828
|
+
description: "Error attempting to read files",
|
|
475829
|
+
status: "Error" /* Error */,
|
|
475830
|
+
resultDisplay: payload.message || `Error reading files (${filesLabel})`,
|
|
475831
|
+
confirmationDetails: void 0
|
|
475832
|
+
}
|
|
475833
|
+
];
|
|
475834
|
+
}
|
|
475835
|
+
if (!payload.filesRead?.length) {
|
|
475836
|
+
atCommandCounter += 1;
|
|
475837
|
+
return [
|
|
475838
|
+
{
|
|
475839
|
+
callId: `at-command-${atCommandCounter}`,
|
|
475840
|
+
name: "Read File",
|
|
475841
|
+
description: "Read File(s)",
|
|
475842
|
+
status: "Success" /* Success */,
|
|
475843
|
+
resultDisplay: void 0,
|
|
475844
|
+
confirmationDetails: void 0
|
|
475845
|
+
}
|
|
475846
|
+
];
|
|
475847
|
+
}
|
|
475848
|
+
return payload.filesRead.map((filePath) => {
|
|
475849
|
+
atCommandCounter += 1;
|
|
475850
|
+
const isDir = filePath.endsWith("/");
|
|
475851
|
+
return {
|
|
475852
|
+
callId: `at-command-${atCommandCounter}`,
|
|
475853
|
+
name: isDir ? "Read Directory" : "Read File",
|
|
475854
|
+
description: isDir ? `Read directory ${path131.basename(filePath)}` : `Read file ${path131.basename(filePath)}`,
|
|
475855
|
+
status: "Success" /* Success */,
|
|
475856
|
+
resultDisplay: void 0,
|
|
475857
|
+
confirmationDetails: void 0
|
|
475858
|
+
};
|
|
475859
|
+
});
|
|
475860
|
+
}, "buildAtCommandDisplays");
|
|
475861
|
+
for (const record2 of conversation.messages) {
|
|
475862
|
+
if (record2.type === "system") {
|
|
475863
|
+
if (record2.subtype === "slash_command") {
|
|
475864
|
+
if (currentToolGroup.length > 0) {
|
|
475865
|
+
items.push({
|
|
475866
|
+
type: "tool_group",
|
|
475867
|
+
tools: [...currentToolGroup]
|
|
475868
|
+
});
|
|
475869
|
+
currentToolGroup = [];
|
|
475870
|
+
}
|
|
475871
|
+
const payload = record2.systemPayload;
|
|
475872
|
+
if (!payload) continue;
|
|
475873
|
+
if (payload.phase === "invocation" && payload.rawCommand) {
|
|
475874
|
+
items.push({ type: "user", text: payload.rawCommand });
|
|
475875
|
+
}
|
|
475876
|
+
if (payload.phase === "result") {
|
|
475877
|
+
const outputs = payload.outputHistoryItems ?? [];
|
|
475878
|
+
for (const raw2 of outputs) {
|
|
475879
|
+
const restored = restoreHistoryItem(raw2);
|
|
475880
|
+
if (restored) {
|
|
475881
|
+
items.push(restored);
|
|
475882
|
+
}
|
|
475883
|
+
}
|
|
475884
|
+
}
|
|
475885
|
+
}
|
|
475886
|
+
if (record2.subtype === "at_command") {
|
|
475887
|
+
const payload = record2.systemPayload;
|
|
475888
|
+
if (!payload) continue;
|
|
475889
|
+
pendingAtCommands.push(payload);
|
|
475890
|
+
}
|
|
475891
|
+
continue;
|
|
475892
|
+
}
|
|
475893
|
+
switch (record2.type) {
|
|
475894
|
+
case "user": {
|
|
475895
|
+
if (pendingAtCommands.length > 0) {
|
|
475896
|
+
if (currentToolGroup.length > 0) {
|
|
475897
|
+
items.push({
|
|
475898
|
+
type: "tool_group",
|
|
475899
|
+
tools: [...currentToolGroup]
|
|
475900
|
+
});
|
|
475901
|
+
currentToolGroup = [];
|
|
475902
|
+
}
|
|
475903
|
+
const payload = pendingAtCommands.shift();
|
|
475904
|
+
const text2 = payload.userText || extractTextFromParts(record2.message?.parts);
|
|
475905
|
+
if (text2) {
|
|
475906
|
+
items.push({ type: "user", text: text2 });
|
|
475907
|
+
}
|
|
475908
|
+
const toolDisplays = buildAtCommandDisplays(payload);
|
|
475909
|
+
if (toolDisplays.length > 0) {
|
|
475910
|
+
items.push({
|
|
475911
|
+
type: "tool_group",
|
|
475912
|
+
tools: toolDisplays
|
|
475913
|
+
});
|
|
475914
|
+
}
|
|
475915
|
+
break;
|
|
475916
|
+
}
|
|
475917
|
+
if (currentToolGroup.length > 0) {
|
|
475918
|
+
items.push({
|
|
475919
|
+
type: "tool_group",
|
|
475920
|
+
tools: [...currentToolGroup]
|
|
475921
|
+
});
|
|
475922
|
+
currentToolGroup = [];
|
|
475923
|
+
}
|
|
475924
|
+
const text = extractTextFromParts(record2.message?.parts);
|
|
475925
|
+
if (text) {
|
|
475926
|
+
items.push({ type: "user", text });
|
|
475927
|
+
}
|
|
475928
|
+
break;
|
|
475929
|
+
}
|
|
475930
|
+
case "assistant": {
|
|
475931
|
+
const parts2 = record2.message?.parts;
|
|
475932
|
+
const thoughtText = !config2.getContentGenerator().useSummarizedThinking() ? extractThoughtTextFromParts(parts2) : "";
|
|
475933
|
+
const text = extractTextFromParts(parts2);
|
|
475934
|
+
const functionCalls = extractFunctionCalls(parts2);
|
|
475935
|
+
if (thoughtText) {
|
|
475936
|
+
if (currentToolGroup.length > 0) {
|
|
475937
|
+
items.push({
|
|
475938
|
+
type: "tool_group",
|
|
475939
|
+
tools: [...currentToolGroup]
|
|
475940
|
+
});
|
|
475941
|
+
currentToolGroup = [];
|
|
475942
|
+
}
|
|
475943
|
+
items.push({ type: "gemini_thought", text: thoughtText });
|
|
475944
|
+
}
|
|
475945
|
+
if (text) {
|
|
475946
|
+
if (currentToolGroup.length > 0) {
|
|
475947
|
+
items.push({
|
|
475948
|
+
type: "tool_group",
|
|
475949
|
+
tools: [...currentToolGroup]
|
|
475950
|
+
});
|
|
475951
|
+
currentToolGroup = [];
|
|
475952
|
+
}
|
|
475953
|
+
items.push({ type: "gemini", text });
|
|
475954
|
+
}
|
|
475955
|
+
for (const fc of functionCalls) {
|
|
475956
|
+
const tool = getTool(config2, fc.name);
|
|
475957
|
+
pendingToolCalls.set(fc.id, { name: fc.name, args: fc.args });
|
|
475958
|
+
currentToolGroup.push({
|
|
475959
|
+
callId: fc.id,
|
|
475960
|
+
name: tool?.displayName || fc.name,
|
|
475961
|
+
description: tool ? formatToolDescription(tool, fc.args) : "",
|
|
475962
|
+
resultDisplay: void 0,
|
|
475963
|
+
status: "Success" /* Success */,
|
|
475964
|
+
// Will be updated by tool_result
|
|
475965
|
+
confirmationDetails: void 0
|
|
475966
|
+
});
|
|
475967
|
+
}
|
|
475968
|
+
break;
|
|
475969
|
+
}
|
|
475970
|
+
case "tool_result": {
|
|
475971
|
+
if (record2.toolCallResult) {
|
|
475972
|
+
const callId = record2.toolCallResult.callId;
|
|
475973
|
+
const toolCall = currentToolGroup.find((t5) => t5.callId === callId);
|
|
475974
|
+
if (toolCall) {
|
|
475975
|
+
const rawDisplay = record2.toolCallResult.resultDisplay;
|
|
475976
|
+
toolCall.resultDisplay = rawDisplay;
|
|
475977
|
+
const rawStatus = record2.toolCallResult["status"];
|
|
475978
|
+
toolCall.status = rawStatus === "error" ? "Error" /* Error */ : "Success" /* Success */;
|
|
475979
|
+
}
|
|
475980
|
+
pendingToolCalls.delete(callId || "");
|
|
475981
|
+
}
|
|
475982
|
+
break;
|
|
475983
|
+
}
|
|
475984
|
+
default:
|
|
475985
|
+
break;
|
|
475986
|
+
}
|
|
475987
|
+
}
|
|
475988
|
+
if (pendingAtCommands.length > 0) {
|
|
475989
|
+
for (const payload of pendingAtCommands) {
|
|
475990
|
+
if (currentToolGroup.length > 0) {
|
|
475991
|
+
items.push({
|
|
475992
|
+
type: "tool_group",
|
|
475993
|
+
tools: [...currentToolGroup]
|
|
475994
|
+
});
|
|
475995
|
+
currentToolGroup = [];
|
|
475996
|
+
}
|
|
475997
|
+
const text = payload.userText;
|
|
475998
|
+
if (text) {
|
|
475999
|
+
items.push({ type: "user", text });
|
|
476000
|
+
}
|
|
476001
|
+
const toolDisplays = buildAtCommandDisplays(payload);
|
|
476002
|
+
if (toolDisplays.length > 0) {
|
|
476003
|
+
items.push({
|
|
476004
|
+
type: "tool_group",
|
|
476005
|
+
tools: toolDisplays
|
|
476006
|
+
});
|
|
476007
|
+
}
|
|
476008
|
+
}
|
|
476009
|
+
}
|
|
476010
|
+
if (currentToolGroup.length > 0) {
|
|
476011
|
+
items.push({
|
|
476012
|
+
type: "tool_group",
|
|
476013
|
+
tools: currentToolGroup
|
|
476014
|
+
});
|
|
476015
|
+
}
|
|
476016
|
+
return items;
|
|
476017
|
+
}
|
|
476018
|
+
__name(convertToHistoryItems, "convertToHistoryItems");
|
|
476019
|
+
function buildResumedHistoryItems(sessionData, config2, baseTimestamp = Date.now()) {
|
|
476020
|
+
const items = [];
|
|
476021
|
+
let idCounter = 1;
|
|
476022
|
+
const getNextId = /* @__PURE__ */ __name(() => baseTimestamp + idCounter++, "getNextId");
|
|
476023
|
+
const historyItems = convertToHistoryItems(sessionData.conversation, config2);
|
|
476024
|
+
for (const item of historyItems) {
|
|
476025
|
+
items.push({
|
|
476026
|
+
...item,
|
|
476027
|
+
id: getNextId()
|
|
476028
|
+
});
|
|
476029
|
+
}
|
|
476030
|
+
return items;
|
|
476031
|
+
}
|
|
476032
|
+
__name(buildResumedHistoryItems, "buildResumedHistoryItems");
|
|
476033
|
+
|
|
476034
|
+
// packages/cli/src/ui/hooks/useResumeCommand.ts
|
|
476032
476035
|
function useResumeCommand(options2) {
|
|
476033
476036
|
const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react141.useState)(false);
|
|
476034
476037
|
const openResumeDialog = (0, import_react141.useCallback)(() => {
|
|
@@ -477363,19 +477366,6 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
477363
477366
|
|
|
477364
477367
|
// packages/cli/src/ui/AppContainer.tsx
|
|
477365
477368
|
import * as fs130 from "node:fs";
|
|
477366
|
-
import { basename as basename30 } from "node:path";
|
|
477367
|
-
|
|
477368
|
-
// packages/cli/src/utils/windowTitle.ts
|
|
477369
|
-
init_esbuild_shims();
|
|
477370
|
-
function computeWindowTitle(folderName) {
|
|
477371
|
-
const title = process.env["CLI_TITLE"] || `Qwen - ${folderName}`;
|
|
477372
|
-
return title.replace(
|
|
477373
|
-
// eslint-disable-next-line no-control-regex
|
|
477374
|
-
/[\x00-\x1F\x7F]/g,
|
|
477375
|
-
""
|
|
477376
|
-
);
|
|
477377
|
-
}
|
|
477378
|
-
__name(computeWindowTitle, "computeWindowTitle");
|
|
477379
477369
|
|
|
477380
477370
|
// packages/cli/src/ui/hooks/useLogger.ts
|
|
477381
477371
|
init_esbuild_shims();
|
|
@@ -479873,27 +479863,191 @@ var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
|
479873
479863
|
}, []);
|
|
479874
479864
|
}, "useBracketedPaste");
|
|
479875
479865
|
|
|
479866
|
+
// packages/cli/src/ui/hooks/useKeyboardHandling.ts
|
|
479867
|
+
init_esbuild_shims();
|
|
479868
|
+
var import_react150 = __toESM(require_react(), 1);
|
|
479869
|
+
init_dist4();
|
|
479870
|
+
var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
|
|
479871
|
+
function useKeyboardHandling(params) {
|
|
479872
|
+
const {
|
|
479873
|
+
buffer,
|
|
479874
|
+
streamingState,
|
|
479875
|
+
btwItem,
|
|
479876
|
+
cancelBtw,
|
|
479877
|
+
setBtwItem,
|
|
479878
|
+
embeddedShellFocused,
|
|
479879
|
+
cancelOngoingRequest,
|
|
479880
|
+
isAuthenticating,
|
|
479881
|
+
openRewindDialog,
|
|
479882
|
+
activePtyId,
|
|
479883
|
+
setEmbeddedShellFocused,
|
|
479884
|
+
config: config2,
|
|
479885
|
+
ideContextState,
|
|
479886
|
+
handleExit,
|
|
479887
|
+
handleSlashCommand: handleSlashCommand2,
|
|
479888
|
+
debugKeystrokeLogging
|
|
479889
|
+
} = params;
|
|
479890
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react150.useState)(false);
|
|
479891
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react150.useState)(false);
|
|
479892
|
+
const ctrlCTimerRef = (0, import_react150.useRef)(null);
|
|
479893
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react150.useState)(false);
|
|
479894
|
+
const ctrlDTimerRef = (0, import_react150.useRef)(null);
|
|
479895
|
+
const [escapePressedOnce, setEscapePressedOnce] = (0, import_react150.useState)(false);
|
|
479896
|
+
const escapeTimerRef = (0, import_react150.useRef)(null);
|
|
479897
|
+
const dialogsVisibleRef = (0, import_react150.useRef)(false);
|
|
479898
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react150.useState)(true);
|
|
479899
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react150.useState)(false);
|
|
479900
|
+
const handleEscapePromptChange = (0, import_react150.useCallback)((showPrompt) => {
|
|
479901
|
+
setShowEscapePrompt(showPrompt);
|
|
479902
|
+
}, []);
|
|
479903
|
+
const globalKeypressHandlerRef = (0, import_react150.useRef)(() => {
|
|
479904
|
+
});
|
|
479905
|
+
globalKeypressHandlerRef.current = (key) => {
|
|
479906
|
+
if (debugKeystrokeLogging) {
|
|
479907
|
+
const debugLogger157 = config2.getDebugLogger();
|
|
479908
|
+
debugLogger157.debug("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
479909
|
+
}
|
|
479910
|
+
if (keyMatchers["quit" /* QUIT */](key)) {
|
|
479911
|
+
if (isAuthenticating) {
|
|
479912
|
+
return;
|
|
479913
|
+
}
|
|
479914
|
+
if (!ctrlCPressedOnce) {
|
|
479915
|
+
setCtrlCPressedOnce(true);
|
|
479916
|
+
ctrlCTimerRef.current = setTimeout(() => {
|
|
479917
|
+
setCtrlCPressedOnce(false);
|
|
479918
|
+
ctrlCTimerRef.current = null;
|
|
479919
|
+
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
479920
|
+
}
|
|
479921
|
+
handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
|
|
479922
|
+
return;
|
|
479923
|
+
} else if (keyMatchers["exit" /* EXIT */](key)) {
|
|
479924
|
+
if (buffer.text.length > 0) {
|
|
479925
|
+
return;
|
|
479926
|
+
}
|
|
479927
|
+
handleExit(ctrlDPressedOnce, setCtrlDPressedOnce, ctrlDTimerRef);
|
|
479928
|
+
return;
|
|
479929
|
+
} else if (keyMatchers["escape" /* ESCAPE */](key)) {
|
|
479930
|
+
if (btwItem && !dialogsVisibleRef.current) {
|
|
479931
|
+
cancelBtw();
|
|
479932
|
+
return;
|
|
479933
|
+
}
|
|
479934
|
+
if (embeddedShellFocused) {
|
|
479935
|
+
return;
|
|
479936
|
+
}
|
|
479937
|
+
if (buffer.text.length > 0) {
|
|
479938
|
+
if (escapePressedOnce) {
|
|
479939
|
+
buffer.setText("");
|
|
479940
|
+
return;
|
|
479941
|
+
}
|
|
479942
|
+
setEscapePressedOnce(true);
|
|
479943
|
+
escapeTimerRef.current = setTimeout(() => {
|
|
479944
|
+
setEscapePressedOnce(false);
|
|
479945
|
+
escapeTimerRef.current = null;
|
|
479946
|
+
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
479947
|
+
return;
|
|
479948
|
+
}
|
|
479949
|
+
if (streamingState === "responding" /* Responding */) {
|
|
479950
|
+
if (escapeTimerRef.current) {
|
|
479951
|
+
clearTimeout(escapeTimerRef.current);
|
|
479952
|
+
escapeTimerRef.current = null;
|
|
479953
|
+
}
|
|
479954
|
+
cancelOngoingRequest?.();
|
|
479955
|
+
setEscapePressedOnce(false);
|
|
479956
|
+
return;
|
|
479957
|
+
}
|
|
479958
|
+
if (escapePressedOnce) {
|
|
479959
|
+
if (escapeTimerRef.current) {
|
|
479960
|
+
clearTimeout(escapeTimerRef.current);
|
|
479961
|
+
escapeTimerRef.current = null;
|
|
479962
|
+
}
|
|
479963
|
+
setEscapePressedOnce(false);
|
|
479964
|
+
openRewindDialog();
|
|
479965
|
+
return;
|
|
479966
|
+
}
|
|
479967
|
+
if (!escapePressedOnce) {
|
|
479968
|
+
setEscapePressedOnce(true);
|
|
479969
|
+
escapeTimerRef.current = setTimeout(() => {
|
|
479970
|
+
setEscapePressedOnce(false);
|
|
479971
|
+
escapeTimerRef.current = null;
|
|
479972
|
+
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
479973
|
+
return;
|
|
479974
|
+
}
|
|
479975
|
+
if (escapeTimerRef.current) {
|
|
479976
|
+
clearTimeout(escapeTimerRef.current);
|
|
479977
|
+
escapeTimerRef.current = null;
|
|
479978
|
+
}
|
|
479979
|
+
setEscapePressedOnce(false);
|
|
479980
|
+
return;
|
|
479981
|
+
}
|
|
479982
|
+
if (btwItem && !btwItem.btw.isPending && !dialogsVisibleRef.current && buffer.text.length === 0) {
|
|
479983
|
+
if (key.name === "return" || key.sequence === " ") {
|
|
479984
|
+
setBtwItem(null);
|
|
479985
|
+
return;
|
|
479986
|
+
}
|
|
479987
|
+
}
|
|
479988
|
+
let enteringConstrainHeightMode = false;
|
|
479989
|
+
if (!constrainHeight) {
|
|
479990
|
+
enteringConstrainHeightMode = true;
|
|
479991
|
+
setConstrainHeight(true);
|
|
479992
|
+
}
|
|
479993
|
+
if (keyMatchers["toggleToolDescriptions" /* TOGGLE_TOOL_DESCRIPTIONS */](key)) {
|
|
479994
|
+
const newValue = !showToolDescriptions;
|
|
479995
|
+
setShowToolDescriptions(newValue);
|
|
479996
|
+
const mcpServers = config2.getMcpServers();
|
|
479997
|
+
if (Object.keys(mcpServers || {}).length > 0) {
|
|
479998
|
+
handleSlashCommand2(newValue ? "/mcp desc" : "/mcp nodesc");
|
|
479999
|
+
}
|
|
480000
|
+
} else if (keyMatchers["toggleIDEContextDetail" /* TOGGLE_IDE_CONTEXT_DETAIL */](key) && config2.getIdeMode() && ideContextState) {
|
|
480001
|
+
handleSlashCommand2("/ide status");
|
|
480002
|
+
} else if (keyMatchers["showMoreLines" /* SHOW_MORE_LINES */](key) && !enteringConstrainHeightMode) {
|
|
480003
|
+
setConstrainHeight(false);
|
|
480004
|
+
} else if (keyMatchers["toggleShellInputFocus" /* TOGGLE_SHELL_INPUT_FOCUS */](key)) {
|
|
480005
|
+
if (activePtyId || embeddedShellFocused) {
|
|
480006
|
+
setEmbeddedShellFocused((prev) => !prev);
|
|
480007
|
+
}
|
|
480008
|
+
}
|
|
480009
|
+
};
|
|
480010
|
+
const handleGlobalKeypress = (0, import_react150.useCallback)(
|
|
480011
|
+
(key) => globalKeypressHandlerRef.current(key),
|
|
480012
|
+
[]
|
|
480013
|
+
);
|
|
480014
|
+
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
480015
|
+
return {
|
|
480016
|
+
showToolDescriptions,
|
|
480017
|
+
setShowToolDescriptions,
|
|
480018
|
+
ctrlCPressedOnce,
|
|
480019
|
+
ctrlDPressedOnce,
|
|
480020
|
+
escapePressedOnce,
|
|
480021
|
+
showEscapePrompt,
|
|
480022
|
+
handleEscapePromptChange,
|
|
480023
|
+
constrainHeight,
|
|
480024
|
+
setConstrainHeight,
|
|
480025
|
+
dialogsVisibleRef
|
|
480026
|
+
};
|
|
480027
|
+
}
|
|
480028
|
+
__name(useKeyboardHandling, "useKeyboardHandling");
|
|
480029
|
+
|
|
479876
480030
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
479877
480031
|
init_esbuild_shims();
|
|
479878
480032
|
|
|
479879
480033
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
479880
480034
|
init_esbuild_shims();
|
|
479881
|
-
var
|
|
480035
|
+
var import_react151 = __toESM(require_react(), 1);
|
|
479882
480036
|
var WITTY_LOADING_PHRASES = ["I'm Feeling Lucky"];
|
|
479883
480037
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
479884
480038
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
479885
|
-
const loadingPhrases = (0,
|
|
480039
|
+
const loadingPhrases = (0, import_react151.useMemo)(() => {
|
|
479886
480040
|
if (customPhrases && customPhrases.length > 0) {
|
|
479887
480041
|
return customPhrases;
|
|
479888
480042
|
}
|
|
479889
480043
|
const translatedPhrases = ta("WITTY_LOADING_PHRASES");
|
|
479890
480044
|
return translatedPhrases.length > 0 ? translatedPhrases : WITTY_LOADING_PHRASES;
|
|
479891
480045
|
}, [customPhrases]);
|
|
479892
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
480046
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react151.useState)(
|
|
479893
480047
|
loadingPhrases[0]
|
|
479894
480048
|
);
|
|
479895
|
-
const phraseIntervalRef = (0,
|
|
479896
|
-
(0,
|
|
480049
|
+
const phraseIntervalRef = (0, import_react151.useRef)(null);
|
|
480050
|
+
(0, import_react151.useEffect)(() => {
|
|
479897
480051
|
if (isWaiting) {
|
|
479898
480052
|
setCurrentLoadingPhrase(t4("Waiting for user confirmation..."));
|
|
479899
480053
|
if (phraseIntervalRef.current) {
|
|
@@ -479930,9 +480084,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
479930
480084
|
}, "usePhraseCycler");
|
|
479931
480085
|
|
|
479932
480086
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
479933
|
-
var
|
|
480087
|
+
var import_react152 = __toESM(require_react(), 1);
|
|
479934
480088
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases, currentCandidatesTokens) => {
|
|
479935
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
480089
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react152.useState)(0);
|
|
479936
480090
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
479937
480091
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
479938
480092
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -479942,10 +480096,10 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
479942
480096
|
isWaiting,
|
|
479943
480097
|
customWittyPhrases
|
|
479944
480098
|
);
|
|
479945
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
479946
|
-
const [taskStartTokens, setTaskStartTokens] = (0,
|
|
479947
|
-
const prevStreamingStateRef = (0,
|
|
479948
|
-
(0,
|
|
480099
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react152.useState)(0);
|
|
480100
|
+
const [taskStartTokens, setTaskStartTokens] = (0, import_react152.useState)(0);
|
|
480101
|
+
const prevStreamingStateRef = (0, import_react152.useRef)(null);
|
|
480102
|
+
(0, import_react152.useEffect)(() => {
|
|
479949
480103
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
479950
480104
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
479951
480105
|
setRetainedElapsedTime(0);
|
|
@@ -479970,20 +480124,20 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
479970
480124
|
|
|
479971
480125
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
479972
480126
|
init_esbuild_shims();
|
|
479973
|
-
var
|
|
480127
|
+
var import_react153 = __toESM(require_react(), 1);
|
|
479974
480128
|
import * as process36 from "node:process";
|
|
479975
480129
|
var useFolderTrust = /* @__PURE__ */ __name((settings2, onTrustChange) => {
|
|
479976
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
479977
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
479978
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
480130
|
+
const [isTrusted, setIsTrusted] = (0, import_react153.useState)(void 0);
|
|
480131
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react153.useState)(false);
|
|
480132
|
+
const [isRestarting, setIsRestarting] = (0, import_react153.useState)(false);
|
|
479979
480133
|
const folderTrust = settings2.merged.security?.folderTrust?.enabled;
|
|
479980
|
-
(0,
|
|
480134
|
+
(0, import_react153.useEffect)(() => {
|
|
479981
480135
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings2.merged);
|
|
479982
480136
|
setIsTrusted(trusted);
|
|
479983
480137
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
479984
480138
|
onTrustChange(trusted);
|
|
479985
480139
|
}, [folderTrust, onTrustChange, settings2.merged]);
|
|
479986
|
-
const handleFolderTrustSelect = (0,
|
|
480140
|
+
const handleFolderTrustSelect = (0, import_react153.useCallback)(
|
|
479987
480141
|
(choice2) => {
|
|
479988
480142
|
const trustedFolders = loadTrustedFolders();
|
|
479989
480143
|
const cwd6 = process36.cwd();
|
|
@@ -480026,7 +480180,7 @@ var useFolderTrust = /* @__PURE__ */ __name((settings2, onTrustChange) => {
|
|
|
480026
480180
|
|
|
480027
480181
|
// packages/cli/src/ui/hooks/useCommandMigration.ts
|
|
480028
480182
|
init_esbuild_shims();
|
|
480029
|
-
var
|
|
480183
|
+
var import_react154 = __toESM(require_react(), 1);
|
|
480030
480184
|
init_dist4();
|
|
480031
480185
|
|
|
480032
480186
|
// packages/cli/src/services/command-migration-tool.ts
|
|
@@ -480100,9 +480254,9 @@ __name(migrateTomlCommands, "migrateTomlCommands");
|
|
|
480100
480254
|
|
|
480101
480255
|
// packages/cli/src/ui/hooks/useCommandMigration.ts
|
|
480102
480256
|
function useCommandMigration(settings2, storage) {
|
|
480103
|
-
const [showMigrationNudge, setShowMigrationNudge] = (0,
|
|
480104
|
-
const [tomlFiles, setTomlFiles] = (0,
|
|
480105
|
-
(0,
|
|
480257
|
+
const [showMigrationNudge, setShowMigrationNudge] = (0, import_react154.useState)(false);
|
|
480258
|
+
const [tomlFiles, setTomlFiles] = (0, import_react154.useState)([]);
|
|
480259
|
+
(0, import_react154.useEffect)(() => {
|
|
480106
480260
|
const checkTomlCommands = /* @__PURE__ */ __name(async () => {
|
|
480107
480261
|
const allFiles = [];
|
|
480108
480262
|
const workspaceCommandsDir = storage.getProjectCommandsDir();
|
|
@@ -480126,6 +480280,312 @@ function useCommandMigration(settings2, storage) {
|
|
|
480126
480280
|
}
|
|
480127
480281
|
__name(useCommandMigration, "useCommandMigration");
|
|
480128
480282
|
|
|
480283
|
+
// packages/cli/src/ui/hooks/useIdleMessageDrain.ts
|
|
480284
|
+
init_esbuild_shims();
|
|
480285
|
+
var import_react155 = __toESM(require_react(), 1);
|
|
480286
|
+
function useIdleMessageDrain(isConfigInitialized, streamingState, messageQueue, drain, submitQuery) {
|
|
480287
|
+
(0, import_react155.useEffect)(() => {
|
|
480288
|
+
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
480289
|
+
const combined = messageQueue.join("\n\n");
|
|
480290
|
+
drain();
|
|
480291
|
+
submitQuery(combined);
|
|
480292
|
+
}
|
|
480293
|
+
}, [isConfigInitialized, streamingState, messageQueue, drain, submitQuery]);
|
|
480294
|
+
}
|
|
480295
|
+
__name(useIdleMessageDrain, "useIdleMessageDrain");
|
|
480296
|
+
|
|
480297
|
+
// packages/cli/src/ui/hooks/useWindowTitle.ts
|
|
480298
|
+
init_esbuild_shims();
|
|
480299
|
+
var import_react156 = __toESM(require_react(), 1);
|
|
480300
|
+
import { basename as basename30 } from "node:path";
|
|
480301
|
+
|
|
480302
|
+
// packages/cli/src/utils/windowTitle.ts
|
|
480303
|
+
init_esbuild_shims();
|
|
480304
|
+
function computeWindowTitle(folderName) {
|
|
480305
|
+
const title = process.env["CLI_TITLE"] || `Qwen - ${folderName}`;
|
|
480306
|
+
return title.replace(
|
|
480307
|
+
// eslint-disable-next-line no-control-regex
|
|
480308
|
+
/[\x00-\x1F\x7F]/g,
|
|
480309
|
+
""
|
|
480310
|
+
);
|
|
480311
|
+
}
|
|
480312
|
+
__name(computeWindowTitle, "computeWindowTitle");
|
|
480313
|
+
|
|
480314
|
+
// packages/cli/src/ui/hooks/useWindowTitle.ts
|
|
480315
|
+
function useWindowTitle(streamingState, thought, settings2, stdout2, targetDir) {
|
|
480316
|
+
const originalTitleRef = (0, import_react156.useRef)(computeWindowTitle(basename30(targetDir)));
|
|
480317
|
+
const lastTitleRef = (0, import_react156.useRef)(null);
|
|
480318
|
+
(0, import_react156.useEffect)(() => {
|
|
480319
|
+
if (!settings2.merged.ui?.showStatusInTitle || settings2.merged.ui?.hideWindowTitle)
|
|
480320
|
+
return;
|
|
480321
|
+
let title;
|
|
480322
|
+
if (streamingState === "idle" /* Idle */) {
|
|
480323
|
+
title = originalTitleRef.current;
|
|
480324
|
+
} else {
|
|
480325
|
+
const statusText = thought?.subject?.replace(/[\r\n]+/g, " ").substring(0, 80);
|
|
480326
|
+
title = statusText || originalTitleRef.current;
|
|
480327
|
+
}
|
|
480328
|
+
const paddedTitle = title.padEnd(80, " ");
|
|
480329
|
+
if (lastTitleRef.current !== paddedTitle) {
|
|
480330
|
+
lastTitleRef.current = paddedTitle;
|
|
480331
|
+
stdout2.write(`\x1B[?2026h\x1B]2;${paddedTitle}\x07\x1B[?2026l`);
|
|
480332
|
+
}
|
|
480333
|
+
}, [
|
|
480334
|
+
streamingState,
|
|
480335
|
+
thought,
|
|
480336
|
+
settings2.merged.ui?.showStatusInTitle,
|
|
480337
|
+
settings2.merged.ui?.hideWindowTitle,
|
|
480338
|
+
stdout2
|
|
480339
|
+
]);
|
|
480340
|
+
}
|
|
480341
|
+
__name(useWindowTitle, "useWindowTitle");
|
|
480342
|
+
|
|
480343
|
+
// packages/cli/src/ui/hooks/useInitializationEffects.ts
|
|
480344
|
+
init_esbuild_shims();
|
|
480345
|
+
var import_react157 = __toESM(require_react(), 1);
|
|
480346
|
+
init_dist4();
|
|
480347
|
+
var debugLogger148 = createDebugLogger("APP_CONTAINER");
|
|
480348
|
+
function useInitializationEffects(config2, historyManager, setConfigInitialized) {
|
|
480349
|
+
(0, import_react157.useEffect)(() => {
|
|
480350
|
+
(async () => {
|
|
480351
|
+
await config2.initialize();
|
|
480352
|
+
setConfigInitialized(true);
|
|
480353
|
+
const projectRoot = config2.getProjectRoot?.() ?? config2.getTargetDir();
|
|
480354
|
+
if (projectRoot) {
|
|
480355
|
+
runBaselineCheck(projectRoot).then((result) => {
|
|
480356
|
+
const formatted = formatBaseline(result);
|
|
480357
|
+
historyManager.addItem(
|
|
480358
|
+
{ type: "info" /* INFO */, text: formatted },
|
|
480359
|
+
Date.now()
|
|
480360
|
+
);
|
|
480361
|
+
if (result.isDirty) {
|
|
480362
|
+
historyManager.addItem(
|
|
480363
|
+
{
|
|
480364
|
+
type: "warning" /* WARNING */,
|
|
480365
|
+
text: `Working tree has ${result.dirtyFiles.length} uncommitted change(s). The agent may build on top of unstaged work.`
|
|
480366
|
+
},
|
|
480367
|
+
Date.now()
|
|
480368
|
+
);
|
|
480369
|
+
}
|
|
480370
|
+
}).catch(() => {
|
|
480371
|
+
});
|
|
480372
|
+
}
|
|
480373
|
+
const resumedSessionData = config2.getResumedSessionData();
|
|
480374
|
+
if (resumedSessionData) {
|
|
480375
|
+
const historyItems = buildResumedHistoryItems(
|
|
480376
|
+
resumedSessionData,
|
|
480377
|
+
config2
|
|
480378
|
+
);
|
|
480379
|
+
historyManager.loadHistory(historyItems);
|
|
480380
|
+
}
|
|
480381
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
480382
|
+
const hookSystem = config2.getHookSystem();
|
|
480383
|
+
if (hookSystem) {
|
|
480384
|
+
hookSystem.fireSessionStartEvent(
|
|
480385
|
+
sessionStartSource,
|
|
480386
|
+
config2.getModel() ?? "",
|
|
480387
|
+
String(config2.getApprovalMode())
|
|
480388
|
+
).then(() => {
|
|
480389
|
+
debugLogger148.debug("SessionStart event completed successfully");
|
|
480390
|
+
}).catch((err2) => {
|
|
480391
|
+
debugLogger148.warn(`SessionStart hook failed: ${err2}`);
|
|
480392
|
+
});
|
|
480393
|
+
} else {
|
|
480394
|
+
debugLogger148.debug(
|
|
480395
|
+
"SessionStart: HookSystem not available, skipping event"
|
|
480396
|
+
);
|
|
480397
|
+
}
|
|
480398
|
+
})();
|
|
480399
|
+
registerCleanup(async () => {
|
|
480400
|
+
try {
|
|
480401
|
+
await config2.getHookSystem()?.fireSessionEndEvent(SessionEndReason.PromptInputExit);
|
|
480402
|
+
debugLogger148.debug("SessionEnd event completed successfully!!!");
|
|
480403
|
+
} catch (err2) {
|
|
480404
|
+
debugLogger148.error(`SessionEnd hook failed: ${err2}`);
|
|
480405
|
+
}
|
|
480406
|
+
});
|
|
480407
|
+
registerCleanup(async () => {
|
|
480408
|
+
const ideClient = await IdeClient.getInstance();
|
|
480409
|
+
await ideClient.disconnect();
|
|
480410
|
+
});
|
|
480411
|
+
}, [config2]);
|
|
480412
|
+
}
|
|
480413
|
+
__name(useInitializationEffects, "useInitializationEffects");
|
|
480414
|
+
|
|
480415
|
+
// packages/cli/src/ui/hooks/usePromptSuggestions.ts
|
|
480416
|
+
init_esbuild_shims();
|
|
480417
|
+
var import_react158 = __toESM(require_react(), 1);
|
|
480418
|
+
init_dist4();
|
|
480419
|
+
function usePromptSuggestions(params) {
|
|
480420
|
+
const {
|
|
480421
|
+
config: config2,
|
|
480422
|
+
settings: settings2,
|
|
480423
|
+
streamingState,
|
|
480424
|
+
geminiClient,
|
|
480425
|
+
historyManager,
|
|
480426
|
+
shellConfirmationRequest,
|
|
480427
|
+
confirmationRequest,
|
|
480428
|
+
loopDetectionConfirmationRequest,
|
|
480429
|
+
isPermissionsDialogOpen,
|
|
480430
|
+
settingInputRequests,
|
|
480431
|
+
pendingGeminiHistoryItems
|
|
480432
|
+
} = params;
|
|
480433
|
+
const [promptSuggestion, setPromptSuggestion] = (0, import_react158.useState)(null);
|
|
480434
|
+
const prevStreamingStateRef = (0, import_react158.useRef)("idle" /* Idle */);
|
|
480435
|
+
const speculationRef = (0, import_react158.useRef)(IDLE_SPECULATION);
|
|
480436
|
+
const suggestionAbortRef = (0, import_react158.useRef)(null);
|
|
480437
|
+
const dismissPromptSuggestion = (0, import_react158.useCallback)(() => {
|
|
480438
|
+
setPromptSuggestion(null);
|
|
480439
|
+
suggestionAbortRef.current?.abort();
|
|
480440
|
+
suggestionAbortRef.current = null;
|
|
480441
|
+
}, []);
|
|
480442
|
+
const followupSuggestionsEnabled = settings2.merged.ui?.enableFollowupSuggestions !== false;
|
|
480443
|
+
(0, import_react158.useEffect)(() => {
|
|
480444
|
+
if (!followupSuggestionsEnabled) {
|
|
480445
|
+
suggestionAbortRef.current?.abort();
|
|
480446
|
+
setPromptSuggestion(null);
|
|
480447
|
+
if (speculationRef.current.status === "running") {
|
|
480448
|
+
abortSpeculation(speculationRef.current).catch(() => {
|
|
480449
|
+
});
|
|
480450
|
+
speculationRef.current = IDLE_SPECULATION;
|
|
480451
|
+
}
|
|
480452
|
+
}
|
|
480453
|
+
if (prevStreamingStateRef.current === "idle" /* Idle */ && streamingState === "responding" /* Responding */) {
|
|
480454
|
+
suggestionAbortRef.current?.abort();
|
|
480455
|
+
setPromptSuggestion(null);
|
|
480456
|
+
if (speculationRef.current.status !== "idle") {
|
|
480457
|
+
abortSpeculation(speculationRef.current).catch(() => {
|
|
480458
|
+
});
|
|
480459
|
+
speculationRef.current = IDLE_SPECULATION;
|
|
480460
|
+
}
|
|
480461
|
+
}
|
|
480462
|
+
if (followupSuggestionsEnabled && config2.isInteractive() && !config2.getSdkMode() && prevStreamingStateRef.current === "responding" /* Responding */ && streamingState === "idle" /* Idle */ && // Check both committed history and pending items for errors
|
|
480463
|
+
// (API errors go to pendingGeminiHistoryItems, not historyManager.history)
|
|
480464
|
+
historyManager.history[historyManager.history.length - 1]?.type !== "error" && !pendingGeminiHistoryItems.some((item) => item.type === "error") && !shellConfirmationRequest && !confirmationRequest && !loopDetectionConfirmationRequest && !isPermissionsDialogOpen && settingInputRequests.length === 0 && config2.getApprovalMode() !== ApprovalMode.PLAN) {
|
|
480465
|
+
const ac = new AbortController();
|
|
480466
|
+
suggestionAbortRef.current = ac;
|
|
480467
|
+
const fullHistory = geminiClient.getChat().getHistory(true);
|
|
480468
|
+
const conversationHistory = fullHistory.length > 40 ? fullHistory.slice(-40) : fullHistory;
|
|
480469
|
+
generatePromptSuggestion(config2, conversationHistory, ac.signal, {
|
|
480470
|
+
enableCacheSharing: settings2.merged.ui?.enableCacheSharing === true,
|
|
480471
|
+
model: settings2.merged.fastModel || void 0
|
|
480472
|
+
}).then((result) => {
|
|
480473
|
+
if (ac.signal.aborted) return;
|
|
480474
|
+
if (result.suggestion) {
|
|
480475
|
+
setPromptSuggestion(result.suggestion);
|
|
480476
|
+
if (settings2.merged.ui?.enableSpeculation) {
|
|
480477
|
+
startSpeculation(config2, result.suggestion, ac.signal, {
|
|
480478
|
+
model: settings2.merged.fastModel || void 0
|
|
480479
|
+
}).then((state) => {
|
|
480480
|
+
speculationRef.current = state;
|
|
480481
|
+
}).catch(() => {
|
|
480482
|
+
});
|
|
480483
|
+
}
|
|
480484
|
+
} else if (result.filterReason) {
|
|
480485
|
+
logPromptSuggestion(
|
|
480486
|
+
config2,
|
|
480487
|
+
new PromptSuggestionEvent({
|
|
480488
|
+
outcome: "suppressed",
|
|
480489
|
+
reason: result.filterReason
|
|
480490
|
+
})
|
|
480491
|
+
);
|
|
480492
|
+
}
|
|
480493
|
+
}).catch(() => {
|
|
480494
|
+
});
|
|
480495
|
+
}
|
|
480496
|
+
if (prevStreamingStateRef.current !== streamingState) {
|
|
480497
|
+
prevStreamingStateRef.current = streamingState;
|
|
480498
|
+
}
|
|
480499
|
+
return () => {
|
|
480500
|
+
suggestionAbortRef.current?.abort();
|
|
480501
|
+
if (speculationRef.current.status !== "idle") {
|
|
480502
|
+
abortSpeculation(speculationRef.current).catch(() => {
|
|
480503
|
+
});
|
|
480504
|
+
speculationRef.current = IDLE_SPECULATION;
|
|
480505
|
+
}
|
|
480506
|
+
};
|
|
480507
|
+
}, [
|
|
480508
|
+
streamingState,
|
|
480509
|
+
followupSuggestionsEnabled,
|
|
480510
|
+
shellConfirmationRequest,
|
|
480511
|
+
confirmationRequest,
|
|
480512
|
+
loopDetectionConfirmationRequest,
|
|
480513
|
+
isPermissionsDialogOpen,
|
|
480514
|
+
settingInputRequests
|
|
480515
|
+
]);
|
|
480516
|
+
(0, import_react158.useEffect)(() => {
|
|
480517
|
+
if (!promptSuggestion && speculationRef.current.status !== "idle") {
|
|
480518
|
+
abortSpeculation(speculationRef.current).catch(() => {
|
|
480519
|
+
});
|
|
480520
|
+
speculationRef.current = IDLE_SPECULATION;
|
|
480521
|
+
}
|
|
480522
|
+
}, [promptSuggestion]);
|
|
480523
|
+
return {
|
|
480524
|
+
promptSuggestion,
|
|
480525
|
+
setPromptSuggestion,
|
|
480526
|
+
dismissPromptSuggestion,
|
|
480527
|
+
speculationRef
|
|
480528
|
+
};
|
|
480529
|
+
}
|
|
480530
|
+
__name(usePromptSuggestions, "usePromptSuggestions");
|
|
480531
|
+
|
|
480532
|
+
// packages/cli/src/ui/hooks/useExitHandling.ts
|
|
480533
|
+
init_esbuild_shims();
|
|
480534
|
+
var import_react159 = __toESM(require_react(), 1);
|
|
480535
|
+
function useExitHandling(params) {
|
|
480536
|
+
const {
|
|
480537
|
+
isAuthDialogOpen,
|
|
480538
|
+
handleSlashCommand: handleSlashCommand2,
|
|
480539
|
+
closeAnyOpenDialog,
|
|
480540
|
+
streamingState,
|
|
480541
|
+
cancelOngoingRequest,
|
|
480542
|
+
buffer
|
|
480543
|
+
} = params;
|
|
480544
|
+
const handleExit = (0, import_react159.useCallback)(
|
|
480545
|
+
(pressedOnce, setPressedOnce, timerRef) => {
|
|
480546
|
+
if (pressedOnce) {
|
|
480547
|
+
if (timerRef.current) {
|
|
480548
|
+
clearTimeout(timerRef.current);
|
|
480549
|
+
}
|
|
480550
|
+
handleSlashCommand2("/quit");
|
|
480551
|
+
return;
|
|
480552
|
+
}
|
|
480553
|
+
if (isAuthDialogOpen) {
|
|
480554
|
+
setPressedOnce(true);
|
|
480555
|
+
timerRef.current = setTimeout(() => {
|
|
480556
|
+
setPressedOnce(false);
|
|
480557
|
+
}, 500);
|
|
480558
|
+
return;
|
|
480559
|
+
}
|
|
480560
|
+
if (closeAnyOpenDialog()) {
|
|
480561
|
+
return;
|
|
480562
|
+
}
|
|
480563
|
+
if (streamingState === "responding" /* Responding */) {
|
|
480564
|
+
cancelOngoingRequest?.();
|
|
480565
|
+
return;
|
|
480566
|
+
}
|
|
480567
|
+
if (buffer.text.length > 0) {
|
|
480568
|
+
buffer.setText("");
|
|
480569
|
+
return;
|
|
480570
|
+
}
|
|
480571
|
+
setPressedOnce(true);
|
|
480572
|
+
timerRef.current = setTimeout(() => {
|
|
480573
|
+
setPressedOnce(false);
|
|
480574
|
+
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
480575
|
+
},
|
|
480576
|
+
[
|
|
480577
|
+
isAuthDialogOpen,
|
|
480578
|
+
handleSlashCommand2,
|
|
480579
|
+
closeAnyOpenDialog,
|
|
480580
|
+
streamingState,
|
|
480581
|
+
cancelOngoingRequest,
|
|
480582
|
+
buffer
|
|
480583
|
+
]
|
|
480584
|
+
);
|
|
480585
|
+
return { handleExit };
|
|
480586
|
+
}
|
|
480587
|
+
__name(useExitHandling, "useExitHandling");
|
|
480588
|
+
|
|
480129
480589
|
// packages/cli/src/ui/utils/updateCheck.ts
|
|
480130
480590
|
init_esbuild_shims();
|
|
480131
480591
|
|
|
@@ -482914,7 +483374,7 @@ __name(updateNotifier, "updateNotifier");
|
|
|
482914
483374
|
// packages/cli/src/ui/utils/updateCheck.ts
|
|
482915
483375
|
var import_semver3 = __toESM(require_semver3(), 1);
|
|
482916
483376
|
init_dist4();
|
|
482917
|
-
var
|
|
483377
|
+
var debugLogger149 = createDebugLogger("UPDATE_CHECK");
|
|
482918
483378
|
function getBestAvailableUpdate(nightly, stable) {
|
|
482919
483379
|
if (!nightly) return stable || null;
|
|
482920
483380
|
if (!stable) return nightly || null;
|
|
@@ -482974,7 +483434,7 @@ async function checkForUpdates() {
|
|
|
482974
483434
|
}
|
|
482975
483435
|
return null;
|
|
482976
483436
|
} catch (e4) {
|
|
482977
|
-
|
|
483437
|
+
debugLogger149.warn("Failed to check for updates: " + e4);
|
|
482978
483438
|
return null;
|
|
482979
483439
|
}
|
|
482980
483440
|
}
|
|
@@ -482989,7 +483449,7 @@ init_dist4();
|
|
|
482989
483449
|
import * as fs127 from "node:fs";
|
|
482990
483450
|
import * as path143 from "node:path";
|
|
482991
483451
|
import * as childProcess2 from "node:child_process";
|
|
482992
|
-
var
|
|
483452
|
+
var debugLogger150 = createDebugLogger("INSTALLATION_INFO");
|
|
482993
483453
|
function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
482994
483454
|
const cliPath = process.argv[1];
|
|
482995
483455
|
if (!cliPath) {
|
|
@@ -483035,7 +483495,7 @@ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
|
483035
483495
|
}
|
|
483036
483496
|
}
|
|
483037
483497
|
if (realPath.includes("/.pnpm/global")) {
|
|
483038
|
-
const updateCommand3 = "pnpm add -g @
|
|
483498
|
+
const updateCommand3 = "pnpm add -g @protolabsai/proto@latest";
|
|
483039
483499
|
return {
|
|
483040
483500
|
packageManager: "pnpm" /* PNPM */,
|
|
483041
483501
|
isGlobal: true,
|
|
@@ -483044,7 +483504,7 @@ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
|
483044
483504
|
};
|
|
483045
483505
|
}
|
|
483046
483506
|
if (realPath.includes("/.yarn/global")) {
|
|
483047
|
-
const updateCommand3 = "yarn global add @
|
|
483507
|
+
const updateCommand3 = "yarn global add @protolabsai/proto@latest";
|
|
483048
483508
|
return {
|
|
483049
483509
|
packageManager: "yarn" /* YARN */,
|
|
483050
483510
|
isGlobal: true,
|
|
@@ -483060,7 +483520,7 @@ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
|
483060
483520
|
};
|
|
483061
483521
|
}
|
|
483062
483522
|
if (realPath.includes("/.bun/bin")) {
|
|
483063
|
-
const updateCommand3 = "bun add -g @
|
|
483523
|
+
const updateCommand3 = "bun add -g @protolabsai/proto@latest";
|
|
483064
483524
|
return {
|
|
483065
483525
|
packageManager: "bun" /* BUN */,
|
|
483066
483526
|
isGlobal: true,
|
|
@@ -483083,7 +483543,7 @@ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
|
483083
483543
|
updateMessage: "Locally installed. Please update via your project's package.json."
|
|
483084
483544
|
};
|
|
483085
483545
|
}
|
|
483086
|
-
const updateCommand2 = "npm install -g @
|
|
483546
|
+
const updateCommand2 = "npm install -g @protolabsai/proto@latest";
|
|
483087
483547
|
return {
|
|
483088
483548
|
packageManager: "npm" /* NPM */,
|
|
483089
483549
|
isGlobal: true,
|
|
@@ -483091,7 +483551,7 @@ function getInstallationInfo(projectRoot, isAutoUpdateEnabled) {
|
|
|
483091
483551
|
updateMessage: isAutoUpdateEnabled ? "Installed with npm. Attempting to automatically update now..." : `Please run ${updateCommand2} to update`
|
|
483092
483552
|
};
|
|
483093
483553
|
} catch (error40) {
|
|
483094
|
-
|
|
483554
|
+
debugLogger150.error("Failed to detect installation info:", error40);
|
|
483095
483555
|
return { packageManager: "unknown" /* UNKNOWN */, isGlobal: false };
|
|
483096
483556
|
}
|
|
483097
483557
|
}
|
|
@@ -483179,12 +483639,12 @@ function setUpdateHandler(addItem, setUpdateInfo) {
|
|
|
483179
483639
|
setUpdateInfo(null);
|
|
483180
483640
|
}, 6e4);
|
|
483181
483641
|
}, "handleUpdateRecieved");
|
|
483182
|
-
const handleUpdateFailed = /* @__PURE__ */ __name(() => {
|
|
483642
|
+
const handleUpdateFailed = /* @__PURE__ */ __name((data) => {
|
|
483183
483643
|
setUpdateInfo(null);
|
|
483184
483644
|
addItem(
|
|
483185
483645
|
{
|
|
483186
483646
|
type: "error" /* ERROR */,
|
|
483187
|
-
text:
|
|
483647
|
+
text: data.message
|
|
483188
483648
|
},
|
|
483189
483649
|
Date.now()
|
|
483190
483650
|
);
|
|
@@ -483224,7 +483684,7 @@ __name(setUpdateHandler, "setUpdateHandler");
|
|
|
483224
483684
|
|
|
483225
483685
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
483226
483686
|
init_esbuild_shims();
|
|
483227
|
-
var
|
|
483687
|
+
var import_react160 = __toESM(require_react(), 1);
|
|
483228
483688
|
var MessageQueueStore = class {
|
|
483229
483689
|
static {
|
|
483230
483690
|
__name(this, "MessageQueueStore");
|
|
@@ -483278,15 +483738,15 @@ var MessageQueueStore = class {
|
|
|
483278
483738
|
}
|
|
483279
483739
|
};
|
|
483280
483740
|
function useMessageQueue() {
|
|
483281
|
-
const store = (0,
|
|
483282
|
-
const messageQueue = (0,
|
|
483283
|
-
const addMessage = (0,
|
|
483741
|
+
const store = (0, import_react160.useMemo)(() => new MessageQueueStore(), []);
|
|
483742
|
+
const messageQueue = (0, import_react160.useSyncExternalStore)(store.subscribe, store.getSnapshot);
|
|
483743
|
+
const addMessage = (0, import_react160.useCallback)(
|
|
483284
483744
|
(message) => store.addMessage(message),
|
|
483285
483745
|
[store]
|
|
483286
483746
|
);
|
|
483287
|
-
const clearQueue = (0,
|
|
483288
|
-
const popLast = (0,
|
|
483289
|
-
const drain = (0,
|
|
483747
|
+
const clearQueue = (0, import_react160.useCallback)(() => store.clearQueue(), [store]);
|
|
483748
|
+
const popLast = (0, import_react160.useCallback)(() => store.popLast(), [store]);
|
|
483749
|
+
const drain = (0, import_react160.useCallback)(() => store.drain(), [store]);
|
|
483290
483750
|
return { messageQueue, addMessage, clearQueue, popLast, drain };
|
|
483291
483751
|
}
|
|
483292
483752
|
__name(useMessageQueue, "useMessageQueue");
|
|
@@ -483294,7 +483754,7 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
483294
483754
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
483295
483755
|
init_esbuild_shims();
|
|
483296
483756
|
init_dist4();
|
|
483297
|
-
var
|
|
483757
|
+
var import_react161 = __toESM(require_react(), 1);
|
|
483298
483758
|
function useAutoAcceptIndicator({
|
|
483299
483759
|
config: config2,
|
|
483300
483760
|
addItem,
|
|
@@ -483303,8 +483763,8 @@ function useAutoAcceptIndicator({
|
|
|
483303
483763
|
disabled
|
|
483304
483764
|
}) {
|
|
483305
483765
|
const currentConfigValue = config2.getApprovalMode();
|
|
483306
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
483307
|
-
(0,
|
|
483766
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react161.useState)(currentConfigValue);
|
|
483767
|
+
(0, import_react161.useEffect)(() => {
|
|
483308
483768
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
483309
483769
|
}, [currentConfigValue]);
|
|
483310
483770
|
useKeypress(
|
|
@@ -483342,7 +483802,7 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
483342
483802
|
|
|
483343
483803
|
// packages/cli/src/ui/hooks/useExtensionUpdates.ts
|
|
483344
483804
|
init_esbuild_shims();
|
|
483345
|
-
var
|
|
483805
|
+
var import_react162 = __toESM(require_react(), 1);
|
|
483346
483806
|
function confirmationRequestsReducer(state, action) {
|
|
483347
483807
|
switch (action.type) {
|
|
483348
483808
|
case "add":
|
|
@@ -483359,8 +483819,8 @@ var useConfirmUpdateRequests = /* @__PURE__ */ __name(() => {
|
|
|
483359
483819
|
const [
|
|
483360
483820
|
confirmUpdateExtensionRequests,
|
|
483361
483821
|
dispatchConfirmUpdateExtensionRequests
|
|
483362
|
-
] = (0,
|
|
483363
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
483822
|
+
] = (0, import_react162.useReducer)(confirmationRequestsReducer, []);
|
|
483823
|
+
const addConfirmUpdateExtensionRequest = (0, import_react162.useCallback)(
|
|
483364
483824
|
(original) => {
|
|
483365
483825
|
const wrappedRequest = {
|
|
483366
483826
|
prompt: original.prompt,
|
|
@@ -483398,11 +483858,11 @@ function settingInputRequestsReducer(state, action) {
|
|
|
483398
483858
|
}
|
|
483399
483859
|
__name(settingInputRequestsReducer, "settingInputRequestsReducer");
|
|
483400
483860
|
var useSettingInputRequests = /* @__PURE__ */ __name(() => {
|
|
483401
|
-
const [settingInputRequests, dispatchSettingInputRequests] = (0,
|
|
483861
|
+
const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react162.useReducer)(
|
|
483402
483862
|
settingInputRequestsReducer,
|
|
483403
483863
|
[]
|
|
483404
483864
|
);
|
|
483405
|
-
const addSettingInputRequest = (0,
|
|
483865
|
+
const addSettingInputRequest = (0, import_react162.useCallback)(
|
|
483406
483866
|
(original) => {
|
|
483407
483867
|
const wrappedRequest = {
|
|
483408
483868
|
settingName: original.settingName,
|
|
@@ -483449,11 +483909,11 @@ function pluginChoiceRequestsReducer(state, action) {
|
|
|
483449
483909
|
}
|
|
483450
483910
|
__name(pluginChoiceRequestsReducer, "pluginChoiceRequestsReducer");
|
|
483451
483911
|
var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
|
|
483452
|
-
const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0,
|
|
483912
|
+
const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react162.useReducer)(
|
|
483453
483913
|
pluginChoiceRequestsReducer,
|
|
483454
483914
|
[]
|
|
483455
483915
|
);
|
|
483456
|
-
const addPluginChoiceRequest = (0,
|
|
483916
|
+
const addPluginChoiceRequest = (0, import_react162.useCallback)(
|
|
483457
483917
|
(original) => {
|
|
483458
483918
|
const wrappedRequest = {
|
|
483459
483919
|
marketplaceName: original.marketplaceName,
|
|
@@ -483487,12 +483947,12 @@ var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
|
|
|
483487
483947
|
};
|
|
483488
483948
|
}, "usePluginChoiceRequests");
|
|
483489
483949
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd6) => {
|
|
483490
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
483950
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react162.useReducer)(
|
|
483491
483951
|
extensionUpdatesReducer,
|
|
483492
483952
|
initialExtensionUpdatesState
|
|
483493
483953
|
);
|
|
483494
483954
|
const extensions = extensionManager.getLoadedExtensions();
|
|
483495
|
-
(0,
|
|
483955
|
+
(0, import_react162.useEffect)(() => {
|
|
483496
483956
|
(async () => {
|
|
483497
483957
|
const extensionsToCheck = extensions.filter((extension) => {
|
|
483498
483958
|
const currentStatus = extensionsUpdateState.extensionStatuses.get(
|
|
@@ -483520,7 +483980,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
|
|
|
483520
483980
|
extensionsUpdateState.extensionStatuses,
|
|
483521
483981
|
dispatchExtensionStateUpdate
|
|
483522
483982
|
]);
|
|
483523
|
-
(0,
|
|
483983
|
+
(0, import_react162.useEffect)(() => {
|
|
483524
483984
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
483525
483985
|
return;
|
|
483526
483986
|
}
|
|
@@ -483579,7 +484039,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
|
|
|
483579
484039
|
);
|
|
483580
484040
|
}
|
|
483581
484041
|
}, [extensions, extensionManager, extensionsUpdateState, addItem, cwd6]);
|
|
483582
|
-
const extensionsUpdateStateComputed = (0,
|
|
484042
|
+
const extensionsUpdateStateComputed = (0, import_react162.useMemo)(() => {
|
|
483583
484043
|
const result = /* @__PURE__ */ new Map();
|
|
483584
484044
|
for (const [
|
|
483585
484045
|
key,
|
|
@@ -483598,15 +484058,15 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
|
|
|
483598
484058
|
|
|
483599
484059
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
483600
484060
|
init_esbuild_shims();
|
|
483601
|
-
var
|
|
484061
|
+
var import_react163 = __toESM(require_react(), 1);
|
|
483602
484062
|
init_dist4();
|
|
483603
484063
|
function useWelcomeBack(config2, submitQuery, buffer, settings2) {
|
|
483604
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
483605
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
483606
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
483607
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
483608
|
-
const [inputFillText, setInputFillText] = (0,
|
|
483609
|
-
const checkWelcomeBack = (0,
|
|
484064
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react163.useState)(null);
|
|
484065
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react163.useState)(false);
|
|
484066
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react163.useState)(null);
|
|
484067
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react163.useState)(false);
|
|
484068
|
+
const [inputFillText, setInputFillText] = (0, import_react163.useState)(null);
|
|
484069
|
+
const checkWelcomeBack = (0, import_react163.useCallback)(async () => {
|
|
483610
484070
|
if (settings2.ui?.enableWelcomeBack === false) {
|
|
483611
484071
|
return;
|
|
483612
484072
|
}
|
|
@@ -483620,7 +484080,7 @@ function useWelcomeBack(config2, submitQuery, buffer, settings2) {
|
|
|
483620
484080
|
config2.getDebugLogger().debug("Welcome back check failed:", error40);
|
|
483621
484081
|
}
|
|
483622
484082
|
}, [config2, settings2.ui?.enableWelcomeBack]);
|
|
483623
|
-
const handleWelcomeBackSelection = (0,
|
|
484083
|
+
const handleWelcomeBackSelection = (0, import_react163.useCallback)(
|
|
483624
484084
|
(choice2) => {
|
|
483625
484085
|
setWelcomeBackChoice(choice2);
|
|
483626
484086
|
setShowWelcomeBackDialog(false);
|
|
@@ -483632,21 +484092,21 @@ function useWelcomeBack(config2, submitQuery, buffer, settings2) {
|
|
|
483632
484092
|
},
|
|
483633
484093
|
[welcomeBackInfo]
|
|
483634
484094
|
);
|
|
483635
|
-
const handleWelcomeBackClose = (0,
|
|
484095
|
+
const handleWelcomeBackClose = (0, import_react163.useCallback)(() => {
|
|
483636
484096
|
setWelcomeBackChoice("restart");
|
|
483637
484097
|
setShowWelcomeBackDialog(false);
|
|
483638
484098
|
}, []);
|
|
483639
|
-
const clearInputFill = (0,
|
|
484099
|
+
const clearInputFill = (0, import_react163.useCallback)(() => {
|
|
483640
484100
|
setShouldFillInput(false);
|
|
483641
484101
|
setInputFillText(null);
|
|
483642
484102
|
}, []);
|
|
483643
|
-
(0,
|
|
484103
|
+
(0, import_react163.useEffect)(() => {
|
|
483644
484104
|
if (shouldFillInput && inputFillText) {
|
|
483645
484105
|
buffer.setText(inputFillText);
|
|
483646
484106
|
clearInputFill();
|
|
483647
484107
|
}
|
|
483648
484108
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
483649
|
-
(0,
|
|
484109
|
+
(0, import_react163.useEffect)(() => {
|
|
483650
484110
|
checkWelcomeBack();
|
|
483651
484111
|
}, [checkWelcomeBack]);
|
|
483652
484112
|
return {
|
|
@@ -483667,9 +484127,9 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
483667
484127
|
|
|
483668
484128
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
483669
484129
|
init_esbuild_shims();
|
|
483670
|
-
var
|
|
484130
|
+
var import_react164 = __toESM(require_react(), 1);
|
|
483671
484131
|
function useDialogClose(options2) {
|
|
483672
|
-
const closeAnyOpenDialog = (0,
|
|
484132
|
+
const closeAnyOpenDialog = (0, import_react164.useCallback)(() => {
|
|
483673
484133
|
if (options2.isThemeDialogOpen) {
|
|
483674
484134
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
483675
484135
|
return true;
|
|
@@ -483705,14 +484165,14 @@ __name(useDialogClose, "useDialogClose");
|
|
|
483705
484165
|
|
|
483706
484166
|
// packages/cli/src/ui/hooks/useInitializationAuthError.ts
|
|
483707
484167
|
init_esbuild_shims();
|
|
483708
|
-
var
|
|
484168
|
+
var import_react165 = __toESM(require_react(), 1);
|
|
483709
484169
|
var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
|
|
483710
|
-
const hasHandled = (0,
|
|
483711
|
-
const authErrorRef = (0,
|
|
483712
|
-
const onAuthErrorRef = (0,
|
|
484170
|
+
const hasHandled = (0, import_react165.useRef)(false);
|
|
484171
|
+
const authErrorRef = (0, import_react165.useRef)(authError);
|
|
484172
|
+
const onAuthErrorRef = (0, import_react165.useRef)(onAuthError);
|
|
483713
484173
|
authErrorRef.current = authError;
|
|
483714
484174
|
onAuthErrorRef.current = onAuthError;
|
|
483715
|
-
(0,
|
|
484175
|
+
(0, import_react165.useEffect)(() => {
|
|
483716
484176
|
if (hasHandled.current) {
|
|
483717
484177
|
return;
|
|
483718
484178
|
}
|
|
@@ -483725,13 +484185,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
|
|
|
483725
484185
|
|
|
483726
484186
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
483727
484187
|
init_esbuild_shims();
|
|
483728
|
-
var
|
|
484188
|
+
var import_react166 = __toESM(require_react(), 1);
|
|
483729
484189
|
function useSubagentCreateDialog() {
|
|
483730
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
483731
|
-
const openSubagentCreateDialog = (0,
|
|
484190
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react166.useState)(false);
|
|
484191
|
+
const openSubagentCreateDialog = (0, import_react166.useCallback)(() => {
|
|
483732
484192
|
setIsSubagentCreateDialogOpen(true);
|
|
483733
484193
|
}, []);
|
|
483734
|
-
const closeSubagentCreateDialog = (0,
|
|
484194
|
+
const closeSubagentCreateDialog = (0, import_react166.useCallback)(() => {
|
|
483735
484195
|
setIsSubagentCreateDialogOpen(false);
|
|
483736
484196
|
}, []);
|
|
483737
484197
|
return {
|
|
@@ -483744,13 +484204,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
483744
484204
|
|
|
483745
484205
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
483746
484206
|
init_esbuild_shims();
|
|
483747
|
-
var
|
|
484207
|
+
var import_react167 = __toESM(require_react(), 1);
|
|
483748
484208
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
483749
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
483750
|
-
const openAgentsManagerDialog = (0,
|
|
484209
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react167.useState)(false);
|
|
484210
|
+
const openAgentsManagerDialog = (0, import_react167.useCallback)(() => {
|
|
483751
484211
|
setIsAgentsManagerDialogOpen(true);
|
|
483752
484212
|
}, []);
|
|
483753
|
-
const closeAgentsManagerDialog = (0,
|
|
484213
|
+
const closeAgentsManagerDialog = (0, import_react167.useCallback)(() => {
|
|
483754
484214
|
setIsAgentsManagerDialogOpen(false);
|
|
483755
484215
|
}, []);
|
|
483756
484216
|
return {
|
|
@@ -483762,13 +484222,13 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
483762
484222
|
|
|
483763
484223
|
// packages/cli/src/ui/hooks/useExtensionsManagerDialog.ts
|
|
483764
484224
|
init_esbuild_shims();
|
|
483765
|
-
var
|
|
484225
|
+
var import_react168 = __toESM(require_react(), 1);
|
|
483766
484226
|
var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
483767
|
-
const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0,
|
|
483768
|
-
const openExtensionsManagerDialog = (0,
|
|
484227
|
+
const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react168.useState)(false);
|
|
484228
|
+
const openExtensionsManagerDialog = (0, import_react168.useCallback)(() => {
|
|
483769
484229
|
setIsExtensionsManagerDialogOpen(true);
|
|
483770
484230
|
}, []);
|
|
483771
|
-
const closeExtensionsManagerDialog = (0,
|
|
484231
|
+
const closeExtensionsManagerDialog = (0, import_react168.useCallback)(() => {
|
|
483772
484232
|
setIsExtensionsManagerDialogOpen(false);
|
|
483773
484233
|
}, []);
|
|
483774
484234
|
return {
|
|
@@ -483780,13 +484240,13 @@ var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
483780
484240
|
|
|
483781
484241
|
// packages/cli/src/ui/hooks/useMcpDialog.ts
|
|
483782
484242
|
init_esbuild_shims();
|
|
483783
|
-
var
|
|
484243
|
+
var import_react169 = __toESM(require_react(), 1);
|
|
483784
484244
|
var useMcpDialog = /* @__PURE__ */ __name(() => {
|
|
483785
|
-
const [isMcpDialogOpen, setIsMcpDialogOpen] = (0,
|
|
483786
|
-
const openMcpDialog = (0,
|
|
484245
|
+
const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react169.useState)(false);
|
|
484246
|
+
const openMcpDialog = (0, import_react169.useCallback)(() => {
|
|
483787
484247
|
setIsMcpDialogOpen(true);
|
|
483788
484248
|
}, []);
|
|
483789
|
-
const closeMcpDialog = (0,
|
|
484249
|
+
const closeMcpDialog = (0, import_react169.useCallback)(() => {
|
|
483790
484250
|
setIsMcpDialogOpen(false);
|
|
483791
484251
|
}, []);
|
|
483792
484252
|
return {
|
|
@@ -483798,13 +484258,13 @@ var useMcpDialog = /* @__PURE__ */ __name(() => {
|
|
|
483798
484258
|
|
|
483799
484259
|
// packages/cli/src/ui/hooks/useHooksDialog.ts
|
|
483800
484260
|
init_esbuild_shims();
|
|
483801
|
-
var
|
|
484261
|
+
var import_react170 = __toESM(require_react(), 1);
|
|
483802
484262
|
var useHooksDialog = /* @__PURE__ */ __name(() => {
|
|
483803
|
-
const [isHooksDialogOpen, setIsHooksDialogOpen] = (0,
|
|
483804
|
-
const openHooksDialog = (0,
|
|
484263
|
+
const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react170.useState)(false);
|
|
484264
|
+
const openHooksDialog = (0, import_react170.useCallback)(() => {
|
|
483805
484265
|
setIsHooksDialogOpen(true);
|
|
483806
484266
|
}, []);
|
|
483807
|
-
const closeHooksDialog = (0,
|
|
484267
|
+
const closeHooksDialog = (0, import_react170.useCallback)(() => {
|
|
483808
484268
|
setIsHooksDialogOpen(false);
|
|
483809
484269
|
}, []);
|
|
483810
484270
|
return {
|
|
@@ -483816,14 +484276,14 @@ var useHooksDialog = /* @__PURE__ */ __name(() => {
|
|
|
483816
484276
|
|
|
483817
484277
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
483818
484278
|
init_esbuild_shims();
|
|
483819
|
-
var
|
|
484279
|
+
var import_react171 = __toESM(require_react(), 1);
|
|
483820
484280
|
|
|
483821
484281
|
// packages/cli/src/utils/attentionNotification.ts
|
|
483822
484282
|
init_esbuild_shims();
|
|
483823
484283
|
init_dist4();
|
|
483824
484284
|
import process46 from "node:process";
|
|
483825
484285
|
var TERMINAL_BELL = "\x07";
|
|
483826
|
-
var
|
|
484286
|
+
var debugLogger151 = createDebugLogger("ATTENTION_NOTIFICATION");
|
|
483827
484287
|
function notifyTerminalAttention(_reason, options2 = {}) {
|
|
483828
484288
|
if (options2.enabled === false) {
|
|
483829
484289
|
return false;
|
|
@@ -483836,7 +484296,7 @@ function notifyTerminalAttention(_reason, options2 = {}) {
|
|
|
483836
484296
|
stream2.write(TERMINAL_BELL);
|
|
483837
484297
|
return true;
|
|
483838
484298
|
} catch (error40) {
|
|
483839
|
-
|
|
484299
|
+
debugLogger151.warn("Failed to send terminal bell:", error40);
|
|
483840
484300
|
return false;
|
|
483841
484301
|
}
|
|
483842
484302
|
}
|
|
@@ -483853,10 +484313,10 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
483853
484313
|
config: config2
|
|
483854
484314
|
}) => {
|
|
483855
484315
|
const terminalBellEnabled = settings2?.merged?.general?.terminalBell ?? true;
|
|
483856
|
-
const awaitingNotificationSentRef = (0,
|
|
483857
|
-
const respondingElapsedRef = (0,
|
|
483858
|
-
const idleNotificationSentRef = (0,
|
|
483859
|
-
(0,
|
|
484316
|
+
const awaitingNotificationSentRef = (0, import_react171.useRef)(false);
|
|
484317
|
+
const respondingElapsedRef = (0, import_react171.useRef)(0);
|
|
484318
|
+
const idleNotificationSentRef = (0, import_react171.useRef)(false);
|
|
484319
|
+
(0, import_react171.useEffect)(() => {
|
|
483860
484320
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
483861
484321
|
notifyTerminalAttention("tool_approval" /* ToolApproval */, {
|
|
483862
484322
|
enabled: terminalBellEnabled
|
|
@@ -483867,7 +484327,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
483867
484327
|
awaitingNotificationSentRef.current = false;
|
|
483868
484328
|
}
|
|
483869
484329
|
}, [isFocused, streamingState, terminalBellEnabled]);
|
|
483870
|
-
(0,
|
|
484330
|
+
(0, import_react171.useEffect)(() => {
|
|
483871
484331
|
if (streamingState === "responding" /* Responding */) {
|
|
483872
484332
|
respondingElapsedRef.current = elapsedTime;
|
|
483873
484333
|
idleNotificationSentRef.current = false;
|
|
@@ -483903,7 +484363,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
483903
484363
|
|
|
483904
484364
|
// packages/cli/src/ui/hooks/useVoice.ts
|
|
483905
484365
|
init_esbuild_shims();
|
|
483906
|
-
var
|
|
484366
|
+
var import_react172 = __toESM(require_react(), 1);
|
|
483907
484367
|
import os46 from "node:os";
|
|
483908
484368
|
import path144 from "node:path";
|
|
483909
484369
|
import fs129 from "node:fs";
|
|
@@ -483938,12 +484398,12 @@ __name(transcribe, "transcribe");
|
|
|
483938
484398
|
|
|
483939
484399
|
// packages/cli/src/ui/hooks/useVoice.ts
|
|
483940
484400
|
function useVoice(sttEndpoint, sttApiKey) {
|
|
483941
|
-
const [voiceState, setVoiceState] = (0,
|
|
483942
|
-
const [error40, setError] = (0,
|
|
483943
|
-
const procRef = (0,
|
|
483944
|
-
const audioPathRef = (0,
|
|
483945
|
-
const backend = (0,
|
|
483946
|
-
const start2 = (0,
|
|
484401
|
+
const [voiceState, setVoiceState] = (0, import_react172.useState)("idle");
|
|
484402
|
+
const [error40, setError] = (0, import_react172.useState)(null);
|
|
484403
|
+
const procRef = (0, import_react172.useRef)(null);
|
|
484404
|
+
const audioPathRef = (0, import_react172.useRef)(null);
|
|
484405
|
+
const backend = (0, import_react172.useMemo)(() => detectBackend2(), []);
|
|
484406
|
+
const start2 = (0, import_react172.useCallback)(async () => {
|
|
483947
484407
|
if (voiceState !== "idle") return;
|
|
483948
484408
|
const tmpPath = path144.join(os46.tmpdir(), `proto-voice-${Date.now()}.wav`);
|
|
483949
484409
|
audioPathRef.current = tmpPath;
|
|
@@ -483956,7 +484416,7 @@ function useVoice(sttEndpoint, sttApiKey) {
|
|
|
483956
484416
|
setError(e4 instanceof Error ? e4.message : String(e4));
|
|
483957
484417
|
}
|
|
483958
484418
|
}, [voiceState, backend]);
|
|
483959
|
-
const stop3 = (0,
|
|
484419
|
+
const stop3 = (0, import_react172.useCallback)(async () => {
|
|
483960
484420
|
if (voiceState !== "recording" || !procRef.current || !audioPathRef.current) {
|
|
483961
484421
|
return "";
|
|
483962
484422
|
}
|
|
@@ -483989,7 +484449,7 @@ function useVoice(sttEndpoint, sttApiKey) {
|
|
|
483989
484449
|
return "";
|
|
483990
484450
|
}
|
|
483991
484451
|
}, [voiceState, sttEndpoint, sttApiKey]);
|
|
483992
|
-
const reset = (0,
|
|
484452
|
+
const reset = (0, import_react172.useCallback)(() => {
|
|
483993
484453
|
setVoiceState("idle");
|
|
483994
484454
|
setError(null);
|
|
483995
484455
|
}, []);
|
|
@@ -484006,8 +484466,7 @@ __name(useVoice, "useVoice");
|
|
|
484006
484466
|
|
|
484007
484467
|
// packages/cli/src/ui/AppContainer.tsx
|
|
484008
484468
|
var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1);
|
|
484009
|
-
var
|
|
484010
|
-
var debugLogger151 = createDebugLogger("APP_CONTAINER");
|
|
484469
|
+
var debugLogger152 = createDebugLogger("APP_CONTAINER");
|
|
484011
484470
|
function isToolExecuting(pendingHistoryItems) {
|
|
484012
484471
|
return pendingHistoryItems.some((item) => {
|
|
484013
484472
|
if (item && item.type === "tool_group") {
|
|
@@ -484025,21 +484484,21 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484025
484484
|
const { settings: settings2, config: config2, initializationResult } = props;
|
|
484026
484485
|
const historyManager = useHistory();
|
|
484027
484486
|
useMemoryMonitor(historyManager);
|
|
484028
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
484029
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
484030
|
-
const [themeError, setThemeError] = (0,
|
|
484487
|
+
const [debugMessage, setDebugMessage] = (0, import_react173.useState)("");
|
|
484488
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react173.useState)(null);
|
|
484489
|
+
const [themeError, setThemeError] = (0, import_react173.useState)(
|
|
484031
484490
|
initializationResult.themeError
|
|
484032
484491
|
);
|
|
484033
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
484034
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
484035
|
-
const [geminiMdFileCount, setGeminiMdFileCount] = (0,
|
|
484492
|
+
const [isProcessing, setIsProcessing] = (0, import_react173.useState)(false);
|
|
484493
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react173.useState)(false);
|
|
484494
|
+
const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react173.useState)(
|
|
484036
484495
|
initializationResult.geminiMdFileCount
|
|
484037
484496
|
);
|
|
484038
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
484039
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
484040
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
484041
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
484042
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
484497
|
+
const [shellModeActive, setShellModeActive] = (0, import_react173.useState)(false);
|
|
484498
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react173.useState)(false);
|
|
484499
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react173.useState)(0);
|
|
484500
|
+
const [updateInfo, setUpdateInfo] = (0, import_react173.useState)(null);
|
|
484501
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react173.useState)(
|
|
484043
484502
|
config2.isTrustedFolder()
|
|
484044
484503
|
);
|
|
484045
484504
|
const extensionManager = config2.getExtensionManager();
|
|
@@ -484094,102 +484553,36 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484094
484553
|
config2.getWorkingDir()
|
|
484095
484554
|
);
|
|
484096
484555
|
const { codingPlanUpdateRequest, dismissCodingPlanUpdate } = useCodingPlanUpdates(settings2, config2, historyManager.addItem);
|
|
484097
|
-
const [isTrustDialogOpen, setTrustDialogOpen] = (0,
|
|
484098
|
-
const openTrustDialog = (0,
|
|
484099
|
-
const closeTrustDialog = (0,
|
|
484100
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
484101
|
-
const openPermissionsDialog = (0,
|
|
484556
|
+
const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react173.useState)(false);
|
|
484557
|
+
const openTrustDialog = (0, import_react173.useCallback)(() => setTrustDialogOpen(true), []);
|
|
484558
|
+
const closeTrustDialog = (0, import_react173.useCallback)(() => setTrustDialogOpen(false), []);
|
|
484559
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react173.useState)(false);
|
|
484560
|
+
const openPermissionsDialog = (0, import_react173.useCallback)(
|
|
484102
484561
|
() => setPermissionsDialogOpen(true),
|
|
484103
484562
|
[]
|
|
484104
484563
|
);
|
|
484105
|
-
const closePermissionsDialog = (0,
|
|
484564
|
+
const closePermissionsDialog = (0, import_react173.useCallback)(
|
|
484106
484565
|
() => setPermissionsDialogOpen(false),
|
|
484107
484566
|
[]
|
|
484108
484567
|
);
|
|
484109
|
-
const getCurrentModel = (0,
|
|
484110
|
-
const [currentModel, setCurrentModel] = (0,
|
|
484111
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
484112
|
-
const [userMessages, setUserMessages] = (0,
|
|
484568
|
+
const getCurrentModel = (0, import_react173.useCallback)(() => config2.getModel(), [config2]);
|
|
484569
|
+
const [currentModel, setCurrentModel] = (0, import_react173.useState)(getCurrentModel());
|
|
484570
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react173.useState)(false);
|
|
484571
|
+
const [userMessages, setUserMessages] = (0, import_react173.useState)([]);
|
|
484113
484572
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
484114
484573
|
const { stdin: stdin2, setRawMode } = use_stdin_default();
|
|
484115
484574
|
const { stdout: stdout2 } = use_stdout_default();
|
|
484116
484575
|
const { stats: sessionStats, startNewSession } = useSessionStats();
|
|
484117
484576
|
const logger9 = useLogger(config2.storage, sessionStats.sessionId);
|
|
484118
484577
|
const branchName = useGitBranchName(config2.getTargetDir());
|
|
484119
|
-
const mainControlsRef = (0,
|
|
484120
|
-
const originalTitleRef = (0, import_react167.useRef)(
|
|
484121
|
-
computeWindowTitle(basename30(config2.getTargetDir()))
|
|
484122
|
-
);
|
|
484123
|
-
const lastTitleRef = (0, import_react167.useRef)(null);
|
|
484578
|
+
const mainControlsRef = (0, import_react173.useRef)(null);
|
|
484124
484579
|
const staticExtraHeight = 3;
|
|
484125
|
-
(
|
|
484126
|
-
|
|
484127
|
-
await config2.initialize();
|
|
484128
|
-
setConfigInitialized(true);
|
|
484129
|
-
const projectRoot = config2.getProjectRoot?.() ?? config2.getTargetDir();
|
|
484130
|
-
if (projectRoot) {
|
|
484131
|
-
runBaselineCheck(projectRoot).then((result) => {
|
|
484132
|
-
const formatted = formatBaseline(result);
|
|
484133
|
-
historyManager.addItem(
|
|
484134
|
-
{ type: "info" /* INFO */, text: formatted },
|
|
484135
|
-
Date.now()
|
|
484136
|
-
);
|
|
484137
|
-
if (result.isDirty) {
|
|
484138
|
-
historyManager.addItem(
|
|
484139
|
-
{
|
|
484140
|
-
type: "warning" /* WARNING */,
|
|
484141
|
-
text: `Working tree has ${result.dirtyFiles.length} uncommitted change(s). The agent may build on top of unstaged work.`
|
|
484142
|
-
},
|
|
484143
|
-
Date.now()
|
|
484144
|
-
);
|
|
484145
|
-
}
|
|
484146
|
-
}).catch(() => {
|
|
484147
|
-
});
|
|
484148
|
-
}
|
|
484149
|
-
const resumedSessionData = config2.getResumedSessionData();
|
|
484150
|
-
if (resumedSessionData) {
|
|
484151
|
-
const historyItems = buildResumedHistoryItems(
|
|
484152
|
-
resumedSessionData,
|
|
484153
|
-
config2
|
|
484154
|
-
);
|
|
484155
|
-
historyManager.loadHistory(historyItems);
|
|
484156
|
-
}
|
|
484157
|
-
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
484158
|
-
const hookSystem = config2.getHookSystem();
|
|
484159
|
-
if (hookSystem) {
|
|
484160
|
-
hookSystem.fireSessionStartEvent(
|
|
484161
|
-
sessionStartSource,
|
|
484162
|
-
config2.getModel() ?? "",
|
|
484163
|
-
String(config2.getApprovalMode())
|
|
484164
|
-
).then(() => {
|
|
484165
|
-
debugLogger151.debug("SessionStart event completed successfully");
|
|
484166
|
-
}).catch((err2) => {
|
|
484167
|
-
debugLogger151.warn(`SessionStart hook failed: ${err2}`);
|
|
484168
|
-
});
|
|
484169
|
-
} else {
|
|
484170
|
-
debugLogger151.debug(
|
|
484171
|
-
"SessionStart: HookSystem not available, skipping event"
|
|
484172
|
-
);
|
|
484173
|
-
}
|
|
484174
|
-
})();
|
|
484175
|
-
registerCleanup(async () => {
|
|
484176
|
-
try {
|
|
484177
|
-
await config2.getHookSystem()?.fireSessionEndEvent(SessionEndReason.PromptInputExit);
|
|
484178
|
-
debugLogger151.debug("SessionEnd event completed successfully!!!");
|
|
484179
|
-
} catch (err2) {
|
|
484180
|
-
debugLogger151.error(`SessionEnd hook failed: ${err2}`);
|
|
484181
|
-
}
|
|
484182
|
-
});
|
|
484183
|
-
registerCleanup(async () => {
|
|
484184
|
-
const ideClient = await IdeClient.getInstance();
|
|
484185
|
-
await ideClient.disconnect();
|
|
484186
|
-
});
|
|
484187
|
-
}, [config2]);
|
|
484188
|
-
(0, import_react167.useEffect)(
|
|
484580
|
+
useInitializationEffects(config2, historyManager, setConfigInitialized);
|
|
484581
|
+
(0, import_react173.useEffect)(
|
|
484189
484582
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
484190
484583
|
[historyManager.addItem]
|
|
484191
484584
|
);
|
|
484192
|
-
(0,
|
|
484585
|
+
(0, import_react173.useEffect)(() => {
|
|
484193
484586
|
const interval = setInterval(() => {
|
|
484194
484587
|
const model = getCurrentModel();
|
|
484195
484588
|
if (model !== currentModel) {
|
|
@@ -484198,13 +484591,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484198
484591
|
}, 1e3);
|
|
484199
484592
|
return () => clearInterval(interval);
|
|
484200
484593
|
}, [config2, currentModel, getCurrentModel]);
|
|
484201
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
484594
|
+
const { inputWidth, suggestionsWidth } = (0, import_react173.useMemo)(() => {
|
|
484202
484595
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
484203
484596
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
484204
484597
|
}, [terminalWidth]);
|
|
484205
484598
|
const mainAreaWidth = Math.min(terminalWidth - 4, 100);
|
|
484206
484599
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
484207
|
-
const isValidPath = (0,
|
|
484600
|
+
const isValidPath = (0, import_react173.useCallback)((filePath) => {
|
|
484208
484601
|
try {
|
|
484209
484602
|
return fs130.existsSync(filePath) && fs130.statSync(filePath).isFile();
|
|
484210
484603
|
} catch (_e2) {
|
|
@@ -484219,7 +484612,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484219
484612
|
isValidPath,
|
|
484220
484613
|
shellModeActive
|
|
484221
484614
|
});
|
|
484222
|
-
(0,
|
|
484615
|
+
(0, import_react173.useEffect)(() => {
|
|
484223
484616
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
484224
484617
|
const pastMessagesRaw = await logger9?.getPreviousUserMessages() || [];
|
|
484225
484618
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -484242,7 +484635,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484242
484635
|
}, "fetchUserMessages");
|
|
484243
484636
|
fetchUserMessages();
|
|
484244
484637
|
}, [historyManager.history, logger9]);
|
|
484245
|
-
const refreshStatic = (0,
|
|
484638
|
+
const refreshStatic = (0, import_react173.useCallback)(() => {
|
|
484246
484639
|
stdout2.write("\x1B[?2026h");
|
|
484247
484640
|
stdout2.write(base_exports.clearTerminal);
|
|
484248
484641
|
stdout2.write("\x1B[?2026l");
|
|
@@ -484278,7 +484671,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484278
484671
|
cancelAuthentication
|
|
484279
484672
|
} = useAuthCommand(settings2, config2, historyManager.addItem, refreshStatic);
|
|
484280
484673
|
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
484281
|
-
(0,
|
|
484674
|
+
(0, import_react173.useEffect)(() => {
|
|
484282
484675
|
const currentAuthType = config2.getModelsConfig().getCurrentAuthType();
|
|
484283
484676
|
if (settings2.merged.security?.auth?.enforcedType && currentAuthType && settings2.merged.security?.auth.enforcedType !== currentAuthType) {
|
|
484284
484677
|
onAuthError(
|
|
@@ -484304,7 +484697,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484304
484697
|
config2,
|
|
484305
484698
|
onAuthError
|
|
484306
484699
|
]);
|
|
484307
|
-
const [editorError, setEditorError] = (0,
|
|
484700
|
+
const [editorError, setEditorError] = (0, import_react173.useState)(null);
|
|
484308
484701
|
const {
|
|
484309
484702
|
isEditorDialogOpen,
|
|
484310
484703
|
openEditorDialog,
|
|
@@ -484348,10 +484741,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484348
484741
|
} = useExtensionsManagerDialog();
|
|
484349
484742
|
const { isMcpDialogOpen, openMcpDialog, closeMcpDialog } = useMcpDialog();
|
|
484350
484743
|
const { isHooksDialogOpen, openHooksDialog, closeHooksDialog } = useHooksDialog();
|
|
484351
|
-
const [isRewindDialogOpen, setIsRewindDialogOpen] = (0,
|
|
484352
|
-
const openRewindDialog = (0,
|
|
484353
|
-
const closeRewindDialog = (0,
|
|
484354
|
-
const slashCommandActions = (0,
|
|
484744
|
+
const [isRewindDialogOpen, setIsRewindDialogOpen] = (0, import_react173.useState)(false);
|
|
484745
|
+
const openRewindDialog = (0, import_react173.useCallback)(() => setIsRewindDialogOpen(true), []);
|
|
484746
|
+
const closeRewindDialog = (0, import_react173.useCallback)(() => setIsRewindDialogOpen(false), []);
|
|
484747
|
+
const slashCommandActions = (0, import_react173.useMemo)(
|
|
484355
484748
|
() => ({
|
|
484356
484749
|
openAuthDialog,
|
|
484357
484750
|
openThemeDialog,
|
|
@@ -484429,13 +484822,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484429
484822
|
isConfigInitialized,
|
|
484430
484823
|
logger9
|
|
484431
484824
|
);
|
|
484432
|
-
const onDebugMessage = (0,
|
|
484825
|
+
const onDebugMessage = (0, import_react173.useCallback)(
|
|
484433
484826
|
(message) => {
|
|
484434
484827
|
config2.getDebugLogger().debug(message);
|
|
484435
484828
|
},
|
|
484436
484829
|
[config2]
|
|
484437
484830
|
);
|
|
484438
|
-
const performMemoryRefresh = (0,
|
|
484831
|
+
const performMemoryRefresh = (0, import_react173.useCallback)(async () => {
|
|
484439
484832
|
historyManager.addItem(
|
|
484440
484833
|
{
|
|
484441
484834
|
type: "info" /* INFO */,
|
|
@@ -484463,7 +484856,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484463
484856
|
},
|
|
484464
484857
|
Date.now()
|
|
484465
484858
|
);
|
|
484466
|
-
|
|
484859
|
+
debugLogger152.debug(
|
|
484467
484860
|
`[DEBUG] Refreshed memory content in config: ${memoryContent.substring(
|
|
484468
484861
|
0,
|
|
484469
484862
|
200
|
|
@@ -484478,10 +484871,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484478
484871
|
},
|
|
484479
484872
|
Date.now()
|
|
484480
484873
|
);
|
|
484481
|
-
|
|
484874
|
+
debugLogger152.error("Error refreshing memory:", error40);
|
|
484482
484875
|
}
|
|
484483
484876
|
}, [config2, historyManager, settings2.merged]);
|
|
484484
|
-
const cancelHandlerRef = (0,
|
|
484877
|
+
const cancelHandlerRef = (0, import_react173.useRef)(() => {
|
|
484485
484878
|
});
|
|
484486
484879
|
const { messageQueue, addMessage, popLast, drain } = useMessageQueue();
|
|
484487
484880
|
const voiceEnabled = settings2.merged.voice?.enabled ?? false;
|
|
@@ -484525,24 +484918,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484525
484918
|
terminalHeight,
|
|
484526
484919
|
drain
|
|
484527
484920
|
);
|
|
484528
|
-
(
|
|
484529
|
-
|
|
484530
|
-
|
|
484531
|
-
|
|
484532
|
-
|
|
484533
|
-
|
|
484534
|
-
|
|
484535
|
-
const [hasSuggestionsVisible, setHasSuggestionsVisible] = (0,
|
|
484921
|
+
useIdleMessageDrain(
|
|
484922
|
+
isConfigInitialized,
|
|
484923
|
+
streamingState,
|
|
484924
|
+
messageQueue,
|
|
484925
|
+
drain,
|
|
484926
|
+
submitQuery
|
|
484927
|
+
);
|
|
484928
|
+
const [hasSuggestionsVisible, setHasSuggestionsVisible] = (0, import_react173.useState)(false);
|
|
484536
484929
|
const agentViewState = useAgentViewState();
|
|
484537
|
-
const [promptSuggestion, setPromptSuggestion] = (0, import_react167.useState)(null);
|
|
484538
|
-
const prevStreamingStateRef = (0, import_react167.useRef)("idle" /* Idle */);
|
|
484539
|
-
const speculationRef = (0, import_react167.useRef)(IDLE_SPECULATION);
|
|
484540
|
-
const suggestionAbortRef = (0, import_react167.useRef)(null);
|
|
484541
|
-
const dismissPromptSuggestion = (0, import_react167.useCallback)(() => {
|
|
484542
|
-
setPromptSuggestion(null);
|
|
484543
|
-
suggestionAbortRef.current?.abort();
|
|
484544
|
-
suggestionAbortRef.current = null;
|
|
484545
|
-
}, []);
|
|
484546
484930
|
const geminiClient = config2.getGeminiClient();
|
|
484547
484931
|
const showAutoAcceptIndicator = useAutoAcceptIndicator({
|
|
484548
484932
|
config: config2,
|
|
@@ -484551,7 +484935,25 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484551
484935
|
shouldBlockTab: /* @__PURE__ */ __name(() => hasSuggestionsVisible, "shouldBlockTab"),
|
|
484552
484936
|
disabled: agentViewState.activeView !== "main"
|
|
484553
484937
|
});
|
|
484554
|
-
const
|
|
484938
|
+
const {
|
|
484939
|
+
promptSuggestion,
|
|
484940
|
+
setPromptSuggestion,
|
|
484941
|
+
dismissPromptSuggestion,
|
|
484942
|
+
speculationRef
|
|
484943
|
+
} = usePromptSuggestions({
|
|
484944
|
+
config: config2,
|
|
484945
|
+
settings: settings2,
|
|
484946
|
+
streamingState,
|
|
484947
|
+
geminiClient,
|
|
484948
|
+
historyManager,
|
|
484949
|
+
shellConfirmationRequest,
|
|
484950
|
+
confirmationRequest,
|
|
484951
|
+
loopDetectionConfirmationRequest,
|
|
484952
|
+
isPermissionsDialogOpen,
|
|
484953
|
+
settingInputRequests,
|
|
484954
|
+
pendingGeminiHistoryItems
|
|
484955
|
+
});
|
|
484956
|
+
const handleFinalSubmit = (0, import_react173.useCallback)(
|
|
484555
484957
|
(submittedValue) => {
|
|
484556
484958
|
if (agentViewState.activeView !== "main") {
|
|
484557
484959
|
const agent = agentViewState.agents.get(agentViewState.activeView);
|
|
@@ -484654,10 +485056,12 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484654
485056
|
submitQuery,
|
|
484655
485057
|
config2,
|
|
484656
485058
|
geminiClient,
|
|
484657
|
-
historyManager
|
|
485059
|
+
historyManager,
|
|
485060
|
+
setPromptSuggestion,
|
|
485061
|
+
speculationRef
|
|
484658
485062
|
]
|
|
484659
485063
|
);
|
|
484660
|
-
const handleArenaModelsSelected = (0,
|
|
485064
|
+
const handleArenaModelsSelected = (0, import_react173.useCallback)(
|
|
484661
485065
|
(models) => {
|
|
484662
485066
|
const value = models.join(",");
|
|
484663
485067
|
buffer.setText(`/arena start --models ${value} `);
|
|
@@ -484672,7 +485076,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484672
485076
|
handleWelcomeBackSelection,
|
|
484673
485077
|
handleWelcomeBackClose
|
|
484674
485078
|
} = useWelcomeBack(config2, handleFinalSubmit, buffer, settings2.merged);
|
|
484675
|
-
cancelHandlerRef.current = (0,
|
|
485079
|
+
cancelHandlerRef.current = (0, import_react173.useCallback)(() => {
|
|
484676
485080
|
const pendingHistoryItems2 = [
|
|
484677
485081
|
...pendingSlashCommandHistoryItems,
|
|
484678
485082
|
...pendingGeminiHistoryItems
|
|
@@ -484697,15 +485101,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484697
485101
|
pendingSlashCommandHistoryItems,
|
|
484698
485102
|
pendingGeminiHistoryItems
|
|
484699
485103
|
]);
|
|
484700
|
-
const handleClearScreen = (0,
|
|
485104
|
+
const handleClearScreen = (0, import_react173.useCallback)(() => {
|
|
484701
485105
|
historyManager.clearItems();
|
|
484702
485106
|
clearScreen2();
|
|
484703
485107
|
refreshStatic();
|
|
484704
485108
|
}, [historyManager, refreshStatic]);
|
|
484705
485109
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
484706
485110
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */);
|
|
484707
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
484708
|
-
(0,
|
|
485111
|
+
const [controlsHeight, setControlsHeight] = (0, import_react173.useState)(0);
|
|
485112
|
+
(0, import_react173.useLayoutEffect)(() => {
|
|
484709
485113
|
if (mainControlsRef.current) {
|
|
484710
485114
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
484711
485115
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -484729,13 +485133,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484729
485133
|
});
|
|
484730
485134
|
const isFocused = useFocus();
|
|
484731
485135
|
useBracketedPaste();
|
|
484732
|
-
const contextFileNames = (0,
|
|
485136
|
+
const contextFileNames = (0, import_react173.useMemo)(() => {
|
|
484733
485137
|
const fromSettings = settings2.merged.context?.fileName;
|
|
484734
485138
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
|
|
484735
485139
|
}, [settings2.merged.context?.fileName]);
|
|
484736
|
-
const initialPrompt = (0,
|
|
484737
|
-
const initialPromptSubmitted = (0,
|
|
484738
|
-
(0,
|
|
485140
|
+
const initialPrompt = (0, import_react173.useMemo)(() => config2.getQuestion(), [config2]);
|
|
485141
|
+
const initialPromptSubmitted = (0, import_react173.useRef)(false);
|
|
485142
|
+
(0, import_react173.useEffect)(() => {
|
|
484739
485143
|
if (activePtyId) {
|
|
484740
485144
|
ShellExecutionService.resizePty(
|
|
484741
485145
|
activePtyId,
|
|
@@ -484744,7 +485148,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484744
485148
|
);
|
|
484745
485149
|
}
|
|
484746
485150
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
484747
|
-
(0,
|
|
485151
|
+
(0, import_react173.useEffect)(() => {
|
|
484748
485152
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
|
|
484749
485153
|
handleFinalSubmit(initialPrompt);
|
|
484750
485154
|
initialPromptSubmitted.current = true;
|
|
@@ -484761,90 +485165,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484761
485165
|
welcomeBackChoice,
|
|
484762
485166
|
geminiClient
|
|
484763
485167
|
]);
|
|
484764
|
-
const
|
|
484765
|
-
(0,
|
|
484766
|
-
|
|
484767
|
-
suggestionAbortRef.current?.abort();
|
|
484768
|
-
setPromptSuggestion(null);
|
|
484769
|
-
if (speculationRef.current.status === "running") {
|
|
484770
|
-
abortSpeculation(speculationRef.current).catch(() => {
|
|
484771
|
-
});
|
|
484772
|
-
speculationRef.current = IDLE_SPECULATION;
|
|
484773
|
-
}
|
|
484774
|
-
}
|
|
484775
|
-
if (prevStreamingStateRef.current === "idle" /* Idle */ && streamingState === "responding" /* Responding */) {
|
|
484776
|
-
suggestionAbortRef.current?.abort();
|
|
484777
|
-
setPromptSuggestion(null);
|
|
484778
|
-
if (speculationRef.current.status !== "idle") {
|
|
484779
|
-
abortSpeculation(speculationRef.current).catch(() => {
|
|
484780
|
-
});
|
|
484781
|
-
speculationRef.current = IDLE_SPECULATION;
|
|
484782
|
-
}
|
|
484783
|
-
}
|
|
484784
|
-
if (followupSuggestionsEnabled && config2.isInteractive() && !config2.getSdkMode() && prevStreamingStateRef.current === "responding" /* Responding */ && streamingState === "idle" /* Idle */ && // Check both committed history and pending items for errors
|
|
484785
|
-
// (API errors go to pendingGeminiHistoryItems, not historyManager.history)
|
|
484786
|
-
historyManager.history[historyManager.history.length - 1]?.type !== "error" && !pendingGeminiHistoryItems.some((item) => item.type === "error") && !shellConfirmationRequest && !confirmationRequest && !loopDetectionConfirmationRequest && !isPermissionsDialogOpen && settingInputRequests.length === 0 && config2.getApprovalMode() !== ApprovalMode.PLAN) {
|
|
484787
|
-
const ac = new AbortController();
|
|
484788
|
-
suggestionAbortRef.current = ac;
|
|
484789
|
-
const fullHistory = geminiClient.getChat().getHistory(true);
|
|
484790
|
-
const conversationHistory = fullHistory.length > 40 ? fullHistory.slice(-40) : fullHistory;
|
|
484791
|
-
generatePromptSuggestion(config2, conversationHistory, ac.signal, {
|
|
484792
|
-
enableCacheSharing: settings2.merged.ui?.enableCacheSharing === true,
|
|
484793
|
-
model: settings2.merged.fastModel || void 0
|
|
484794
|
-
}).then((result) => {
|
|
484795
|
-
if (ac.signal.aborted) return;
|
|
484796
|
-
if (result.suggestion) {
|
|
484797
|
-
setPromptSuggestion(result.suggestion);
|
|
484798
|
-
if (settings2.merged.ui?.enableSpeculation) {
|
|
484799
|
-
startSpeculation(config2, result.suggestion, ac.signal, {
|
|
484800
|
-
model: settings2.merged.fastModel || void 0
|
|
484801
|
-
}).then((state) => {
|
|
484802
|
-
speculationRef.current = state;
|
|
484803
|
-
}).catch(() => {
|
|
484804
|
-
});
|
|
484805
|
-
}
|
|
484806
|
-
} else if (result.filterReason) {
|
|
484807
|
-
logPromptSuggestion(
|
|
484808
|
-
config2,
|
|
484809
|
-
new PromptSuggestionEvent({
|
|
484810
|
-
outcome: "suppressed",
|
|
484811
|
-
reason: result.filterReason
|
|
484812
|
-
})
|
|
484813
|
-
);
|
|
484814
|
-
}
|
|
484815
|
-
}).catch(() => {
|
|
484816
|
-
});
|
|
484817
|
-
}
|
|
484818
|
-
if (prevStreamingStateRef.current !== streamingState) {
|
|
484819
|
-
prevStreamingStateRef.current = streamingState;
|
|
484820
|
-
}
|
|
484821
|
-
return () => {
|
|
484822
|
-
suggestionAbortRef.current?.abort();
|
|
484823
|
-
if (speculationRef.current.status !== "idle") {
|
|
484824
|
-
abortSpeculation(speculationRef.current).catch(() => {
|
|
484825
|
-
});
|
|
484826
|
-
speculationRef.current = IDLE_SPECULATION;
|
|
484827
|
-
}
|
|
484828
|
-
};
|
|
484829
|
-
}, [
|
|
484830
|
-
streamingState,
|
|
484831
|
-
followupSuggestionsEnabled,
|
|
484832
|
-
shellConfirmationRequest,
|
|
484833
|
-
confirmationRequest,
|
|
484834
|
-
loopDetectionConfirmationRequest,
|
|
484835
|
-
isPermissionsDialogOpen,
|
|
484836
|
-
settingInputRequests
|
|
484837
|
-
]);
|
|
484838
|
-
(0, import_react167.useEffect)(() => {
|
|
484839
|
-
if (!promptSuggestion && speculationRef.current.status !== "idle") {
|
|
484840
|
-
abortSpeculation(speculationRef.current).catch(() => {
|
|
484841
|
-
});
|
|
484842
|
-
speculationRef.current = IDLE_SPECULATION;
|
|
484843
|
-
}
|
|
484844
|
-
}, [promptSuggestion]);
|
|
484845
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react167.useState)(false);
|
|
484846
|
-
const [currentIDE, setCurrentIDE] = (0, import_react167.useState)(null);
|
|
484847
|
-
(0, import_react167.useEffect)(() => {
|
|
485168
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react173.useState)(false);
|
|
485169
|
+
const [currentIDE, setCurrentIDE] = (0, import_react173.useState)(null);
|
|
485170
|
+
(0, import_react173.useEffect)(() => {
|
|
484848
485171
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
484849
485172
|
const ideClient = await IdeClient.getInstance();
|
|
484850
485173
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -484860,30 +485183,20 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484860
485183
|
tomlFiles: commandMigrationTomlFiles,
|
|
484861
485184
|
setShowMigrationNudge: setShowCommandMigrationNudge
|
|
484862
485185
|
} = useCommandMigration(settings2, config2.storage);
|
|
484863
|
-
const [
|
|
484864
|
-
const [
|
|
484865
|
-
const ctrlCTimerRef = (0, import_react167.useRef)(null);
|
|
484866
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react167.useState)(false);
|
|
484867
|
-
const ctrlDTimerRef = (0, import_react167.useRef)(null);
|
|
484868
|
-
const [escapePressedOnce, setEscapePressedOnce] = (0, import_react167.useState)(false);
|
|
484869
|
-
const escapeTimerRef = (0, import_react167.useRef)(null);
|
|
484870
|
-
const dialogsVisibleRef = (0, import_react167.useRef)(false);
|
|
484871
|
-
const [constrainHeight, setConstrainHeight] = (0, import_react167.useState)(true);
|
|
484872
|
-
const [ideContextState, setIdeContextState] = (0, import_react167.useState)();
|
|
484873
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react167.useState)(false);
|
|
484874
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react167.useState)(false);
|
|
485186
|
+
const [ideContextState, setIdeContextState] = (0, import_react173.useState)();
|
|
485187
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react173.useState)(false);
|
|
484875
485188
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings2, setIsTrustedFolder);
|
|
484876
485189
|
const {
|
|
484877
485190
|
needsRestart: ideNeedsRestart,
|
|
484878
485191
|
restartReason: ideTrustRestartReason
|
|
484879
485192
|
} = useIdeTrustListener();
|
|
484880
|
-
const isInitialMount = (0,
|
|
484881
|
-
(0,
|
|
485193
|
+
const isInitialMount = (0, import_react173.useRef)(true);
|
|
485194
|
+
(0, import_react173.useEffect)(() => {
|
|
484882
485195
|
if (ideNeedsRestart) {
|
|
484883
485196
|
setShowIdeRestartPrompt(true);
|
|
484884
485197
|
}
|
|
484885
485198
|
}, [ideNeedsRestart]);
|
|
484886
|
-
(0,
|
|
485199
|
+
(0, import_react173.useEffect)(() => {
|
|
484887
485200
|
if (isInitialMount.current) {
|
|
484888
485201
|
isInitialMount.current = false;
|
|
484889
485202
|
return;
|
|
@@ -484895,15 +485208,12 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484895
485208
|
clearTimeout(handler);
|
|
484896
485209
|
};
|
|
484897
485210
|
}, [terminalWidth, refreshStatic]);
|
|
484898
|
-
(0,
|
|
485211
|
+
(0, import_react173.useEffect)(() => {
|
|
484899
485212
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
484900
485213
|
setIdeContextState(ideContextStore.get());
|
|
484901
485214
|
return unsubscribe;
|
|
484902
485215
|
}, []);
|
|
484903
|
-
const
|
|
484904
|
-
setShowEscapePrompt(showPrompt);
|
|
484905
|
-
}, []);
|
|
484906
|
-
const handleIdePromptComplete = (0, import_react167.useCallback)(
|
|
485216
|
+
const handleIdePromptComplete = (0, import_react173.useCallback)(
|
|
484907
485217
|
(result) => {
|
|
484908
485218
|
if (result.userSelection === "yes") {
|
|
484909
485219
|
if (result.isExtensionPreInstalled) {
|
|
@@ -484919,7 +485229,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
484919
485229
|
},
|
|
484920
485230
|
[handleSlashCommand2, settings2]
|
|
484921
485231
|
);
|
|
484922
|
-
const handleCommandMigrationComplete = (0,
|
|
485232
|
+
const handleCommandMigrationComplete = (0, import_react173.useCallback)(
|
|
484923
485233
|
async (result) => {
|
|
484924
485234
|
setShowCommandMigrationNudge(false);
|
|
484925
485235
|
if (result.userSelection === "yes") {
|
|
@@ -485019,206 +485329,48 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
485019
485329
|
showWelcomeBackDialog,
|
|
485020
485330
|
handleWelcomeBackClose
|
|
485021
485331
|
});
|
|
485022
|
-
const handleExit = (
|
|
485023
|
-
|
|
485024
|
-
|
|
485025
|
-
|
|
485026
|
-
|
|
485027
|
-
|
|
485028
|
-
|
|
485029
|
-
|
|
485030
|
-
|
|
485031
|
-
|
|
485032
|
-
|
|
485033
|
-
|
|
485034
|
-
|
|
485035
|
-
|
|
485036
|
-
|
|
485037
|
-
|
|
485038
|
-
|
|
485039
|
-
|
|
485040
|
-
|
|
485041
|
-
|
|
485042
|
-
|
|
485043
|
-
|
|
485044
|
-
|
|
485045
|
-
|
|
485046
|
-
|
|
485047
|
-
|
|
485048
|
-
|
|
485049
|
-
|
|
485050
|
-
|
|
485051
|
-
|
|
485052
|
-
|
|
485053
|
-
|
|
485054
|
-
|
|
485055
|
-
|
|
485056
|
-
|
|
485057
|
-
|
|
485058
|
-
streamingState,
|
|
485059
|
-
cancelOngoingRequest,
|
|
485060
|
-
buffer
|
|
485061
|
-
]
|
|
485062
|
-
);
|
|
485063
|
-
const handleGlobalKeypress = (0, import_react167.useCallback)(
|
|
485064
|
-
(key) => {
|
|
485065
|
-
if (settings2.merged.general?.debugKeystrokeLogging) {
|
|
485066
|
-
debugLogger151.debug("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
485067
|
-
}
|
|
485068
|
-
if (keyMatchers["quit" /* QUIT */](key)) {
|
|
485069
|
-
if (isAuthenticating) {
|
|
485070
|
-
return;
|
|
485071
|
-
}
|
|
485072
|
-
if (!ctrlCPressedOnce) {
|
|
485073
|
-
setCtrlCPressedOnce(true);
|
|
485074
|
-
ctrlCTimerRef.current = setTimeout(() => {
|
|
485075
|
-
setCtrlCPressedOnce(false);
|
|
485076
|
-
ctrlCTimerRef.current = null;
|
|
485077
|
-
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
485078
|
-
}
|
|
485079
|
-
handleExit(ctrlCPressedOnce, setCtrlCPressedOnce, ctrlCTimerRef);
|
|
485080
|
-
return;
|
|
485081
|
-
} else if (keyMatchers["exit" /* EXIT */](key)) {
|
|
485082
|
-
if (buffer.text.length > 0) {
|
|
485083
|
-
return;
|
|
485084
|
-
}
|
|
485085
|
-
handleExit(ctrlDPressedOnce, setCtrlDPressedOnce, ctrlDTimerRef);
|
|
485086
|
-
return;
|
|
485087
|
-
} else if (keyMatchers["escape" /* ESCAPE */](key)) {
|
|
485088
|
-
if (btwItem && !dialogsVisibleRef.current) {
|
|
485089
|
-
cancelBtw();
|
|
485090
|
-
return;
|
|
485091
|
-
}
|
|
485092
|
-
if (embeddedShellFocused) {
|
|
485093
|
-
return;
|
|
485094
|
-
}
|
|
485095
|
-
if (buffer.text.length > 0) {
|
|
485096
|
-
if (escapePressedOnce) {
|
|
485097
|
-
buffer.setText("");
|
|
485098
|
-
return;
|
|
485099
|
-
}
|
|
485100
|
-
setEscapePressedOnce(true);
|
|
485101
|
-
escapeTimerRef.current = setTimeout(() => {
|
|
485102
|
-
setEscapePressedOnce(false);
|
|
485103
|
-
escapeTimerRef.current = null;
|
|
485104
|
-
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
485105
|
-
return;
|
|
485106
|
-
}
|
|
485107
|
-
if (streamingState === "responding" /* Responding */) {
|
|
485108
|
-
if (escapeTimerRef.current) {
|
|
485109
|
-
clearTimeout(escapeTimerRef.current);
|
|
485110
|
-
escapeTimerRef.current = null;
|
|
485111
|
-
}
|
|
485112
|
-
cancelOngoingRequest?.();
|
|
485113
|
-
setEscapePressedOnce(false);
|
|
485114
|
-
return;
|
|
485115
|
-
}
|
|
485116
|
-
if (escapePressedOnce) {
|
|
485117
|
-
if (escapeTimerRef.current) {
|
|
485118
|
-
clearTimeout(escapeTimerRef.current);
|
|
485119
|
-
escapeTimerRef.current = null;
|
|
485120
|
-
}
|
|
485121
|
-
setEscapePressedOnce(false);
|
|
485122
|
-
openRewindDialog();
|
|
485123
|
-
return;
|
|
485124
|
-
}
|
|
485125
|
-
if (!escapePressedOnce) {
|
|
485126
|
-
setEscapePressedOnce(true);
|
|
485127
|
-
escapeTimerRef.current = setTimeout(() => {
|
|
485128
|
-
setEscapePressedOnce(false);
|
|
485129
|
-
escapeTimerRef.current = null;
|
|
485130
|
-
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
485131
|
-
return;
|
|
485132
|
-
}
|
|
485133
|
-
if (escapeTimerRef.current) {
|
|
485134
|
-
clearTimeout(escapeTimerRef.current);
|
|
485135
|
-
escapeTimerRef.current = null;
|
|
485136
|
-
}
|
|
485137
|
-
setEscapePressedOnce(false);
|
|
485138
|
-
return;
|
|
485139
|
-
}
|
|
485140
|
-
if (btwItem && !btwItem.btw.isPending && !dialogsVisibleRef.current && buffer.text.length === 0) {
|
|
485141
|
-
if (key.name === "return" || key.sequence === " ") {
|
|
485142
|
-
setBtwItem(null);
|
|
485143
|
-
return;
|
|
485144
|
-
}
|
|
485145
|
-
}
|
|
485146
|
-
let enteringConstrainHeightMode = false;
|
|
485147
|
-
if (!constrainHeight) {
|
|
485148
|
-
enteringConstrainHeightMode = true;
|
|
485149
|
-
setConstrainHeight(true);
|
|
485150
|
-
}
|
|
485151
|
-
if (keyMatchers["toggleToolDescriptions" /* TOGGLE_TOOL_DESCRIPTIONS */](key)) {
|
|
485152
|
-
const newValue = !showToolDescriptions;
|
|
485153
|
-
setShowToolDescriptions(newValue);
|
|
485154
|
-
const mcpServers = config2.getMcpServers();
|
|
485155
|
-
if (Object.keys(mcpServers || {}).length > 0) {
|
|
485156
|
-
handleSlashCommand2(newValue ? "/mcp desc" : "/mcp nodesc");
|
|
485157
|
-
}
|
|
485158
|
-
} else if (keyMatchers["toggleIDEContextDetail" /* TOGGLE_IDE_CONTEXT_DETAIL */](key) && config2.getIdeMode() && ideContextState) {
|
|
485159
|
-
handleSlashCommand2("/ide status");
|
|
485160
|
-
} else if (keyMatchers["showMoreLines" /* SHOW_MORE_LINES */](key) && !enteringConstrainHeightMode) {
|
|
485161
|
-
setConstrainHeight(false);
|
|
485162
|
-
} else if (keyMatchers["toggleShellInputFocus" /* TOGGLE_SHELL_INPUT_FOCUS */](key)) {
|
|
485163
|
-
if (activePtyId || embeddedShellFocused) {
|
|
485164
|
-
setEmbeddedShellFocused((prev) => !prev);
|
|
485165
|
-
}
|
|
485166
|
-
}
|
|
485167
|
-
},
|
|
485168
|
-
[
|
|
485169
|
-
constrainHeight,
|
|
485170
|
-
setConstrainHeight,
|
|
485171
|
-
showToolDescriptions,
|
|
485172
|
-
setShowToolDescriptions,
|
|
485173
|
-
config2,
|
|
485174
|
-
ideContextState,
|
|
485175
|
-
handleExit,
|
|
485176
|
-
ctrlCPressedOnce,
|
|
485177
|
-
setCtrlCPressedOnce,
|
|
485178
|
-
ctrlCTimerRef,
|
|
485179
|
-
ctrlDPressedOnce,
|
|
485180
|
-
setCtrlDPressedOnce,
|
|
485181
|
-
ctrlDTimerRef,
|
|
485182
|
-
escapePressedOnce,
|
|
485183
|
-
setEscapePressedOnce,
|
|
485184
|
-
escapeTimerRef,
|
|
485185
|
-
streamingState,
|
|
485186
|
-
cancelOngoingRequest,
|
|
485187
|
-
buffer,
|
|
485188
|
-
handleSlashCommand2,
|
|
485189
|
-
activePtyId,
|
|
485190
|
-
embeddedShellFocused,
|
|
485191
|
-
btwItem,
|
|
485192
|
-
setBtwItem,
|
|
485193
|
-
cancelBtw,
|
|
485194
|
-
settings2.merged.general?.debugKeystrokeLogging,
|
|
485195
|
-
isAuthenticating,
|
|
485196
|
-
openRewindDialog
|
|
485197
|
-
]
|
|
485198
|
-
);
|
|
485199
|
-
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
485200
|
-
(0, import_react167.useEffect)(() => {
|
|
485201
|
-
if (!settings2.merged.ui?.showStatusInTitle || settings2.merged.ui?.hideWindowTitle)
|
|
485202
|
-
return;
|
|
485203
|
-
let title;
|
|
485204
|
-
if (streamingState === "idle" /* Idle */) {
|
|
485205
|
-
title = originalTitleRef.current;
|
|
485206
|
-
} else {
|
|
485207
|
-
const statusText = thought?.subject?.replace(/[\r\n]+/g, " ").substring(0, 80);
|
|
485208
|
-
title = statusText || originalTitleRef.current;
|
|
485209
|
-
}
|
|
485210
|
-
const paddedTitle = title.padEnd(80, " ");
|
|
485211
|
-
if (lastTitleRef.current !== paddedTitle) {
|
|
485212
|
-
lastTitleRef.current = paddedTitle;
|
|
485213
|
-
stdout2.write(`\x1B[?2026h\x1B]2;${paddedTitle}\x07\x1B[?2026l`);
|
|
485214
|
-
}
|
|
485215
|
-
}, [
|
|
485332
|
+
const { handleExit } = useExitHandling({
|
|
485333
|
+
isAuthDialogOpen,
|
|
485334
|
+
handleSlashCommand: handleSlashCommand2,
|
|
485335
|
+
closeAnyOpenDialog,
|
|
485336
|
+
streamingState,
|
|
485337
|
+
cancelOngoingRequest,
|
|
485338
|
+
buffer
|
|
485339
|
+
});
|
|
485340
|
+
const {
|
|
485341
|
+
showToolDescriptions,
|
|
485342
|
+
ctrlCPressedOnce,
|
|
485343
|
+
ctrlDPressedOnce,
|
|
485344
|
+
showEscapePrompt,
|
|
485345
|
+
handleEscapePromptChange,
|
|
485346
|
+
constrainHeight,
|
|
485347
|
+
setConstrainHeight,
|
|
485348
|
+
dialogsVisibleRef
|
|
485349
|
+
} = useKeyboardHandling({
|
|
485350
|
+
buffer,
|
|
485351
|
+
streamingState,
|
|
485352
|
+
btwItem,
|
|
485353
|
+
cancelBtw,
|
|
485354
|
+
setBtwItem,
|
|
485355
|
+
embeddedShellFocused,
|
|
485356
|
+
handleSlashCommand: handleSlashCommand2,
|
|
485357
|
+
cancelOngoingRequest,
|
|
485358
|
+
isAuthenticating,
|
|
485359
|
+
openRewindDialog,
|
|
485360
|
+
activePtyId,
|
|
485361
|
+
setEmbeddedShellFocused,
|
|
485362
|
+
config: config2,
|
|
485363
|
+
ideContextState,
|
|
485364
|
+
handleExit,
|
|
485365
|
+
debugKeystrokeLogging: settings2.merged.general?.debugKeystrokeLogging
|
|
485366
|
+
});
|
|
485367
|
+
useWindowTitle(
|
|
485216
485368
|
streamingState,
|
|
485217
485369
|
thought,
|
|
485218
|
-
settings2
|
|
485219
|
-
|
|
485220
|
-
|
|
485221
|
-
|
|
485370
|
+
settings2,
|
|
485371
|
+
stdout2,
|
|
485372
|
+
config2.getTargetDir()
|
|
485373
|
+
);
|
|
485222
485374
|
const nightly = props.version.includes("nightly");
|
|
485223
485375
|
const dialogsVisible = showWelcomeBackDialog || shouldShowIdePrompt || shouldShowCommandMigrationNudge || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!codingPlanUpdateRequest || settingInputRequests.length > 0 || pluginChoiceRequests.length > 0 || !!loopDetectionConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isTrustDialogOpen || activeArenaDialog !== null || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isMcpDialogOpen || isHooksDialogOpen || isApprovalModeDialogOpen || isResumeDialogOpen || isRewindDialogOpen || isExtensionsManagerDialogOpen;
|
|
485224
485376
|
dialogsVisibleRef.current = dialogsVisible;
|
|
@@ -485235,11 +485387,11 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
485235
485387
|
history: historyManager.history,
|
|
485236
485388
|
sessionStats
|
|
485237
485389
|
});
|
|
485238
|
-
const pendingHistoryItems = (0,
|
|
485390
|
+
const pendingHistoryItems = (0, import_react173.useMemo)(
|
|
485239
485391
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
485240
485392
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
485241
485393
|
);
|
|
485242
|
-
const uiState = (0,
|
|
485394
|
+
const uiState = (0, import_react173.useMemo)(
|
|
485243
485395
|
() => ({
|
|
485244
485396
|
history: historyManager.history,
|
|
485245
485397
|
historyManager,
|
|
@@ -485464,7 +485616,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
485464
485616
|
dismissPromptSuggestion
|
|
485465
485617
|
]
|
|
485466
485618
|
);
|
|
485467
|
-
const uiActions = (0,
|
|
485619
|
+
const uiActions = (0, import_react173.useMemo)(
|
|
485468
485620
|
() => ({
|
|
485469
485621
|
openThemeDialog,
|
|
485470
485622
|
openEditorDialog,
|
|
@@ -485615,9 +485767,9 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
485615
485767
|
|
|
485616
485768
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
485617
485769
|
init_esbuild_shims();
|
|
485618
|
-
var
|
|
485770
|
+
var import_react174 = __toESM(require_react(), 1);
|
|
485619
485771
|
function useKittyKeyboardProtocol() {
|
|
485620
|
-
const [status] = (0,
|
|
485772
|
+
const [status] = (0, import_react174.useState)({
|
|
485621
485773
|
supported: isKittyProtocolSupported(),
|
|
485622
485774
|
enabled: isKittyProtocolEnabled(),
|
|
485623
485775
|
checking: false
|
|
@@ -486597,7 +486749,7 @@ __name(validateNonInteractiveAuth, "validateNonInteractiveAuth");
|
|
|
486597
486749
|
|
|
486598
486750
|
// packages/cli/src/ui/components/StandaloneSessionPicker.tsx
|
|
486599
486751
|
init_esbuild_shims();
|
|
486600
|
-
var
|
|
486752
|
+
var import_react175 = __toESM(require_react(), 1);
|
|
486601
486753
|
init_dist4();
|
|
486602
486754
|
var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
|
|
486603
486755
|
function StandalonePickerScreen({
|
|
@@ -486607,7 +486759,7 @@ function StandalonePickerScreen({
|
|
|
486607
486759
|
currentBranch
|
|
486608
486760
|
}) {
|
|
486609
486761
|
const { exit } = use_app_default();
|
|
486610
|
-
const [isExiting, setIsExiting] = (0,
|
|
486762
|
+
const [isExiting, setIsExiting] = (0, import_react175.useState)(false);
|
|
486611
486763
|
const handleExit = /* @__PURE__ */ __name(() => {
|
|
486612
486764
|
setIsExiting(true);
|
|
486613
486765
|
exit();
|
|
@@ -488472,7 +488624,7 @@ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
|
|
|
488472
488624
|
__name(toPermissionOptions, "toPermissionOptions");
|
|
488473
488625
|
|
|
488474
488626
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
488475
|
-
var
|
|
488627
|
+
var debugLogger153 = createDebugLogger("ACP_SUBAGENT_TRACKER");
|
|
488476
488628
|
var SubAgentTracker = class {
|
|
488477
488629
|
constructor(ctx, client, parentToolCallId, subagentType) {
|
|
488478
488630
|
this.ctx = ctx;
|
|
@@ -488540,7 +488692,7 @@ var SubAgentTracker = class {
|
|
|
488540
488692
|
try {
|
|
488541
488693
|
invocation = tool.build(event.args);
|
|
488542
488694
|
} catch (e4) {
|
|
488543
|
-
|
|
488695
|
+
debugLogger153.warn(`Failed to build subagent tool ${event.name}:`, e4);
|
|
488544
488696
|
}
|
|
488545
488697
|
}
|
|
488546
488698
|
this.toolStates.set(event.callId, {
|
|
@@ -488610,7 +488762,7 @@ var SubAgentTracker = class {
|
|
|
488610
488762
|
answers: "answers" in output ? output.answers : void 0
|
|
488611
488763
|
});
|
|
488612
488764
|
} catch (error40) {
|
|
488613
|
-
|
|
488765
|
+
debugLogger153.error(
|
|
488614
488766
|
`Permission request failed for subagent tool ${event.name}:`,
|
|
488615
488767
|
error40
|
|
488616
488768
|
);
|
|
@@ -488651,7 +488803,7 @@ var SubAgentTracker = class {
|
|
|
488651
488803
|
};
|
|
488652
488804
|
|
|
488653
488805
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
488654
|
-
var
|
|
488806
|
+
var debugLogger154 = createDebugLogger("SESSION");
|
|
488655
488807
|
var Session3 = class {
|
|
488656
488808
|
constructor(id, chat, config2, client, settings2) {
|
|
488657
488809
|
this.chat = chat;
|
|
@@ -489014,7 +489166,7 @@ var Session3 = class {
|
|
|
489014
489166
|
}
|
|
489015
489167
|
} catch (error40) {
|
|
489016
489168
|
if (ac.signal.aborted) return;
|
|
489017
|
-
|
|
489169
|
+
debugLogger154.error("Error processing cron prompt:", error40);
|
|
489018
489170
|
const msg = error40 instanceof Error ? error40.message : String(error40);
|
|
489019
489171
|
await this.messageEmitter.emitAgentMessage(`[cron error] ${msg}`);
|
|
489020
489172
|
} finally {
|
|
@@ -489045,7 +489197,7 @@ var Session3 = class {
|
|
|
489045
489197
|
};
|
|
489046
489198
|
await this.sendUpdate(update2);
|
|
489047
489199
|
} catch (error40) {
|
|
489048
|
-
|
|
489200
|
+
debugLogger154.error("Error sending available commands update:", error40);
|
|
489049
489201
|
}
|
|
489050
489202
|
}
|
|
489051
489203
|
/**
|
|
@@ -489589,7 +489741,7 @@ ${contextPart.text}`
|
|
|
489589
489741
|
}
|
|
489590
489742
|
debug(msg) {
|
|
489591
489743
|
if (this.config.getDebugMode()) {
|
|
489592
|
-
|
|
489744
|
+
debugLogger154.warn(msg);
|
|
489593
489745
|
}
|
|
489594
489746
|
}
|
|
489595
489747
|
};
|
|
@@ -489607,7 +489759,7 @@ function runWithAcpRuntimeOutputDir(settings2, cwd6, fn) {
|
|
|
489607
489759
|
__name(runWithAcpRuntimeOutputDir, "runWithAcpRuntimeOutputDir");
|
|
489608
489760
|
|
|
489609
489761
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
489610
|
-
var
|
|
489762
|
+
var debugLogger155 = createDebugLogger("ACP_AGENT");
|
|
489611
489763
|
async function runAcpAgent(config2, settings2, argv) {
|
|
489612
489764
|
const stdout2 = Writable2.toWeb(process.stdout);
|
|
489613
489765
|
const stdin2 = Readable5.toWeb(process.stdin);
|
|
@@ -489623,7 +489775,7 @@ async function runAcpAgent(config2, settings2, argv) {
|
|
|
489623
489775
|
const shutdownHandler = /* @__PURE__ */ __name(() => {
|
|
489624
489776
|
if (shuttingDown) return;
|
|
489625
489777
|
shuttingDown = true;
|
|
489626
|
-
|
|
489778
|
+
debugLogger155.debug("[ACP] Shutdown signal received, closing streams");
|
|
489627
489779
|
try {
|
|
489628
489780
|
process.stdin.destroy();
|
|
489629
489781
|
} catch {
|
|
@@ -489662,7 +489814,7 @@ var QwenAgent = class {
|
|
|
489662
489814
|
async initialize(args2) {
|
|
489663
489815
|
this.clientCapabilities = args2.clientCapabilities;
|
|
489664
489816
|
const authMethods = buildAuthMethods();
|
|
489665
|
-
const version2 = "0.25.
|
|
489817
|
+
const version2 = "0.25.3";
|
|
489666
489818
|
return {
|
|
489667
489819
|
protocolVersion: PROTOCOL_VERSION,
|
|
489668
489820
|
agentInfo: {
|
|
@@ -489870,7 +490022,7 @@ var QwenAgent = class {
|
|
|
489870
490022
|
try {
|
|
489871
490023
|
await config2.refreshAuth(selectedType, true);
|
|
489872
490024
|
} catch (e4) {
|
|
489873
|
-
|
|
490025
|
+
debugLogger155.error(`Authentication failed: ${e4}`);
|
|
489874
490026
|
throw RequestError.authRequired(
|
|
489875
490027
|
{
|
|
489876
490028
|
authMethods: this.pickAuthMethodsForAuthRequired(selectedType, e4)
|
|
@@ -490008,7 +490160,7 @@ var QwenAgent = class {
|
|
|
490008
490160
|
|
|
490009
490161
|
// packages/cli/src/gemini.tsx
|
|
490010
490162
|
var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1);
|
|
490011
|
-
var
|
|
490163
|
+
var debugLogger156 = createDebugLogger("STARTUP");
|
|
490012
490164
|
function validateDnsResolutionOrder(order) {
|
|
490013
490165
|
const defaultValue = "ipv4first";
|
|
490014
490166
|
if (order === void 0) {
|
|
@@ -490093,7 +490245,7 @@ async function startInteractiveUI(config2, settings2, startupWarnings, workspace
|
|
|
490093
490245
|
) });
|
|
490094
490246
|
}, "AppWrapper");
|
|
490095
490247
|
const instance2 = render_default(
|
|
490096
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
490248
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_react176.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AppWrapper, {}),
|
|
490097
490249
|
{
|
|
490098
490250
|
exitOnCtrlC: false,
|
|
490099
490251
|
patchConsole: false,
|
|
@@ -490105,7 +490257,7 @@ async function startInteractiveUI(config2, settings2, startupWarnings, workspace
|
|
|
490105
490257
|
checkForUpdates().then((info2) => {
|
|
490106
490258
|
handleAutoUpdate(info2, settings2, config2.getProjectRoot());
|
|
490107
490259
|
}).catch((err2) => {
|
|
490108
|
-
|
|
490260
|
+
debugLogger156.warn(`Update check failed: ${err2}`);
|
|
490109
490261
|
});
|
|
490110
490262
|
}
|
|
490111
490263
|
registerCleanup(() => instance2.unmount());
|
|
@@ -490302,7 +490454,7 @@ ${input}`;
|
|
|
490302
490454
|
auth_type: config2.getContentGeneratorConfig()?.authType,
|
|
490303
490455
|
prompt_length: input.length
|
|
490304
490456
|
});
|
|
490305
|
-
|
|
490457
|
+
debugLogger156.debug(`Session ID: ${config2.getSessionId()}`);
|
|
490306
490458
|
await runNonInteractive(nonInteractiveConfig, settings2, input, prompt_id);
|
|
490307
490459
|
await runExitCleanup();
|
|
490308
490460
|
process.exit(0);
|