@qwen-code/qwen-code 0.2.2 → 0.2.3-nightly.20251120.442a9aed
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/README.md +1 -1
- package/cli.js +641 -894
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -26786,7 +26786,7 @@ var require_backend = __commonJS({
|
|
|
26786
26786
|
return function() {
|
|
26787
26787
|
};
|
|
26788
26788
|
}, "useCacheRefresh"),
|
|
26789
|
-
useCallback: /* @__PURE__ */ __name(function
|
|
26789
|
+
useCallback: /* @__PURE__ */ __name(function useCallback52(a) {
|
|
26790
26790
|
var b = C();
|
|
26791
26791
|
x.push({
|
|
26792
26792
|
primitive: "Callback",
|
|
@@ -26803,7 +26803,7 @@ var require_backend = __commonJS({
|
|
|
26803
26803
|
});
|
|
26804
26804
|
return a._currentValue;
|
|
26805
26805
|
}, "useContext"),
|
|
26806
|
-
useEffect: /* @__PURE__ */ __name(function
|
|
26806
|
+
useEffect: /* @__PURE__ */ __name(function useEffect57(a) {
|
|
26807
26807
|
C();
|
|
26808
26808
|
x.push({
|
|
26809
26809
|
primitive: "Effect",
|
|
@@ -26844,7 +26844,7 @@ var require_backend = __commonJS({
|
|
|
26844
26844
|
value: a
|
|
26845
26845
|
});
|
|
26846
26846
|
}, "useInsertionEffect"),
|
|
26847
|
-
useMemo: /* @__PURE__ */ __name(function
|
|
26847
|
+
useMemo: /* @__PURE__ */ __name(function useMemo24(a) {
|
|
26848
26848
|
var b = C();
|
|
26849
26849
|
a = null !== b ? b.memoizedState[0] : a();
|
|
26850
26850
|
x.push({
|
|
@@ -26868,7 +26868,7 @@ var require_backend = __commonJS({
|
|
|
26868
26868
|
return [b, function() {
|
|
26869
26869
|
}];
|
|
26870
26870
|
}, "useReducer"),
|
|
26871
|
-
useRef: /* @__PURE__ */ __name(function
|
|
26871
|
+
useRef: /* @__PURE__ */ __name(function useRef21(a) {
|
|
26872
26872
|
var b = C();
|
|
26873
26873
|
a = null !== b ? b.memoizedState : {
|
|
26874
26874
|
current: a
|
|
@@ -26880,7 +26880,7 @@ var require_backend = __commonJS({
|
|
|
26880
26880
|
});
|
|
26881
26881
|
return a;
|
|
26882
26882
|
}, "useRef"),
|
|
26883
|
-
useState: /* @__PURE__ */ __name(function
|
|
26883
|
+
useState: /* @__PURE__ */ __name(function useState65(a) {
|
|
26884
26884
|
var b = C();
|
|
26885
26885
|
a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a;
|
|
26886
26886
|
x.push({
|
|
@@ -97784,26 +97784,27 @@ var init_qwenOAuth2 = __esm({
|
|
|
97784
97784
|
body: objectToUrlEncoded(bodyData)
|
|
97785
97785
|
});
|
|
97786
97786
|
if (!response.ok) {
|
|
97787
|
+
const responseText = await response.text();
|
|
97788
|
+
let errorData = null;
|
|
97787
97789
|
try {
|
|
97788
|
-
|
|
97789
|
-
if (response.status === 400 && errorData.error === "authorization_pending") {
|
|
97790
|
-
return { status: "pending" };
|
|
97791
|
-
}
|
|
97792
|
-
if (response.status === 429 && errorData.error === "slow_down") {
|
|
97793
|
-
return {
|
|
97794
|
-
status: "pending",
|
|
97795
|
-
slowDown: true
|
|
97796
|
-
};
|
|
97797
|
-
}
|
|
97798
|
-
const error = new Error(`Device token poll failed: ${errorData.error || "Unknown error"} - ${errorData.error_description || "No details provided"}`);
|
|
97799
|
-
error.status = response.status;
|
|
97800
|
-
throw error;
|
|
97790
|
+
errorData = JSON.parse(responseText);
|
|
97801
97791
|
} catch (_parseError) {
|
|
97802
|
-
const
|
|
97803
|
-
|
|
97804
|
-
|
|
97805
|
-
|
|
97792
|
+
const error2 = new Error(`Device token poll failed: ${response.status} ${response.statusText}. Response: ${responseText}`);
|
|
97793
|
+
error2.status = response.status;
|
|
97794
|
+
throw error2;
|
|
97795
|
+
}
|
|
97796
|
+
if (response.status === 400 && errorData.error === "authorization_pending") {
|
|
97797
|
+
return { status: "pending" };
|
|
97806
97798
|
}
|
|
97799
|
+
if (response.status === 429 && errorData.error === "slow_down") {
|
|
97800
|
+
return {
|
|
97801
|
+
status: "pending",
|
|
97802
|
+
slowDown: true
|
|
97803
|
+
};
|
|
97804
|
+
}
|
|
97805
|
+
const error = new Error(`Device token poll failed: ${errorData.error || "Unknown error"} - ${errorData.error_description}`);
|
|
97806
|
+
error.status = response.status;
|
|
97807
|
+
throw error;
|
|
97807
97808
|
}
|
|
97808
97809
|
return await response.json();
|
|
97809
97810
|
}
|
|
@@ -113614,13 +113615,17 @@ var init_types3 = __esm({
|
|
|
113614
113615
|
static {
|
|
113615
113616
|
__name(this, "RipgrepFallbackEvent");
|
|
113616
113617
|
}
|
|
113617
|
-
error;
|
|
113618
113618
|
"event.name";
|
|
113619
113619
|
"event.timestamp";
|
|
113620
|
-
|
|
113621
|
-
|
|
113620
|
+
use_ripgrep;
|
|
113621
|
+
use_builtin_ripgrep;
|
|
113622
|
+
error;
|
|
113623
|
+
constructor(use_ripgrep, use_builtin_ripgrep, error) {
|
|
113622
113624
|
this["event.name"] = "ripgrep_fallback";
|
|
113623
113625
|
this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
113626
|
+
this.use_ripgrep = use_ripgrep;
|
|
113627
|
+
this.use_builtin_ripgrep = use_builtin_ripgrep;
|
|
113628
|
+
this.error = error;
|
|
113624
113629
|
}
|
|
113625
113630
|
};
|
|
113626
113631
|
(function(LoopType2) {
|
|
@@ -120434,8 +120439,16 @@ var init_qwen_logger = __esm({
|
|
|
120434
120439
|
this.enqueueLogEvent(rumEvent);
|
|
120435
120440
|
this.flushIfNeeded();
|
|
120436
120441
|
}
|
|
120437
|
-
logRipgrepFallbackEvent() {
|
|
120438
|
-
const rumEvent = this.createActionEvent("misc", "ripgrep_fallback", {
|
|
120442
|
+
logRipgrepFallbackEvent(event) {
|
|
120443
|
+
const rumEvent = this.createActionEvent("misc", "ripgrep_fallback", {
|
|
120444
|
+
snapshots: JSON.stringify({
|
|
120445
|
+
platform: process.platform,
|
|
120446
|
+
arch: process.arch,
|
|
120447
|
+
use_ripgrep: event.use_ripgrep,
|
|
120448
|
+
use_builtin_ripgrep: event.use_builtin_ripgrep,
|
|
120449
|
+
error: event.error ?? void 0
|
|
120450
|
+
})
|
|
120451
|
+
});
|
|
120439
120452
|
this.enqueueLogEvent(rumEvent);
|
|
120440
120453
|
this.flushIfNeeded();
|
|
120441
120454
|
}
|
|
@@ -170574,7 +170587,7 @@ function logFlashFallback(config, event) {
|
|
|
170574
170587
|
logger6.emit(logRecord);
|
|
170575
170588
|
}
|
|
170576
170589
|
function logRipgrepFallback(config, event) {
|
|
170577
|
-
QwenLogger.getInstance(config)?.logRipgrepFallbackEvent();
|
|
170590
|
+
QwenLogger.getInstance(config)?.logRipgrepFallbackEvent(event);
|
|
170578
170591
|
if (!isTelemetrySdkInitialized())
|
|
170579
170592
|
return;
|
|
170580
170593
|
const attributes = {
|
|
@@ -182766,7 +182779,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
182766
182779
|
};
|
|
182767
182780
|
}
|
|
182768
182781
|
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
182769
|
-
const version2 = "0.2.
|
|
182782
|
+
const version2 = "0.2.3-nightly.20251120.442a9aed";
|
|
182770
182783
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
182771
182784
|
const baseHeaders = {
|
|
182772
182785
|
"User-Agent": userAgent2
|
|
@@ -196798,7 +196811,8 @@ var init_shellReadOnlyChecker = __esm({
|
|
|
196798
196811
|
|
|
196799
196812
|
// packages/core/dist/src/utils/shell-utils.js
|
|
196800
196813
|
import os16 from "node:os";
|
|
196801
|
-
import {
|
|
196814
|
+
import { execFile as execFile6, execFileSync as execFileSync2 } from "node:child_process";
|
|
196815
|
+
import { accessSync, constants as fsConstants2 } from "node:fs";
|
|
196802
196816
|
function getShellConfiguration() {
|
|
196803
196817
|
if (isWindows3()) {
|
|
196804
196818
|
const comSpec = process.env["ComSpec"] || "cmd.exe";
|
|
@@ -197026,6 +197040,57 @@ function checkCommandPermissions(command2, config, sessionAllowlist) {
|
|
|
197026
197040
|
}
|
|
197027
197041
|
return { allAllowed: true, disallowedCommands: [] };
|
|
197028
197042
|
}
|
|
197043
|
+
function execCommand(command2, args, options2 = {}) {
|
|
197044
|
+
return new Promise((resolve24, reject) => {
|
|
197045
|
+
const child = execFile6(command2, args, { encoding: "utf8", ...options2 }, (error, stdout, stderr) => {
|
|
197046
|
+
if (error) {
|
|
197047
|
+
if (!options2.preserveOutputOnError) {
|
|
197048
|
+
reject(error);
|
|
197049
|
+
} else {
|
|
197050
|
+
resolve24({
|
|
197051
|
+
stdout: stdout ?? "",
|
|
197052
|
+
stderr: stderr ?? "",
|
|
197053
|
+
code: typeof error.code === "number" ? error.code : 1
|
|
197054
|
+
});
|
|
197055
|
+
}
|
|
197056
|
+
return;
|
|
197057
|
+
}
|
|
197058
|
+
resolve24({ stdout: stdout ?? "", stderr: stderr ?? "", code: 0 });
|
|
197059
|
+
});
|
|
197060
|
+
child.on("error", reject);
|
|
197061
|
+
});
|
|
197062
|
+
}
|
|
197063
|
+
function resolveCommandPath(command2) {
|
|
197064
|
+
try {
|
|
197065
|
+
const isWin = process.platform === "win32";
|
|
197066
|
+
const checkCommand = isWin ? "where" : "command";
|
|
197067
|
+
const checkArgs = isWin ? [command2] : ["-v", command2];
|
|
197068
|
+
let result = null;
|
|
197069
|
+
try {
|
|
197070
|
+
result = execFileSync2(checkCommand, checkArgs, {
|
|
197071
|
+
encoding: "utf8",
|
|
197072
|
+
shell: isWin
|
|
197073
|
+
}).trim();
|
|
197074
|
+
} catch {
|
|
197075
|
+
console.warn(`Command ${checkCommand} not found`);
|
|
197076
|
+
}
|
|
197077
|
+
if (!result)
|
|
197078
|
+
return { path: null, error: void 0 };
|
|
197079
|
+
if (!isWin) {
|
|
197080
|
+
accessSync(result, fsConstants2.X_OK);
|
|
197081
|
+
}
|
|
197082
|
+
return { path: result, error: void 0 };
|
|
197083
|
+
} catch (error) {
|
|
197084
|
+
return {
|
|
197085
|
+
path: null,
|
|
197086
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
197087
|
+
};
|
|
197088
|
+
}
|
|
197089
|
+
}
|
|
197090
|
+
function isCommandAvailable(command2) {
|
|
197091
|
+
const { path: path108, error } = resolveCommandPath(command2);
|
|
197092
|
+
return { available: path108 !== null, error };
|
|
197093
|
+
}
|
|
197029
197094
|
function isCommandAllowed(command2, config) {
|
|
197030
197095
|
const { allAllowed, blockReason } = checkCommandPermissions(command2, config);
|
|
197031
197096
|
if (allAllowed) {
|
|
@@ -197043,7 +197108,7 @@ function isCommandNeedsPermission(command2) {
|
|
|
197043
197108
|
reason: "Command requires permission to execute."
|
|
197044
197109
|
};
|
|
197045
197110
|
}
|
|
197046
|
-
var import_shell_quote2, SHELL_TOOL_NAMES2, isWindows3
|
|
197111
|
+
var import_shell_quote2, SHELL_TOOL_NAMES2, isWindows3;
|
|
197047
197112
|
var init_shell_utils = __esm({
|
|
197048
197113
|
"packages/core/dist/src/utils/shell-utils.js"() {
|
|
197049
197114
|
"use strict";
|
|
@@ -197061,28 +197126,9 @@ var init_shell_utils = __esm({
|
|
|
197061
197126
|
__name(stripShellWrapper, "stripShellWrapper");
|
|
197062
197127
|
__name(detectCommandSubstitution, "detectCommandSubstitution");
|
|
197063
197128
|
__name(checkCommandPermissions, "checkCommandPermissions");
|
|
197064
|
-
|
|
197065
|
-
|
|
197066
|
-
|
|
197067
|
-
let stderr = "";
|
|
197068
|
-
child.stdout.on("data", (data) => {
|
|
197069
|
-
stdout += data.toString();
|
|
197070
|
-
});
|
|
197071
|
-
child.stderr.on("data", (data) => {
|
|
197072
|
-
stderr += data.toString();
|
|
197073
|
-
});
|
|
197074
|
-
child.on("close", (code2) => {
|
|
197075
|
-
if (code2 === 0) {
|
|
197076
|
-
resolve24({ stdout, stderr });
|
|
197077
|
-
} else {
|
|
197078
|
-
reject(new Error(`Command failed with exit code ${code2}:
|
|
197079
|
-
${stderr}`));
|
|
197080
|
-
}
|
|
197081
|
-
});
|
|
197082
|
-
child.on("error", (err) => {
|
|
197083
|
-
reject(err);
|
|
197084
|
-
});
|
|
197085
|
-
}), "spawnAsync");
|
|
197129
|
+
__name(execCommand, "execCommand");
|
|
197130
|
+
__name(resolveCommandPath, "resolveCommandPath");
|
|
197131
|
+
__name(isCommandAvailable, "isCommandAvailable");
|
|
197086
197132
|
__name(isCommandAllowed, "isCommandAllowed");
|
|
197087
197133
|
__name(isCommandNeedsPermission, "isCommandNeedsPermission");
|
|
197088
197134
|
}
|
|
@@ -213742,7 +213788,7 @@ var require_dist5 = __commonJS({
|
|
|
213742
213788
|
|
|
213743
213789
|
// node_modules/simple-git/dist/esm/index.js
|
|
213744
213790
|
import { Buffer as Buffer22 } from "node:buffer";
|
|
213745
|
-
import { spawn as
|
|
213791
|
+
import { spawn as spawn2 } from "child_process";
|
|
213746
213792
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
213747
213793
|
function pathspec(...paths) {
|
|
213748
213794
|
const key = new String(paths);
|
|
@@ -216419,7 +216465,7 @@ var init_esm10 = __esm({
|
|
|
216419
216465
|
rejection = reason || rejection;
|
|
216420
216466
|
}
|
|
216421
216467
|
});
|
|
216422
|
-
const spawned =
|
|
216468
|
+
const spawned = spawn2(command2, args, spawnOptions);
|
|
216423
216469
|
spawned.stdout.on(
|
|
216424
216470
|
"data",
|
|
216425
216471
|
onDataReceived(stdOut, "stdOut", logger6, outputLogger.step("stdOut"))
|
|
@@ -218474,7 +218520,7 @@ var init_gitService = __esm({
|
|
|
218474
218520
|
return this.storage.getHistoryDir();
|
|
218475
218521
|
}
|
|
218476
218522
|
async initialize() {
|
|
218477
|
-
const gitAvailable =
|
|
218523
|
+
const { available: gitAvailable } = isCommandAvailable("git");
|
|
218478
218524
|
if (!gitAvailable) {
|
|
218479
218525
|
throw new Error("Checkpointing is enabled, but Git is not installed. Please install Git or disable checkpointing to continue.");
|
|
218480
218526
|
}
|
|
@@ -218484,14 +218530,6 @@ var init_gitService = __esm({
|
|
|
218484
218530
|
throw new Error(`Failed to initialize checkpointing: ${error instanceof Error ? error.message : "Unknown error"}. Please check that Git is working properly or disable checkpointing.`);
|
|
218485
218531
|
}
|
|
218486
218532
|
}
|
|
218487
|
-
async verifyGitAvailability() {
|
|
218488
|
-
try {
|
|
218489
|
-
await spawnAsync("git", ["--version"]);
|
|
218490
|
-
return true;
|
|
218491
|
-
} catch (_error) {
|
|
218492
|
-
return false;
|
|
218493
|
-
}
|
|
218494
|
-
}
|
|
218495
218533
|
/**
|
|
218496
218534
|
* Creates a hidden git repository in the project root.
|
|
218497
218535
|
* The Git repository is used to support checkpointing.
|
|
@@ -229401,13 +229439,13 @@ var require_cross_spawn = __commonJS({
|
|
|
229401
229439
|
var cp2 = __require("child_process");
|
|
229402
229440
|
var parse12 = require_parse5();
|
|
229403
229441
|
var enoent = require_enoent();
|
|
229404
|
-
function
|
|
229442
|
+
function spawn11(command2, args, options2) {
|
|
229405
229443
|
const parsed = parse12(command2, args, options2);
|
|
229406
229444
|
const spawned = cp2.spawn(parsed.command, parsed.args, parsed.options);
|
|
229407
229445
|
enoent.hookChildProcess(spawned, parsed);
|
|
229408
229446
|
return spawned;
|
|
229409
229447
|
}
|
|
229410
|
-
__name(
|
|
229448
|
+
__name(spawn11, "spawn");
|
|
229411
229449
|
function spawnSync5(command2, args, options2) {
|
|
229412
229450
|
const parsed = parse12(command2, args, options2);
|
|
229413
229451
|
const result = cp2.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
@@ -229415,8 +229453,8 @@ var require_cross_spawn = __commonJS({
|
|
|
229415
229453
|
return result;
|
|
229416
229454
|
}
|
|
229417
229455
|
__name(spawnSync5, "spawnSync");
|
|
229418
|
-
module2.exports =
|
|
229419
|
-
module2.exports.spawn =
|
|
229456
|
+
module2.exports = spawn11;
|
|
229457
|
+
module2.exports.spawn = spawn11;
|
|
229420
229458
|
module2.exports.sync = spawnSync5;
|
|
229421
229459
|
module2.exports._parse = parse12;
|
|
229422
229460
|
module2.exports._enoent = enoent;
|
|
@@ -231251,7 +231289,7 @@ ${fileListDescription}`;
|
|
|
231251
231289
|
import fsPromises2 from "node:fs/promises";
|
|
231252
231290
|
import path36 from "node:path";
|
|
231253
231291
|
import { EOL as EOL2 } from "node:os";
|
|
231254
|
-
import { spawn as
|
|
231292
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
231255
231293
|
var GrepToolInvocation, GrepTool;
|
|
231256
231294
|
var init_grep2 = __esm({
|
|
231257
231295
|
"packages/core/dist/src/tools/grep.js"() {
|
|
@@ -231264,6 +231302,7 @@ var init_grep2 = __esm({
|
|
|
231264
231302
|
init_errors();
|
|
231265
231303
|
init_gitUtils();
|
|
231266
231304
|
init_tool_error();
|
|
231305
|
+
init_shell_utils();
|
|
231267
231306
|
GrepToolInvocation = class extends BaseToolInvocation {
|
|
231268
231307
|
static {
|
|
231269
231308
|
__name(this, "GrepToolInvocation");
|
|
@@ -231357,27 +231396,6 @@ var init_grep2 = __esm({
|
|
|
231357
231396
|
};
|
|
231358
231397
|
}
|
|
231359
231398
|
}
|
|
231360
|
-
/**
|
|
231361
|
-
* Checks if a command is available in the system's PATH.
|
|
231362
|
-
* @param {string} command The command name (e.g., 'git', 'grep').
|
|
231363
|
-
* @returns {Promise<boolean>} True if the command is available, false otherwise.
|
|
231364
|
-
*/
|
|
231365
|
-
isCommandAvailable(command2) {
|
|
231366
|
-
return new Promise((resolve24) => {
|
|
231367
|
-
const checkCommand = process.platform === "win32" ? "where" : "command";
|
|
231368
|
-
const checkArgs = process.platform === "win32" ? [command2] : ["-v", command2];
|
|
231369
|
-
try {
|
|
231370
|
-
const child = spawn5(checkCommand, checkArgs, {
|
|
231371
|
-
stdio: "ignore",
|
|
231372
|
-
shell: process.platform === "win32"
|
|
231373
|
-
});
|
|
231374
|
-
child.on("close", (code2) => resolve24(code2 === 0));
|
|
231375
|
-
child.on("error", () => resolve24(false));
|
|
231376
|
-
} catch {
|
|
231377
|
-
resolve24(false);
|
|
231378
|
-
}
|
|
231379
|
-
});
|
|
231380
|
-
}
|
|
231381
231399
|
/**
|
|
231382
231400
|
* Parses the standard output of grep-like commands (git grep, system grep).
|
|
231383
231401
|
* Expects format: filePath:lineNumber:lineContent
|
|
@@ -231437,7 +231455,7 @@ var init_grep2 = __esm({
|
|
|
231437
231455
|
let strategyUsed = "none";
|
|
231438
231456
|
try {
|
|
231439
231457
|
const isGit = isGitRepository(absolutePath);
|
|
231440
|
-
const gitAvailable = isGit &&
|
|
231458
|
+
const gitAvailable = isGit && isCommandAvailable("git").available;
|
|
231441
231459
|
if (gitAvailable) {
|
|
231442
231460
|
strategyUsed = "git grep";
|
|
231443
231461
|
const gitArgs = [
|
|
@@ -231453,7 +231471,7 @@ var init_grep2 = __esm({
|
|
|
231453
231471
|
}
|
|
231454
231472
|
try {
|
|
231455
231473
|
const output = await new Promise((resolve24, reject) => {
|
|
231456
|
-
const child =
|
|
231474
|
+
const child = spawn4("git", gitArgs, {
|
|
231457
231475
|
cwd: absolutePath,
|
|
231458
231476
|
windowsHide: true
|
|
231459
231477
|
});
|
|
@@ -231478,7 +231496,7 @@ var init_grep2 = __esm({
|
|
|
231478
231496
|
console.debug(`GrepLogic: git grep failed: ${getErrorMessage(gitError)}. Falling back...`);
|
|
231479
231497
|
}
|
|
231480
231498
|
}
|
|
231481
|
-
const grepAvailable =
|
|
231499
|
+
const { available: grepAvailable } = isCommandAvailable("grep");
|
|
231482
231500
|
if (grepAvailable) {
|
|
231483
231501
|
strategyUsed = "system grep";
|
|
231484
231502
|
const grepArgs = ["-r", "-n", "-H", "-E"];
|
|
@@ -231506,7 +231524,7 @@ var init_grep2 = __esm({
|
|
|
231506
231524
|
grepArgs.push(".");
|
|
231507
231525
|
try {
|
|
231508
231526
|
const output = await new Promise((resolve24, reject) => {
|
|
231509
|
-
const child =
|
|
231527
|
+
const child = spawn4("grep", grepArgs, {
|
|
231510
231528
|
cwd: absolutePath,
|
|
231511
231529
|
windowsHide: true
|
|
231512
231530
|
});
|
|
@@ -232235,6 +232253,10 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
232235
232253
|
// packages/core/dist/src/utils/ripgrepUtils.js
|
|
232236
232254
|
import path39 from "node:path";
|
|
232237
232255
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
232256
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
232257
|
+
function wslTimeout() {
|
|
232258
|
+
return process.platform === "linux" && process.env["WSL_INTEROP"] ? RIPGREP_WSL_TIMEOUT_MS : RIPGREP_RUN_TIMEOUT_MS;
|
|
232259
|
+
}
|
|
232238
232260
|
function getPlatformString(platform15) {
|
|
232239
232261
|
switch (platform15) {
|
|
232240
232262
|
case "darwin":
|
|
@@ -232265,58 +232287,127 @@ function getBuiltinRipgrep() {
|
|
|
232265
232287
|
const vendorPath = isBundled ? path39.join(__dirname3, "vendor", "ripgrep", `${arch3}-${platform15}`, binaryName) : path39.join(__dirname3, "..", "..", "..", "vendor", "ripgrep", `${arch3}-${platform15}`, binaryName);
|
|
232266
232288
|
return vendorPath;
|
|
232267
232289
|
}
|
|
232268
|
-
async function
|
|
232269
|
-
|
|
232270
|
-
|
|
232271
|
-
|
|
232272
|
-
const
|
|
232273
|
-
|
|
232274
|
-
|
|
232275
|
-
|
|
232276
|
-
}
|
|
232277
|
-
return isAvailable ? rgCommand : null;
|
|
232278
|
-
} catch (_error) {
|
|
232279
|
-
return null;
|
|
232290
|
+
async function resolveRipgrep(useBuiltin = true) {
|
|
232291
|
+
if (cachedSelection)
|
|
232292
|
+
return cachedSelection;
|
|
232293
|
+
if (useBuiltin) {
|
|
232294
|
+
const rgPath = getBuiltinRipgrep();
|
|
232295
|
+
if (rgPath && await fileExists(rgPath)) {
|
|
232296
|
+
cachedSelection = { mode: "builtin", command: rgPath };
|
|
232297
|
+
return cachedSelection;
|
|
232298
|
+
}
|
|
232280
232299
|
}
|
|
232300
|
+
const { available, error } = isCommandAvailable(RIPGREP_COMMAND);
|
|
232301
|
+
if (available) {
|
|
232302
|
+
cachedSelection = { mode: "system", command: RIPGREP_COMMAND };
|
|
232303
|
+
return cachedSelection;
|
|
232304
|
+
}
|
|
232305
|
+
if (error) {
|
|
232306
|
+
throw error;
|
|
232307
|
+
}
|
|
232308
|
+
return null;
|
|
232281
232309
|
}
|
|
232282
|
-
async function
|
|
232310
|
+
async function ensureRipgrepHealthy(selection) {
|
|
232311
|
+
if (cachedHealth && cachedHealth.selection.command === selection.command && cachedHealth.working)
|
|
232312
|
+
return;
|
|
232283
232313
|
try {
|
|
232284
|
-
|
|
232285
|
-
|
|
232286
|
-
|
|
232287
|
-
|
|
232288
|
-
|
|
232289
|
-
|
|
232290
|
-
|
|
232291
|
-
|
|
232292
|
-
return null;
|
|
232314
|
+
const { stdout, code: code2 } = await execCommand(selection.command, ["--version"], {
|
|
232315
|
+
timeout: RIPGREP_TEST_TIMEOUT_MS
|
|
232316
|
+
});
|
|
232317
|
+
const working = code2 === 0 && stdout.startsWith("ripgrep");
|
|
232318
|
+
cachedHealth = { working, lastTested: Date.now(), selection };
|
|
232319
|
+
} catch (error) {
|
|
232320
|
+
cachedHealth = { working: false, lastTested: Date.now(), selection };
|
|
232321
|
+
throw error;
|
|
232293
232322
|
}
|
|
232294
232323
|
}
|
|
232295
232324
|
async function canUseRipgrep(useBuiltin = true) {
|
|
232296
|
-
const
|
|
232297
|
-
|
|
232325
|
+
const selection = await resolveRipgrep(useBuiltin);
|
|
232326
|
+
if (!selection) {
|
|
232327
|
+
return false;
|
|
232328
|
+
}
|
|
232329
|
+
await ensureRipgrepHealthy(selection);
|
|
232330
|
+
return true;
|
|
232298
232331
|
}
|
|
232299
|
-
|
|
232332
|
+
async function runRipgrep(args, signal) {
|
|
232333
|
+
const selection = await resolveRipgrep();
|
|
232334
|
+
if (!selection) {
|
|
232335
|
+
throw new Error("ripgrep not found.");
|
|
232336
|
+
}
|
|
232337
|
+
await ensureRipgrepHealthy(selection);
|
|
232338
|
+
return new Promise((resolve24) => {
|
|
232339
|
+
const child = execFile7(selection.command, args, {
|
|
232340
|
+
maxBuffer: RIPGREP_BUFFER_LIMIT,
|
|
232341
|
+
timeout: wslTimeout(),
|
|
232342
|
+
signal
|
|
232343
|
+
}, (error, stdout = "", stderr = "") => {
|
|
232344
|
+
if (!error) {
|
|
232345
|
+
resolve24({
|
|
232346
|
+
stdout,
|
|
232347
|
+
truncated: false
|
|
232348
|
+
});
|
|
232349
|
+
return;
|
|
232350
|
+
}
|
|
232351
|
+
const errorCode = error.code;
|
|
232352
|
+
if (errorCode === 1) {
|
|
232353
|
+
resolve24({ stdout: "", truncated: false });
|
|
232354
|
+
return;
|
|
232355
|
+
}
|
|
232356
|
+
const wasKilled = error.signal === "SIGTERM" || error.name === "AbortError";
|
|
232357
|
+
const overflow = errorCode === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
232358
|
+
const syntaxError2 = errorCode === 2;
|
|
232359
|
+
const truncated = wasKilled || overflow;
|
|
232360
|
+
let partialOutput = stdout;
|
|
232361
|
+
if (truncated && partialOutput.length > 0) {
|
|
232362
|
+
const lines = partialOutput.split("\n");
|
|
232363
|
+
if (lines.length > 0) {
|
|
232364
|
+
lines.pop();
|
|
232365
|
+
partialOutput = lines.join("\n");
|
|
232366
|
+
}
|
|
232367
|
+
}
|
|
232368
|
+
if (!syntaxError2 && truncated) {
|
|
232369
|
+
console.warn(`ripgrep exited abnormally (signal=${error.signal} code=${error.code}) with stderr:
|
|
232370
|
+
${stderr.trim() || "(empty)"}`);
|
|
232371
|
+
}
|
|
232372
|
+
resolve24({
|
|
232373
|
+
stdout: partialOutput,
|
|
232374
|
+
truncated,
|
|
232375
|
+
error: error instanceof Error ? error : void 0
|
|
232376
|
+
});
|
|
232377
|
+
});
|
|
232378
|
+
child.on("error", (err) => resolve24({ stdout: "", truncated: false, error: err }));
|
|
232379
|
+
});
|
|
232380
|
+
}
|
|
232381
|
+
var RIPGREP_COMMAND, RIPGREP_BUFFER_LIMIT, RIPGREP_TEST_TIMEOUT_MS, RIPGREP_RUN_TIMEOUT_MS, RIPGREP_WSL_TIMEOUT_MS, cachedSelection, cachedHealth, __filename2, __dirname3;
|
|
232300
232382
|
var init_ripgrepUtils = __esm({
|
|
232301
232383
|
"packages/core/dist/src/utils/ripgrepUtils.js"() {
|
|
232302
232384
|
"use strict";
|
|
232303
232385
|
init_esbuild_shims();
|
|
232304
232386
|
init_fileUtils();
|
|
232387
|
+
init_shell_utils();
|
|
232388
|
+
RIPGREP_COMMAND = "rg";
|
|
232389
|
+
RIPGREP_BUFFER_LIMIT = 2e7;
|
|
232390
|
+
RIPGREP_TEST_TIMEOUT_MS = 5e3;
|
|
232391
|
+
RIPGREP_RUN_TIMEOUT_MS = 1e4;
|
|
232392
|
+
RIPGREP_WSL_TIMEOUT_MS = 6e4;
|
|
232393
|
+
cachedSelection = null;
|
|
232394
|
+
cachedHealth = null;
|
|
232395
|
+
__name(wslTimeout, "wslTimeout");
|
|
232305
232396
|
__filename2 = fileURLToPath5(import.meta.url);
|
|
232306
232397
|
__dirname3 = path39.dirname(__filename2);
|
|
232307
232398
|
__name(getPlatformString, "getPlatformString");
|
|
232308
232399
|
__name(getArchitectureString, "getArchitectureString");
|
|
232309
232400
|
__name(getBuiltinRipgrep, "getBuiltinRipgrep");
|
|
232310
|
-
__name(
|
|
232311
|
-
__name(
|
|
232401
|
+
__name(resolveRipgrep, "resolveRipgrep");
|
|
232402
|
+
__name(ensureRipgrepHealthy, "ensureRipgrepHealthy");
|
|
232312
232403
|
__name(canUseRipgrep, "canUseRipgrep");
|
|
232404
|
+
__name(runRipgrep, "runRipgrep");
|
|
232313
232405
|
}
|
|
232314
232406
|
});
|
|
232315
232407
|
|
|
232316
232408
|
// packages/core/dist/src/tools/ripGrep.js
|
|
232317
232409
|
import fs36 from "node:fs";
|
|
232318
232410
|
import path40 from "node:path";
|
|
232319
|
-
import { spawn as spawn6 } from "node:child_process";
|
|
232320
232411
|
var GrepToolInvocation2, RipGrepTool;
|
|
232321
232412
|
var init_ripGrep = __esm({
|
|
232322
232413
|
"packages/core/dist/src/tools/ripGrep.js"() {
|
|
@@ -232442,47 +232533,11 @@ var init_ripGrep = __esm({
|
|
|
232442
232533
|
}
|
|
232443
232534
|
rgArgs.push("--threads", "4");
|
|
232444
232535
|
rgArgs.push(absolutePath);
|
|
232445
|
-
|
|
232446
|
-
|
|
232447
|
-
|
|
232448
|
-
throw new Error("ripgrep binary not found.");
|
|
232449
|
-
}
|
|
232450
|
-
const output = await new Promise((resolve24, reject) => {
|
|
232451
|
-
const child = spawn6(rgCommand, rgArgs, {
|
|
232452
|
-
windowsHide: true
|
|
232453
|
-
});
|
|
232454
|
-
const stdoutChunks = [];
|
|
232455
|
-
const stderrChunks = [];
|
|
232456
|
-
const cleanup = /* @__PURE__ */ __name(() => {
|
|
232457
|
-
if (options2.signal.aborted) {
|
|
232458
|
-
child.kill();
|
|
232459
|
-
}
|
|
232460
|
-
}, "cleanup");
|
|
232461
|
-
options2.signal.addEventListener("abort", cleanup, { once: true });
|
|
232462
|
-
child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
232463
|
-
child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
|
|
232464
|
-
child.on("error", (err) => {
|
|
232465
|
-
options2.signal.removeEventListener("abort", cleanup);
|
|
232466
|
-
reject(new Error(`failed to start ripgrep: ${err.message}.`));
|
|
232467
|
-
});
|
|
232468
|
-
child.on("close", (code2) => {
|
|
232469
|
-
options2.signal.removeEventListener("abort", cleanup);
|
|
232470
|
-
const stdoutData = Buffer.concat(stdoutChunks).toString("utf8");
|
|
232471
|
-
const stderrData = Buffer.concat(stderrChunks).toString("utf8");
|
|
232472
|
-
if (code2 === 0) {
|
|
232473
|
-
resolve24(stdoutData);
|
|
232474
|
-
} else if (code2 === 1) {
|
|
232475
|
-
resolve24("");
|
|
232476
|
-
} else {
|
|
232477
|
-
reject(new Error(`ripgrep exited with code ${code2}: ${stderrData}`));
|
|
232478
|
-
}
|
|
232479
|
-
});
|
|
232480
|
-
});
|
|
232481
|
-
return output;
|
|
232482
|
-
} catch (error) {
|
|
232483
|
-
console.error(`Ripgrep failed: ${getErrorMessage(error)}`);
|
|
232484
|
-
throw error;
|
|
232536
|
+
const result = await runRipgrep(rgArgs, options2.signal);
|
|
232537
|
+
if (result.error && !result.stdout) {
|
|
232538
|
+
throw result.error;
|
|
232485
232539
|
}
|
|
232540
|
+
return result.stdout;
|
|
232486
232541
|
}
|
|
232487
232542
|
getFileFilteringOptions() {
|
|
232488
232543
|
const options2 = this.config.getFileFilteringOptions?.();
|
|
@@ -234433,7 +234488,7 @@ var init_sa_impersonation_provider = __esm({
|
|
|
234433
234488
|
});
|
|
234434
234489
|
|
|
234435
234490
|
// packages/core/dist/src/utils/secure-browser-launcher.js
|
|
234436
|
-
import { execFile as
|
|
234491
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
234437
234492
|
import { promisify as promisify6 } from "node:util";
|
|
234438
234493
|
import { platform as platform5 } from "node:os";
|
|
234439
234494
|
import { URL as URL3 } from "node:url";
|
|
@@ -234520,7 +234575,7 @@ var init_secure_browser_launcher = __esm({
|
|
|
234520
234575
|
"packages/core/dist/src/utils/secure-browser-launcher.js"() {
|
|
234521
234576
|
"use strict";
|
|
234522
234577
|
init_esbuild_shims();
|
|
234523
|
-
execFileAsync5 = promisify6(
|
|
234578
|
+
execFileAsync5 = promisify6(execFile8);
|
|
234524
234579
|
__name(validateUrl, "validateUrl");
|
|
234525
234580
|
__name(openBrowserSecurely, "openBrowserSecurely");
|
|
234526
234581
|
}
|
|
@@ -236246,7 +236301,7 @@ var init_mcp_client_manager = __esm({
|
|
|
236246
236301
|
});
|
|
236247
236302
|
|
|
236248
236303
|
// packages/core/dist/src/tools/tool-registry.js
|
|
236249
|
-
import { spawn as
|
|
236304
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
236250
236305
|
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
236251
236306
|
var import_shell_quote4, DiscoveredToolInvocation, DiscoveredTool, ToolRegistry;
|
|
236252
236307
|
var init_tool_registry = __esm({
|
|
@@ -236276,7 +236331,7 @@ var init_tool_registry = __esm({
|
|
|
236276
236331
|
}
|
|
236277
236332
|
async execute(_signal, _updateOutput) {
|
|
236278
236333
|
const callCommand = this.config.getToolCallCommand();
|
|
236279
|
-
const child =
|
|
236334
|
+
const child = spawn5(callCommand, [this.toolName]);
|
|
236280
236335
|
child.stdin.write(JSON.stringify(this.params));
|
|
236281
236336
|
child.stdin.end();
|
|
236282
236337
|
let stdout = "";
|
|
@@ -236479,7 +236534,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
|
|
|
236479
236534
|
if (cmdParts.length === 0) {
|
|
236480
236535
|
throw new Error("Tool discovery command is empty or contains only whitespace.");
|
|
236481
236536
|
}
|
|
236482
|
-
const proc2 =
|
|
236537
|
+
const proc2 = spawn5(cmdParts[0], cmdParts.slice(1));
|
|
236483
236538
|
let stdout = "";
|
|
236484
236539
|
const stdoutDecoder = new StringDecoder2("utf8");
|
|
236485
236540
|
let stderr = "";
|
|
@@ -244471,6 +244526,7 @@ var init_config3 = __esm({
|
|
|
244471
244526
|
init_ignorePatterns();
|
|
244472
244527
|
init_workspaceContext();
|
|
244473
244528
|
init_tool_utils();
|
|
244529
|
+
init_errors();
|
|
244474
244530
|
init_constants3();
|
|
244475
244531
|
init_models();
|
|
244476
244532
|
init_storage();
|
|
@@ -244602,7 +244658,6 @@ var init_config3 = __esm({
|
|
|
244602
244658
|
skipNextSpeakerCheck;
|
|
244603
244659
|
shellExecutionConfig;
|
|
244604
244660
|
extensionManagement = true;
|
|
244605
|
-
enablePromptCompletion = false;
|
|
244606
244661
|
skipLoopDetection;
|
|
244607
244662
|
skipStartupContext;
|
|
244608
244663
|
vlmSwitchMode;
|
|
@@ -244705,7 +244760,6 @@ var init_config3 = __esm({
|
|
|
244705
244760
|
this.useSmartEdit = params.useSmartEdit ?? false;
|
|
244706
244761
|
this.extensionManagement = params.extensionManagement ?? true;
|
|
244707
244762
|
this.storage = new Storage(this.targetDir);
|
|
244708
|
-
this.enablePromptCompletion = params.enablePromptCompletion ?? false;
|
|
244709
244763
|
this.vlmSwitchMode = params.vlmSwitchMode;
|
|
244710
244764
|
this.fileExclusions = new FileExclusions(this);
|
|
244711
244765
|
this.eventEmitter = params.eventEmitter;
|
|
@@ -245081,9 +245135,6 @@ var init_config3 = __esm({
|
|
|
245081
245135
|
getScreenReader() {
|
|
245082
245136
|
return this.accessibility.screenReader ?? false;
|
|
245083
245137
|
}
|
|
245084
|
-
getEnablePromptCompletion() {
|
|
245085
|
-
return this.enablePromptCompletion;
|
|
245086
|
-
}
|
|
245087
245138
|
getSkipLoopDetection() {
|
|
245088
245139
|
return this.skipLoopDetection;
|
|
245089
245140
|
}
|
|
@@ -245160,13 +245211,12 @@ var init_config3 = __esm({
|
|
|
245160
245211
|
try {
|
|
245161
245212
|
useRipgrep = await canUseRipgrep(this.getUseBuiltinRipgrep());
|
|
245162
245213
|
} catch (error) {
|
|
245163
|
-
errorString =
|
|
245214
|
+
errorString = getErrorMessage(error);
|
|
245164
245215
|
}
|
|
245165
245216
|
if (useRipgrep) {
|
|
245166
245217
|
registerCoreTool(RipGrepTool, this);
|
|
245167
245218
|
} else {
|
|
245168
|
-
|
|
245169
|
-
logRipgrepFallback(this, new RipgrepFallbackEvent(errorString));
|
|
245219
|
+
logRipgrepFallback(this, new RipgrepFallbackEvent(this.getUseRipgrep(), this.getUseBuiltinRipgrep(), errorString || "ripgrep is not available"));
|
|
245170
245220
|
registerCoreTool(GrepTool, this);
|
|
245171
245221
|
}
|
|
245172
245222
|
} else {
|
|
@@ -276697,7 +276747,7 @@ var require_command_exists = __commonJS({
|
|
|
276697
276747
|
var fs95 = __require("fs");
|
|
276698
276748
|
var path108 = __require("path");
|
|
276699
276749
|
var access6 = fs95.access;
|
|
276700
|
-
var
|
|
276750
|
+
var accessSync2 = fs95.accessSync;
|
|
276701
276751
|
var constants4 = fs95.constants || fs95;
|
|
276702
276752
|
var isUsingWindows = process.platform == "win32";
|
|
276703
276753
|
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
|
@@ -276711,7 +276761,7 @@ var require_command_exists = __commonJS({
|
|
|
276711
276761
|
}, "fileNotExists");
|
|
276712
276762
|
var fileNotExistsSync = /* @__PURE__ */ __name(function(commandName) {
|
|
276713
276763
|
try {
|
|
276714
|
-
|
|
276764
|
+
accessSync2(commandName, constants4.F_OK);
|
|
276715
276765
|
return false;
|
|
276716
276766
|
} catch (e2) {
|
|
276717
276767
|
return true;
|
|
@@ -276728,7 +276778,7 @@ var require_command_exists = __commonJS({
|
|
|
276728
276778
|
}, "localExecutable");
|
|
276729
276779
|
var localExecutableSync = /* @__PURE__ */ __name(function(commandName) {
|
|
276730
276780
|
try {
|
|
276731
|
-
|
|
276781
|
+
accessSync2(commandName, constants4.F_OK | constants4.X_OK);
|
|
276732
276782
|
return true;
|
|
276733
276783
|
} catch (e2) {
|
|
276734
276784
|
return false;
|
|
@@ -284542,7 +284592,7 @@ init_esbuild_shims();
|
|
|
284542
284592
|
|
|
284543
284593
|
// packages/cli/src/gemini.tsx
|
|
284544
284594
|
init_esbuild_shims();
|
|
284545
|
-
var
|
|
284595
|
+
var import_react136 = __toESM(require_react(), 1);
|
|
284546
284596
|
|
|
284547
284597
|
// node_modules/ink/build/index.js
|
|
284548
284598
|
init_esbuild_shims();
|
|
@@ -291106,7 +291156,7 @@ var measure_element_default = measureElement;
|
|
|
291106
291156
|
|
|
291107
291157
|
// packages/cli/src/ui/AppContainer.tsx
|
|
291108
291158
|
init_esbuild_shims();
|
|
291109
|
-
var
|
|
291159
|
+
var import_react134 = __toESM(require_react(), 1);
|
|
291110
291160
|
|
|
291111
291161
|
// packages/cli/src/ui/App.tsx
|
|
291112
291162
|
init_esbuild_shims();
|
|
@@ -295125,7 +295175,13 @@ var SCREEN_READER_RESPONDING = "responding";
|
|
|
295125
295175
|
|
|
295126
295176
|
// packages/cli/src/ui/utils/commandUtils.ts
|
|
295127
295177
|
init_esbuild_shims();
|
|
295128
|
-
import { spawn as
|
|
295178
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
295179
|
+
var CodePage = {
|
|
295180
|
+
UTF8: 65001,
|
|
295181
|
+
GBK: 936,
|
|
295182
|
+
BIG5: 950,
|
|
295183
|
+
LATIN1: 1252
|
|
295184
|
+
};
|
|
295129
295185
|
var isAtCommand = /* @__PURE__ */ __name((query) => (
|
|
295130
295186
|
// Check if starts with @ OR has a space, then @
|
|
295131
295187
|
query.startsWith("@") || /\s@/.test(query)
|
|
@@ -295144,7 +295200,7 @@ var isSlashCommand = /* @__PURE__ */ __name((query) => {
|
|
|
295144
295200
|
}, "isSlashCommand");
|
|
295145
295201
|
var copyToClipboard = /* @__PURE__ */ __name(async (text) => {
|
|
295146
295202
|
const run = /* @__PURE__ */ __name((cmd, args, options2) => new Promise((resolve24, reject) => {
|
|
295147
|
-
const child = options2 ?
|
|
295203
|
+
const child = options2 ? spawn6(cmd, args, options2) : spawn6(cmd, args);
|
|
295148
295204
|
let stderr = "";
|
|
295149
295205
|
if (child.stderr) {
|
|
295150
295206
|
child.stderr.on("data", (chunk) => stderr += chunk.toString());
|
|
@@ -295170,7 +295226,7 @@ var copyToClipboard = /* @__PURE__ */ __name(async (text) => {
|
|
|
295170
295226
|
const linuxOptions = { stdio: ["pipe", "inherit", "pipe"] };
|
|
295171
295227
|
switch (process.platform) {
|
|
295172
295228
|
case "win32":
|
|
295173
|
-
return run("
|
|
295229
|
+
return run("cmd", ["/c", `chcp ${CodePage.UTF8} >nul && clip`]);
|
|
295174
295230
|
case "darwin":
|
|
295175
295231
|
return run("pbcopy", []);
|
|
295176
295232
|
case "linux":
|
|
@@ -319182,15 +319238,6 @@ var SETTINGS_SCHEMA = {
|
|
|
319182
319238
|
}
|
|
319183
319239
|
}
|
|
319184
319240
|
},
|
|
319185
|
-
enablePromptCompletion: {
|
|
319186
|
-
type: "boolean",
|
|
319187
|
-
label: "Enable Prompt Completion",
|
|
319188
|
-
category: "General",
|
|
319189
|
-
requiresRestart: true,
|
|
319190
|
-
default: false,
|
|
319191
|
-
description: "Enable AI-powered prompt completion suggestions while typing.",
|
|
319192
|
-
showInDialog: true
|
|
319193
|
-
},
|
|
319194
319241
|
debugKeystrokeLogging: {
|
|
319195
319242
|
type: "boolean",
|
|
319196
319243
|
label: "Debug Keystroke Logging",
|
|
@@ -326642,7 +326689,6 @@ var MIGRATION_MAP = {
|
|
|
326642
326689
|
disableAutoUpdate: "general.disableAutoUpdate",
|
|
326643
326690
|
disableUpdateNag: "general.disableUpdateNag",
|
|
326644
326691
|
dnsResolutionOrder: "advanced.dnsResolutionOrder",
|
|
326645
|
-
enablePromptCompletion: "general.enablePromptCompletion",
|
|
326646
326692
|
enforcedAuthType: "security.auth.enforcedType",
|
|
326647
326693
|
excludeTools: "tools.exclude",
|
|
326648
326694
|
excludeMCPServers: "mcp.excluded",
|
|
@@ -330338,7 +330384,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
330338
330384
|
|
|
330339
330385
|
// packages/cli/src/ui/components/Composer.tsx
|
|
330340
330386
|
init_esbuild_shims();
|
|
330341
|
-
var
|
|
330387
|
+
var import_react96 = __toESM(require_react(), 1);
|
|
330342
330388
|
|
|
330343
330389
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
330344
330390
|
init_esbuild_shims();
|
|
@@ -330582,7 +330628,7 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
330582
330628
|
|
|
330583
330629
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
330584
330630
|
init_esbuild_shims();
|
|
330585
|
-
var
|
|
330631
|
+
var import_react92 = __toESM(require_react(), 1);
|
|
330586
330632
|
|
|
330587
330633
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
330588
330634
|
init_esbuild_shims();
|
|
@@ -331107,7 +331153,7 @@ __name(useReverseSearchCompletion, "useReverseSearchCompletion");
|
|
|
331107
331153
|
|
|
331108
331154
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
331109
331155
|
init_esbuild_shims();
|
|
331110
|
-
var
|
|
331156
|
+
var import_react90 = __toESM(require_react(), 1);
|
|
331111
331157
|
|
|
331112
331158
|
// packages/cli/src/ui/hooks/useAtCompletion.ts
|
|
331113
331159
|
init_esbuild_shims();
|
|
@@ -331640,172 +331686,6 @@ function useSlashCompletion(props) {
|
|
|
331640
331686
|
}
|
|
331641
331687
|
__name(useSlashCompletion, "useSlashCompletion");
|
|
331642
331688
|
|
|
331643
|
-
// packages/cli/src/ui/hooks/usePromptCompletion.ts
|
|
331644
|
-
init_esbuild_shims();
|
|
331645
|
-
var import_react90 = __toESM(require_react(), 1);
|
|
331646
|
-
var PROMPT_COMPLETION_MIN_LENGTH = 5;
|
|
331647
|
-
var PROMPT_COMPLETION_DEBOUNCE_MS = 250;
|
|
331648
|
-
function usePromptCompletion({
|
|
331649
|
-
buffer,
|
|
331650
|
-
config,
|
|
331651
|
-
enabled
|
|
331652
|
-
}) {
|
|
331653
|
-
const [ghostText, setGhostText] = (0, import_react90.useState)("");
|
|
331654
|
-
const [isLoadingGhostText, setIsLoadingGhostText] = (0, import_react90.useState)(false);
|
|
331655
|
-
const abortControllerRef = (0, import_react90.useRef)(null);
|
|
331656
|
-
const [justSelectedSuggestion, setJustSelectedSuggestion] = (0, import_react90.useState)(false);
|
|
331657
|
-
const lastSelectedTextRef = (0, import_react90.useRef)("");
|
|
331658
|
-
const lastRequestedTextRef = (0, import_react90.useRef)("");
|
|
331659
|
-
const isPromptCompletionEnabled = enabled && (config?.getEnablePromptCompletion() ?? false);
|
|
331660
|
-
const clearGhostText = (0, import_react90.useCallback)(() => {
|
|
331661
|
-
setGhostText("");
|
|
331662
|
-
setIsLoadingGhostText(false);
|
|
331663
|
-
}, []);
|
|
331664
|
-
const acceptGhostText = (0, import_react90.useCallback)(() => {
|
|
331665
|
-
if (ghostText && ghostText.length > buffer.text.length) {
|
|
331666
|
-
buffer.setText(ghostText);
|
|
331667
|
-
setGhostText("");
|
|
331668
|
-
setJustSelectedSuggestion(true);
|
|
331669
|
-
lastSelectedTextRef.current = ghostText;
|
|
331670
|
-
}
|
|
331671
|
-
}, [ghostText, buffer]);
|
|
331672
|
-
const markSuggestionSelected = (0, import_react90.useCallback)((selectedText) => {
|
|
331673
|
-
setJustSelectedSuggestion(true);
|
|
331674
|
-
lastSelectedTextRef.current = selectedText;
|
|
331675
|
-
}, []);
|
|
331676
|
-
const generatePromptSuggestions = (0, import_react90.useCallback)(async () => {
|
|
331677
|
-
const trimmedText = buffer.text.trim();
|
|
331678
|
-
const geminiClient = config?.getGeminiClient();
|
|
331679
|
-
if (trimmedText === lastRequestedTextRef.current) {
|
|
331680
|
-
return;
|
|
331681
|
-
}
|
|
331682
|
-
if (abortControllerRef.current) {
|
|
331683
|
-
abortControllerRef.current.abort();
|
|
331684
|
-
}
|
|
331685
|
-
if (trimmedText.length < PROMPT_COMPLETION_MIN_LENGTH || !geminiClient || isSlashCommand(trimmedText) || trimmedText.includes("@") || !isPromptCompletionEnabled) {
|
|
331686
|
-
clearGhostText();
|
|
331687
|
-
lastRequestedTextRef.current = "";
|
|
331688
|
-
return;
|
|
331689
|
-
}
|
|
331690
|
-
lastRequestedTextRef.current = trimmedText;
|
|
331691
|
-
setIsLoadingGhostText(true);
|
|
331692
|
-
abortControllerRef.current = new AbortController();
|
|
331693
|
-
const signal = abortControllerRef.current.signal;
|
|
331694
|
-
try {
|
|
331695
|
-
const contents = [
|
|
331696
|
-
{
|
|
331697
|
-
role: "user",
|
|
331698
|
-
parts: [
|
|
331699
|
-
{
|
|
331700
|
-
text: `You are a professional prompt engineering assistant. Complete the user's partial prompt with expert precision and clarity. User's input: "${trimmedText}" Continue this prompt by adding specific, actionable details that align with the user's intent. Focus on: clear, precise language; structured requirements; professional terminology; measurable outcomes. Length Guidelines: Keep suggestions concise (ideally 10-20 characters); prioritize brevity while maintaining clarity; use essential keywords only; avoid redundant phrases. Start your response with the exact user text ("${trimmedText}") followed by your completion. Provide practical, implementation-focused suggestions rather than creative interpretations. Format: Plain text only. Single completion. Match the user's language. Emphasize conciseness over elaboration.`
|
|
331701
|
-
}
|
|
331702
|
-
]
|
|
331703
|
-
}
|
|
331704
|
-
];
|
|
331705
|
-
const generationConfig = {
|
|
331706
|
-
temperature: 0.3,
|
|
331707
|
-
maxOutputTokens: 16e3,
|
|
331708
|
-
thinkingConfig: {
|
|
331709
|
-
thinkingBudget: 0
|
|
331710
|
-
}
|
|
331711
|
-
};
|
|
331712
|
-
const response = await geminiClient.generateContent(
|
|
331713
|
-
contents,
|
|
331714
|
-
generationConfig,
|
|
331715
|
-
signal,
|
|
331716
|
-
DEFAULT_GEMINI_FLASH_LITE_MODEL
|
|
331717
|
-
);
|
|
331718
|
-
if (signal.aborted) {
|
|
331719
|
-
return;
|
|
331720
|
-
}
|
|
331721
|
-
if (response) {
|
|
331722
|
-
const responseText = getResponseText(response);
|
|
331723
|
-
if (responseText) {
|
|
331724
|
-
const suggestionText = responseText.trim();
|
|
331725
|
-
if (suggestionText.length > 0 && suggestionText.startsWith(trimmedText)) {
|
|
331726
|
-
setGhostText(suggestionText);
|
|
331727
|
-
} else {
|
|
331728
|
-
clearGhostText();
|
|
331729
|
-
}
|
|
331730
|
-
}
|
|
331731
|
-
}
|
|
331732
|
-
} catch (error) {
|
|
331733
|
-
if (!(signal.aborted || error instanceof Error && error.name === "AbortError")) {
|
|
331734
|
-
console.error("prompt completion error:", error);
|
|
331735
|
-
lastRequestedTextRef.current = "";
|
|
331736
|
-
}
|
|
331737
|
-
clearGhostText();
|
|
331738
|
-
} finally {
|
|
331739
|
-
if (!signal.aborted) {
|
|
331740
|
-
setIsLoadingGhostText(false);
|
|
331741
|
-
}
|
|
331742
|
-
}
|
|
331743
|
-
}, [buffer.text, config, clearGhostText, isPromptCompletionEnabled]);
|
|
331744
|
-
const isCursorAtEnd = (0, import_react90.useCallback)(() => {
|
|
331745
|
-
const [cursorRow, cursorCol] = buffer.cursor;
|
|
331746
|
-
const totalLines = buffer.lines.length;
|
|
331747
|
-
if (cursorRow !== totalLines - 1) {
|
|
331748
|
-
return false;
|
|
331749
|
-
}
|
|
331750
|
-
const lastLine = buffer.lines[cursorRow] || "";
|
|
331751
|
-
return cursorCol === lastLine.length;
|
|
331752
|
-
}, [buffer.cursor, buffer.lines]);
|
|
331753
|
-
const handlePromptCompletion = (0, import_react90.useCallback)(() => {
|
|
331754
|
-
if (!isCursorAtEnd()) {
|
|
331755
|
-
clearGhostText();
|
|
331756
|
-
return;
|
|
331757
|
-
}
|
|
331758
|
-
const trimmedText = buffer.text.trim();
|
|
331759
|
-
if (justSelectedSuggestion && trimmedText === lastSelectedTextRef.current) {
|
|
331760
|
-
return;
|
|
331761
|
-
}
|
|
331762
|
-
if (trimmedText !== lastSelectedTextRef.current) {
|
|
331763
|
-
setJustSelectedSuggestion(false);
|
|
331764
|
-
lastSelectedTextRef.current = "";
|
|
331765
|
-
}
|
|
331766
|
-
generatePromptSuggestions();
|
|
331767
|
-
}, [
|
|
331768
|
-
buffer.text,
|
|
331769
|
-
generatePromptSuggestions,
|
|
331770
|
-
justSelectedSuggestion,
|
|
331771
|
-
isCursorAtEnd,
|
|
331772
|
-
clearGhostText
|
|
331773
|
-
]);
|
|
331774
|
-
(0, import_react90.useEffect)(() => {
|
|
331775
|
-
const timeoutId = setTimeout(
|
|
331776
|
-
handlePromptCompletion,
|
|
331777
|
-
PROMPT_COMPLETION_DEBOUNCE_MS
|
|
331778
|
-
);
|
|
331779
|
-
return () => clearTimeout(timeoutId);
|
|
331780
|
-
}, [buffer.text, buffer.cursor, handlePromptCompletion]);
|
|
331781
|
-
(0, import_react90.useEffect)(() => {
|
|
331782
|
-
const currentText = buffer.text.trim();
|
|
331783
|
-
if (ghostText && !isCursorAtEnd()) {
|
|
331784
|
-
clearGhostText();
|
|
331785
|
-
return;
|
|
331786
|
-
}
|
|
331787
|
-
if (ghostText && currentText.length > 0 && !ghostText.startsWith(currentText)) {
|
|
331788
|
-
clearGhostText();
|
|
331789
|
-
}
|
|
331790
|
-
}, [buffer.text, buffer.cursor, ghostText, clearGhostText, isCursorAtEnd]);
|
|
331791
|
-
(0, import_react90.useEffect)(() => () => abortControllerRef.current?.abort(), []);
|
|
331792
|
-
const isActive = (0, import_react90.useMemo)(() => {
|
|
331793
|
-
if (!isPromptCompletionEnabled) return false;
|
|
331794
|
-
if (!isCursorAtEnd()) return false;
|
|
331795
|
-
const trimmedText = buffer.text.trim();
|
|
331796
|
-
return trimmedText.length >= PROMPT_COMPLETION_MIN_LENGTH && !isSlashCommand(trimmedText) && !trimmedText.includes("@");
|
|
331797
|
-
}, [buffer.text, isPromptCompletionEnabled, isCursorAtEnd]);
|
|
331798
|
-
return {
|
|
331799
|
-
text: ghostText,
|
|
331800
|
-
isLoading: isLoadingGhostText,
|
|
331801
|
-
isActive,
|
|
331802
|
-
accept: acceptGhostText,
|
|
331803
|
-
clear: clearGhostText,
|
|
331804
|
-
markSelected: markSuggestionSelected
|
|
331805
|
-
};
|
|
331806
|
-
}
|
|
331807
|
-
__name(usePromptCompletion, "usePromptCompletion");
|
|
331808
|
-
|
|
331809
331689
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
331810
331690
|
function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext, reverseSearchActive = false, config) {
|
|
331811
331691
|
const {
|
|
@@ -331827,7 +331707,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
331827
331707
|
} = useCompletion();
|
|
331828
331708
|
const cursorRow = buffer.cursor[0];
|
|
331829
331709
|
const cursorCol = buffer.cursor[1];
|
|
331830
|
-
const { completionMode, query, completionStart, completionEnd } = (0,
|
|
331710
|
+
const { completionMode, query, completionStart, completionEnd } = (0, import_react90.useMemo)(() => {
|
|
331831
331711
|
const currentLine = buffer.lines[cursorRow] || "";
|
|
331832
331712
|
if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
|
|
331833
331713
|
return {
|
|
@@ -331872,23 +331752,13 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
331872
331752
|
};
|
|
331873
331753
|
}
|
|
331874
331754
|
}
|
|
331875
|
-
const trimmedText = buffer.text.trim();
|
|
331876
|
-
const isPromptCompletionEnabled = config?.getEnablePromptCompletion() ?? false;
|
|
331877
|
-
if (isPromptCompletionEnabled && trimmedText.length >= PROMPT_COMPLETION_MIN_LENGTH && !isSlashCommand(trimmedText) && !trimmedText.includes("@")) {
|
|
331878
|
-
return {
|
|
331879
|
-
completionMode: "PROMPT" /* PROMPT */,
|
|
331880
|
-
query: trimmedText,
|
|
331881
|
-
completionStart: 0,
|
|
331882
|
-
completionEnd: trimmedText.length
|
|
331883
|
-
};
|
|
331884
|
-
}
|
|
331885
331755
|
return {
|
|
331886
331756
|
completionMode: "IDLE" /* IDLE */,
|
|
331887
331757
|
query: null,
|
|
331888
331758
|
completionStart: -1,
|
|
331889
331759
|
completionEnd: -1
|
|
331890
331760
|
};
|
|
331891
|
-
}, [cursorRow, cursorCol, buffer.lines
|
|
331761
|
+
}, [cursorRow, cursorCol, buffer.lines]);
|
|
331892
331762
|
useAtCompletion({
|
|
331893
331763
|
enabled: completionMode === "AT" /* AT */,
|
|
331894
331764
|
pattern: query || "",
|
|
@@ -331906,16 +331776,11 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
331906
331776
|
setIsLoadingSuggestions,
|
|
331907
331777
|
setIsPerfectMatch
|
|
331908
331778
|
});
|
|
331909
|
-
|
|
331910
|
-
buffer,
|
|
331911
|
-
config,
|
|
331912
|
-
enabled: completionMode === "PROMPT" /* PROMPT */
|
|
331913
|
-
});
|
|
331914
|
-
(0, import_react91.useEffect)(() => {
|
|
331779
|
+
(0, import_react90.useEffect)(() => {
|
|
331915
331780
|
setActiveSuggestionIndex(suggestions.length > 0 ? 0 : -1);
|
|
331916
331781
|
setVisibleStartIndex(0);
|
|
331917
331782
|
}, [suggestions, setActiveSuggestionIndex, setVisibleStartIndex]);
|
|
331918
|
-
(0,
|
|
331783
|
+
(0, import_react90.useEffect)(() => {
|
|
331919
331784
|
if (completionMode === "IDLE" /* IDLE */ || reverseSearchActive) {
|
|
331920
331785
|
resetCompletionState();
|
|
331921
331786
|
return;
|
|
@@ -331929,7 +331794,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
331929
331794
|
resetCompletionState,
|
|
331930
331795
|
setShowSuggestions
|
|
331931
331796
|
]);
|
|
331932
|
-
const handleAutocomplete = (0,
|
|
331797
|
+
const handleAutocomplete = (0, import_react90.useCallback)(
|
|
331933
331798
|
(indexToUse) => {
|
|
331934
331799
|
if (indexToUse < 0 || indexToUse >= suggestions.length) {
|
|
331935
331800
|
return;
|
|
@@ -331983,8 +331848,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
331983
331848
|
resetCompletionState,
|
|
331984
331849
|
navigateUp,
|
|
331985
331850
|
navigateDown,
|
|
331986
|
-
handleAutocomplete
|
|
331987
|
-
promptCompletion
|
|
331851
|
+
handleAutocomplete
|
|
331988
331852
|
};
|
|
331989
331853
|
}
|
|
331990
331854
|
__name(useCommandCompletion, "useCommandCompletion");
|
|
@@ -332067,7 +331931,7 @@ async function clipboardHasImage() {
|
|
|
332067
331931
|
return false;
|
|
332068
331932
|
}
|
|
332069
331933
|
try {
|
|
332070
|
-
const { stdout } = await
|
|
331934
|
+
const { stdout } = await execCommand("osascript", ["-e", "clipboard info"]);
|
|
332071
331935
|
const imageRegex = /«class PNGf»|TIFF picture|JPEG picture|GIF picture|«class JPEG»|«class TIFF»/;
|
|
332072
331936
|
return imageRegex.test(stdout);
|
|
332073
331937
|
} catch {
|
|
@@ -332109,7 +331973,7 @@ async function saveClipboardImage(targetDir) {
|
|
|
332109
331973
|
return "error"
|
|
332110
331974
|
end try
|
|
332111
331975
|
`;
|
|
332112
|
-
const { stdout } = await
|
|
331976
|
+
const { stdout } = await execCommand("osascript", ["-e", script]);
|
|
332113
331977
|
if (stdout.trim() === "success") {
|
|
332114
331978
|
try {
|
|
332115
331979
|
const stats = await fs72.stat(tempFilePath);
|
|
@@ -332156,9 +332020,9 @@ import * as path75 from "node:path";
|
|
|
332156
332020
|
|
|
332157
332021
|
// packages/cli/src/ui/contexts/ShellFocusContext.tsx
|
|
332158
332022
|
init_esbuild_shims();
|
|
332159
|
-
var
|
|
332160
|
-
var ShellFocusContext = (0,
|
|
332161
|
-
var useShellFocusState = /* @__PURE__ */ __name(() => (0,
|
|
332023
|
+
var import_react91 = __toESM(require_react(), 1);
|
|
332024
|
+
var ShellFocusContext = (0, import_react91.createContext)(true);
|
|
332025
|
+
var useShellFocusState = /* @__PURE__ */ __name(() => (0, import_react91.useContext)(ShellFocusContext), "useShellFocusState");
|
|
332162
332026
|
|
|
332163
332027
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
332164
332028
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -332189,7 +332053,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332189
332053
|
commandContext,
|
|
332190
332054
|
placeholder = " Type your message or @path/to/file",
|
|
332191
332055
|
focus = true,
|
|
332192
|
-
inputWidth,
|
|
332193
332056
|
suggestionsWidth,
|
|
332194
332057
|
shellModeActive,
|
|
332195
332058
|
setShellModeActive,
|
|
@@ -332199,29 +332062,29 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332199
332062
|
isEmbeddedShellFocused
|
|
332200
332063
|
}) => {
|
|
332201
332064
|
const isShellFocused = useShellFocusState();
|
|
332202
|
-
const [justNavigatedHistory, setJustNavigatedHistory] = (0,
|
|
332203
|
-
const [escPressCount, setEscPressCount] = (0,
|
|
332204
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
332205
|
-
const escapeTimerRef = (0,
|
|
332206
|
-
const [recentPasteTime, setRecentPasteTime] = (0,
|
|
332207
|
-
const pasteTimeoutRef = (0,
|
|
332208
|
-
const [dirs, setDirs] = (0,
|
|
332065
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = (0, import_react92.useState)(false);
|
|
332066
|
+
const [escPressCount, setEscPressCount] = (0, import_react92.useState)(0);
|
|
332067
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react92.useState)(false);
|
|
332068
|
+
const escapeTimerRef = (0, import_react92.useRef)(null);
|
|
332069
|
+
const [recentPasteTime, setRecentPasteTime] = (0, import_react92.useState)(null);
|
|
332070
|
+
const pasteTimeoutRef = (0, import_react92.useRef)(null);
|
|
332071
|
+
const [dirs, setDirs] = (0, import_react92.useState)(
|
|
332209
332072
|
config.getWorkspaceContext().getDirectories()
|
|
332210
332073
|
);
|
|
332211
332074
|
const dirsChanged = config.getWorkspaceContext().getDirectories();
|
|
332212
|
-
(0,
|
|
332075
|
+
(0, import_react92.useEffect)(() => {
|
|
332213
332076
|
if (dirs.length !== dirsChanged.length) {
|
|
332214
332077
|
setDirs(dirsChanged);
|
|
332215
332078
|
}
|
|
332216
332079
|
}, [dirs.length, dirsChanged]);
|
|
332217
|
-
const [reverseSearchActive, setReverseSearchActive] = (0,
|
|
332218
|
-
const [commandSearchActive, setCommandSearchActive] = (0,
|
|
332219
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0,
|
|
332220
|
-
const [cursorPosition, setCursorPosition] = (0,
|
|
332080
|
+
const [reverseSearchActive, setReverseSearchActive] = (0, import_react92.useState)(false);
|
|
332081
|
+
const [commandSearchActive, setCommandSearchActive] = (0, import_react92.useState)(false);
|
|
332082
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0, import_react92.useState)("");
|
|
332083
|
+
const [cursorPosition, setCursorPosition] = (0, import_react92.useState)([
|
|
332221
332084
|
0,
|
|
332222
332085
|
0
|
|
332223
332086
|
]);
|
|
332224
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0,
|
|
332087
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0, import_react92.useState)(-1);
|
|
332225
332088
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
332226
332089
|
const shellHistoryData = shellHistory.history;
|
|
332227
332090
|
const completion3 = useCommandCompletion(
|
|
@@ -332247,7 +332110,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332247
332110
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
332248
332111
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
332249
332112
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused;
|
|
332250
|
-
const resetEscapeState = (0,
|
|
332113
|
+
const resetEscapeState = (0, import_react92.useCallback)(() => {
|
|
332251
332114
|
if (escapeTimerRef.current) {
|
|
332252
332115
|
clearTimeout(escapeTimerRef.current);
|
|
332253
332116
|
escapeTimerRef.current = null;
|
|
@@ -332255,12 +332118,12 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332255
332118
|
setEscPressCount(0);
|
|
332256
332119
|
setShowEscapePrompt(false);
|
|
332257
332120
|
}, []);
|
|
332258
|
-
(0,
|
|
332121
|
+
(0, import_react92.useEffect)(() => {
|
|
332259
332122
|
if (onEscapePromptChange) {
|
|
332260
332123
|
onEscapePromptChange(showEscapePrompt);
|
|
332261
332124
|
}
|
|
332262
332125
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
332263
|
-
(0,
|
|
332126
|
+
(0, import_react92.useEffect)(
|
|
332264
332127
|
() => () => {
|
|
332265
332128
|
if (escapeTimerRef.current) {
|
|
332266
332129
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -332271,7 +332134,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332271
332134
|
},
|
|
332272
332135
|
[]
|
|
332273
332136
|
);
|
|
332274
|
-
const handleSubmitAndClear = (0,
|
|
332137
|
+
const handleSubmitAndClear = (0, import_react92.useCallback)(
|
|
332275
332138
|
(submittedValue) => {
|
|
332276
332139
|
if (shellModeActive) {
|
|
332277
332140
|
shellHistory.addCommandToHistory(submittedValue);
|
|
@@ -332290,7 +332153,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332290
332153
|
resetReverseSearchCompletionState
|
|
332291
332154
|
]
|
|
332292
332155
|
);
|
|
332293
|
-
const customSetTextAndResetCompletionSignal = (0,
|
|
332156
|
+
const customSetTextAndResetCompletionSignal = (0, import_react92.useCallback)(
|
|
332294
332157
|
(newText) => {
|
|
332295
332158
|
buffer.setText(newText);
|
|
332296
332159
|
setJustNavigatedHistory(true);
|
|
@@ -332304,7 +332167,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332304
332167
|
currentQuery: buffer.text,
|
|
332305
332168
|
onChange: customSetTextAndResetCompletionSignal
|
|
332306
332169
|
});
|
|
332307
|
-
(0,
|
|
332170
|
+
(0, import_react92.useEffect)(() => {
|
|
332308
332171
|
if (justNavigatedHistory) {
|
|
332309
332172
|
resetCompletionState();
|
|
332310
332173
|
resetReverseSearchCompletionState();
|
|
@@ -332320,7 +332183,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332320
332183
|
resetReverseSearchCompletionState,
|
|
332321
332184
|
resetCommandSearchCompletionState
|
|
332322
332185
|
]);
|
|
332323
|
-
const handleClipboardImage = (0,
|
|
332186
|
+
const handleClipboardImage = (0, import_react92.useCallback)(async () => {
|
|
332324
332187
|
try {
|
|
332325
332188
|
if (await clipboardHasImage()) {
|
|
332326
332189
|
const imagePath = await saveClipboardImage(config.getTargetDir());
|
|
@@ -332352,7 +332215,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332352
332215
|
console.error("Error handling clipboard image:", error);
|
|
332353
332216
|
}
|
|
332354
332217
|
}, [buffer, config]);
|
|
332355
|
-
const handleInput = (0,
|
|
332218
|
+
const handleInput = (0, import_react92.useCallback)(
|
|
332356
332219
|
(key) => {
|
|
332357
332220
|
if (!focus && !key.paste) {
|
|
332358
332221
|
return;
|
|
@@ -332528,10 +332391,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332528
332391
|
return;
|
|
332529
332392
|
}
|
|
332530
332393
|
}
|
|
332531
|
-
if (key.name === "tab" && !completion3.showSuggestions && completion3.promptCompletion.text) {
|
|
332532
|
-
completion3.promptCompletion.accept();
|
|
332533
|
-
return;
|
|
332534
|
-
}
|
|
332535
332394
|
if (!shellModeActive) {
|
|
332536
332395
|
if (keyMatchers["reverseSearch" /* REVERSE_SEARCH */](key)) {
|
|
332537
332396
|
setCommandSearchActive(true);
|
|
@@ -332624,10 +332483,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332624
332483
|
return;
|
|
332625
332484
|
}
|
|
332626
332485
|
buffer.handleInput(key);
|
|
332627
|
-
if (completion3.promptCompletion.text && key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
332628
|
-
completion3.promptCompletion.clear();
|
|
332629
|
-
setExpandedSuggestionIndex(-1);
|
|
332630
|
-
}
|
|
332631
332486
|
},
|
|
332632
332487
|
[
|
|
332633
332488
|
focus,
|
|
@@ -332658,101 +332513,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332658
332513
|
const linesToRender = buffer.viewportVisualLines;
|
|
332659
332514
|
const [cursorVisualRowAbsolute, cursorVisualColAbsolute] = buffer.visualCursor;
|
|
332660
332515
|
const scrollVisualRow = buffer.visualScrollRow;
|
|
332661
|
-
const getGhostTextLines = (0, import_react93.useCallback)(() => {
|
|
332662
|
-
if (!completion3.promptCompletion.text || !buffer.text || !completion3.promptCompletion.text.startsWith(buffer.text)) {
|
|
332663
|
-
return { inlineGhost: "", additionalLines: [] };
|
|
332664
|
-
}
|
|
332665
|
-
const ghostSuffix = completion3.promptCompletion.text.slice(
|
|
332666
|
-
buffer.text.length
|
|
332667
|
-
);
|
|
332668
|
-
if (!ghostSuffix) {
|
|
332669
|
-
return { inlineGhost: "", additionalLines: [] };
|
|
332670
|
-
}
|
|
332671
|
-
const currentLogicalLine = buffer.lines[buffer.cursor[0]] || "";
|
|
332672
|
-
const cursorCol = buffer.cursor[1];
|
|
332673
|
-
const textBeforeCursor = cpSlice(currentLogicalLine, 0, cursorCol);
|
|
332674
|
-
const usedWidth = stringWidth4(textBeforeCursor);
|
|
332675
|
-
const remainingWidth = Math.max(0, inputWidth - usedWidth);
|
|
332676
|
-
const ghostTextLinesRaw = ghostSuffix.split("\n");
|
|
332677
|
-
const firstLineRaw = ghostTextLinesRaw.shift() || "";
|
|
332678
|
-
let inlineGhost2 = "";
|
|
332679
|
-
let remainingFirstLine = "";
|
|
332680
|
-
if (stringWidth4(firstLineRaw) <= remainingWidth) {
|
|
332681
|
-
inlineGhost2 = firstLineRaw;
|
|
332682
|
-
} else {
|
|
332683
|
-
const words = firstLineRaw.split(" ");
|
|
332684
|
-
let currentLine = "";
|
|
332685
|
-
let wordIdx = 0;
|
|
332686
|
-
for (const word of words) {
|
|
332687
|
-
const prospectiveLine = currentLine ? `${currentLine} ${word}` : word;
|
|
332688
|
-
if (stringWidth4(prospectiveLine) > remainingWidth) {
|
|
332689
|
-
break;
|
|
332690
|
-
}
|
|
332691
|
-
currentLine = prospectiveLine;
|
|
332692
|
-
wordIdx++;
|
|
332693
|
-
}
|
|
332694
|
-
inlineGhost2 = currentLine;
|
|
332695
|
-
if (words.length > wordIdx) {
|
|
332696
|
-
remainingFirstLine = words.slice(wordIdx).join(" ");
|
|
332697
|
-
}
|
|
332698
|
-
}
|
|
332699
|
-
const linesToWrap = [];
|
|
332700
|
-
if (remainingFirstLine) {
|
|
332701
|
-
linesToWrap.push(remainingFirstLine);
|
|
332702
|
-
}
|
|
332703
|
-
linesToWrap.push(...ghostTextLinesRaw);
|
|
332704
|
-
const remainingGhostText = linesToWrap.join("\n");
|
|
332705
|
-
const additionalLines2 = [];
|
|
332706
|
-
if (remainingGhostText) {
|
|
332707
|
-
const textLines = remainingGhostText.split("\n");
|
|
332708
|
-
for (const textLine of textLines) {
|
|
332709
|
-
const words = textLine.split(" ");
|
|
332710
|
-
let currentLine = "";
|
|
332711
|
-
for (const word of words) {
|
|
332712
|
-
const prospectiveLine = currentLine ? `${currentLine} ${word}` : word;
|
|
332713
|
-
const prospectiveWidth = stringWidth4(prospectiveLine);
|
|
332714
|
-
if (prospectiveWidth > inputWidth) {
|
|
332715
|
-
if (currentLine) {
|
|
332716
|
-
additionalLines2.push(currentLine);
|
|
332717
|
-
}
|
|
332718
|
-
let wordToProcess = word;
|
|
332719
|
-
while (stringWidth4(wordToProcess) > inputWidth) {
|
|
332720
|
-
let part = "";
|
|
332721
|
-
const wordCP = toCodePoints(wordToProcess);
|
|
332722
|
-
let partWidth = 0;
|
|
332723
|
-
let splitIndex = 0;
|
|
332724
|
-
for (let i = 0; i < wordCP.length; i++) {
|
|
332725
|
-
const char = wordCP[i];
|
|
332726
|
-
const charWidth = stringWidth4(char);
|
|
332727
|
-
if (partWidth + charWidth > inputWidth) {
|
|
332728
|
-
break;
|
|
332729
|
-
}
|
|
332730
|
-
part += char;
|
|
332731
|
-
partWidth += charWidth;
|
|
332732
|
-
splitIndex = i + 1;
|
|
332733
|
-
}
|
|
332734
|
-
additionalLines2.push(part);
|
|
332735
|
-
wordToProcess = cpSlice(wordToProcess, splitIndex);
|
|
332736
|
-
}
|
|
332737
|
-
currentLine = wordToProcess;
|
|
332738
|
-
} else {
|
|
332739
|
-
currentLine = prospectiveLine;
|
|
332740
|
-
}
|
|
332741
|
-
}
|
|
332742
|
-
if (currentLine) {
|
|
332743
|
-
additionalLines2.push(currentLine);
|
|
332744
|
-
}
|
|
332745
|
-
}
|
|
332746
|
-
}
|
|
332747
|
-
return { inlineGhost: inlineGhost2, additionalLines: additionalLines2 };
|
|
332748
|
-
}, [
|
|
332749
|
-
completion3.promptCompletion.text,
|
|
332750
|
-
buffer.text,
|
|
332751
|
-
buffer.lines,
|
|
332752
|
-
buffer.cursor,
|
|
332753
|
-
inputWidth
|
|
332754
|
-
]);
|
|
332755
|
-
const { inlineGhost, additionalLines } = getGhostTextLines();
|
|
332756
332516
|
const getActiveCompletion = /* @__PURE__ */ __name(() => {
|
|
332757
332517
|
if (commandSearchActive) return commandSearchCompletion;
|
|
332758
332518
|
if (reverseSearchActive) return reverseSearchCompletion;
|
|
@@ -332856,39 +332616,13 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
332856
332616
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color, children: display }, `token-${segIdx}`)
|
|
332857
332617
|
);
|
|
332858
332618
|
});
|
|
332859
|
-
const currentLineGhost = isOnCursorLine ? inlineGhost : "";
|
|
332860
332619
|
if (isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText)) {
|
|
332861
|
-
|
|
332862
|
-
|
|
332863
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
|
|
332864
|
-
);
|
|
332865
|
-
}
|
|
332866
|
-
}
|
|
332867
|
-
const showCursorBeforeGhost = focus && isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText) && currentLineGhost;
|
|
332868
|
-
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Text, { children: [
|
|
332869
|
-
renderedLine,
|
|
332870
|
-
showCursorBeforeGhost && (showCursor ? import_chalk7.default.inverse(" ") : " "),
|
|
332871
|
-
currentLineGhost && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color: theme.text.secondary, children: currentLineGhost })
|
|
332872
|
-
] }) }, `line-${visualIdxInRenderedSet}`);
|
|
332873
|
-
}).concat(
|
|
332874
|
-
additionalLines.map((ghostLine, index) => {
|
|
332875
|
-
const padding = Math.max(
|
|
332876
|
-
0,
|
|
332877
|
-
inputWidth - stringWidth4(ghostLine)
|
|
332878
|
-
);
|
|
332879
|
-
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
332880
|
-
Text,
|
|
332881
|
-
{
|
|
332882
|
-
color: theme.text.secondary,
|
|
332883
|
-
children: [
|
|
332884
|
-
ghostLine,
|
|
332885
|
-
" ".repeat(padding)
|
|
332886
|
-
]
|
|
332887
|
-
},
|
|
332888
|
-
`ghost-line-${index}`
|
|
332620
|
+
renderedLine.push(
|
|
332621
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
|
|
332889
332622
|
);
|
|
332890
|
-
}
|
|
332891
|
-
|
|
332623
|
+
}
|
|
332624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { children: renderedLine }) }, `line-${visualIdxInRenderedSet}`);
|
|
332625
|
+
}) })
|
|
332892
332626
|
]
|
|
332893
332627
|
}
|
|
332894
332628
|
),
|
|
@@ -332937,15 +332671,15 @@ import process31 from "node:process";
|
|
|
332937
332671
|
|
|
332938
332672
|
// packages/cli/src/ui/components/MemoryUsageDisplay.tsx
|
|
332939
332673
|
init_esbuild_shims();
|
|
332940
|
-
var
|
|
332674
|
+
var import_react93 = __toESM(require_react(), 1);
|
|
332941
332675
|
import process30 from "node:process";
|
|
332942
332676
|
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
332943
332677
|
var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
332944
|
-
const [memoryUsage, setMemoryUsage] = (0,
|
|
332945
|
-
const [memoryUsageColor, setMemoryUsageColor] = (0,
|
|
332678
|
+
const [memoryUsage, setMemoryUsage] = (0, import_react93.useState)("");
|
|
332679
|
+
const [memoryUsageColor, setMemoryUsageColor] = (0, import_react93.useState)(
|
|
332946
332680
|
theme.text.secondary
|
|
332947
332681
|
);
|
|
332948
|
-
(0,
|
|
332682
|
+
(0, import_react93.useEffect)(() => {
|
|
332949
332683
|
const updateMemory = /* @__PURE__ */ __name(() => {
|
|
332950
332684
|
const usage2 = process30.memoryUsage().rss;
|
|
332951
332685
|
setMemoryUsage(formatMemoryUsage2(usage2));
|
|
@@ -332984,12 +332718,12 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
332984
332718
|
|
|
332985
332719
|
// packages/cli/src/ui/components/DebugProfiler.tsx
|
|
332986
332720
|
init_esbuild_shims();
|
|
332987
|
-
var
|
|
332721
|
+
var import_react94 = __toESM(require_react(), 1);
|
|
332988
332722
|
var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
|
|
332989
332723
|
var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
332990
|
-
const numRenders = (0,
|
|
332991
|
-
const [showNumRenders, setShowNumRenders] = (0,
|
|
332992
|
-
(0,
|
|
332724
|
+
const numRenders = (0, import_react94.useRef)(0);
|
|
332725
|
+
const [showNumRenders, setShowNumRenders] = (0, import_react94.useState)(false);
|
|
332726
|
+
(0, import_react94.useEffect)(() => {
|
|
332993
332727
|
numRenders.current++;
|
|
332994
332728
|
});
|
|
332995
332729
|
useKeypress(
|
|
@@ -333165,7 +332899,7 @@ var QueuedMessageDisplay = /* @__PURE__ */ __name(({
|
|
|
333165
332899
|
|
|
333166
332900
|
// packages/cli/src/ui/components/ConfigInitDisplay.tsx
|
|
333167
332901
|
init_esbuild_shims();
|
|
333168
|
-
var
|
|
332902
|
+
var import_react95 = __toESM(require_react(), 1);
|
|
333169
332903
|
|
|
333170
332904
|
// packages/cli/src/utils/events.ts
|
|
333171
332905
|
init_esbuild_shims();
|
|
@@ -333176,8 +332910,8 @@ var appEvents = new EventEmitter8();
|
|
|
333176
332910
|
var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
|
|
333177
332911
|
var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
333178
332912
|
const config = useConfig();
|
|
333179
|
-
const [message, setMessage] = (0,
|
|
333180
|
-
(0,
|
|
332913
|
+
const [message, setMessage] = (0, import_react95.useState)("Initializing...");
|
|
332914
|
+
(0, import_react95.useEffect)(() => {
|
|
333181
332915
|
const onChange = /* @__PURE__ */ __name((clients) => {
|
|
333182
332916
|
if (!clients || clients.size === 0) {
|
|
333183
332917
|
setMessage(`Initializing...`);
|
|
@@ -333216,7 +332950,7 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
333216
332950
|
const isNarrow = isNarrowWidth(terminalWidth);
|
|
333217
332951
|
const debugConsoleMaxHeight = Math.floor(Math.max(terminalWidth * 0.2, 5));
|
|
333218
332952
|
const { contextFileNames, showAutoAcceptIndicator } = uiState;
|
|
333219
|
-
const { containerWidth } = (0,
|
|
332953
|
+
const { containerWidth } = (0, import_react96.useMemo)(
|
|
333220
332954
|
() => calculatePromptWidths(uiState.terminalWidth),
|
|
333221
332955
|
[uiState.terminalWidth]
|
|
333222
332956
|
);
|
|
@@ -339294,7 +339028,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
339294
339028
|
// packages/cli/src/utils/version.ts
|
|
339295
339029
|
async function getCliVersion() {
|
|
339296
339030
|
const pkgJson = await getPackageJson();
|
|
339297
|
-
return "0.2.
|
|
339031
|
+
return "0.2.3-nightly.20251120.442a9aed";
|
|
339298
339032
|
}
|
|
339299
339033
|
__name(getCliVersion, "getCliVersion");
|
|
339300
339034
|
|
|
@@ -340255,7 +339989,6 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, s
|
|
|
340255
339989
|
useBuiltinRipgrep: settings.tools?.useBuiltinRipgrep,
|
|
340256
339990
|
shouldUseNodePtyShell: settings.tools?.shell?.enableInteractiveShell,
|
|
340257
339991
|
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
|
340258
|
-
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
|
340259
339992
|
skipLoopDetection: settings.model?.skipLoopDetection ?? false,
|
|
340260
339993
|
skipStartupContext: settings.model?.skipStartupContext ?? false,
|
|
340261
339994
|
vlmSwitchMode,
|
|
@@ -340337,12 +340070,12 @@ import process50 from "node:process";
|
|
|
340337
340070
|
|
|
340338
340071
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
340339
340072
|
init_esbuild_shims();
|
|
340340
|
-
var
|
|
340073
|
+
var import_react97 = __toESM(require_react(), 1);
|
|
340341
340074
|
import process33 from "node:process";
|
|
340342
340075
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
340343
340076
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
340344
340077
|
var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
340345
|
-
(0,
|
|
340078
|
+
(0, import_react97.useEffect)(() => {
|
|
340346
340079
|
const intervalId = setInterval(() => {
|
|
340347
340080
|
const usage2 = process33.memoryUsage().rss;
|
|
340348
340081
|
if (usage2 > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -340362,11 +340095,11 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
|
340362
340095
|
|
|
340363
340096
|
// packages/cli/src/ui/hooks/useThemeCommand.ts
|
|
340364
340097
|
init_esbuild_shims();
|
|
340365
|
-
var
|
|
340098
|
+
var import_react98 = __toESM(require_react(), 1);
|
|
340366
340099
|
import process34 from "node:process";
|
|
340367
340100
|
var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
340368
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0,
|
|
340369
|
-
const openThemeDialog = (0,
|
|
340101
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react98.useState)(!!initialThemeError);
|
|
340102
|
+
const openThemeDialog = (0, import_react98.useCallback)(() => {
|
|
340370
340103
|
if (process34.env["NO_COLOR"]) {
|
|
340371
340104
|
addItem(
|
|
340372
340105
|
{
|
|
@@ -340379,7 +340112,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
340379
340112
|
}
|
|
340380
340113
|
setIsThemeDialogOpen(true);
|
|
340381
340114
|
}, [addItem]);
|
|
340382
|
-
const applyTheme = (0,
|
|
340115
|
+
const applyTheme = (0, import_react98.useCallback)(
|
|
340383
340116
|
(themeName) => {
|
|
340384
340117
|
if (!themeManager.setActiveTheme(themeName)) {
|
|
340385
340118
|
setIsThemeDialogOpen(true);
|
|
@@ -340390,13 +340123,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
340390
340123
|
},
|
|
340391
340124
|
[setThemeError]
|
|
340392
340125
|
);
|
|
340393
|
-
const handleThemeHighlight = (0,
|
|
340126
|
+
const handleThemeHighlight = (0, import_react98.useCallback)(
|
|
340394
340127
|
(themeName) => {
|
|
340395
340128
|
applyTheme(themeName);
|
|
340396
340129
|
},
|
|
340397
340130
|
[applyTheme]
|
|
340398
340131
|
);
|
|
340399
|
-
const handleThemeSelect = (0,
|
|
340132
|
+
const handleThemeSelect = (0, import_react98.useCallback)(
|
|
340400
340133
|
(themeName, scope) => {
|
|
340401
340134
|
try {
|
|
340402
340135
|
const mergedCustomThemes = {
|
|
@@ -340432,19 +340165,19 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
340432
340165
|
|
|
340433
340166
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
340434
340167
|
init_esbuild_shims();
|
|
340435
|
-
var
|
|
340168
|
+
var import_react100 = __toESM(require_react(), 1);
|
|
340436
340169
|
|
|
340437
340170
|
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
340438
340171
|
init_esbuild_shims();
|
|
340439
|
-
var
|
|
340172
|
+
var import_react99 = __toESM(require_react(), 1);
|
|
340440
340173
|
var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
340441
|
-
const [qwenAuthState, setQwenAuthState] = (0,
|
|
340174
|
+
const [qwenAuthState, setQwenAuthState] = (0, import_react99.useState)({
|
|
340442
340175
|
deviceAuth: null,
|
|
340443
340176
|
authStatus: "idle",
|
|
340444
340177
|
authMessage: null
|
|
340445
340178
|
});
|
|
340446
340179
|
const isQwenAuth = pendingAuthType === AuthType2.QWEN_OAUTH;
|
|
340447
|
-
(0,
|
|
340180
|
+
(0, import_react99.useEffect)(() => {
|
|
340448
340181
|
if (!isQwenAuth || !isAuthenticating) {
|
|
340449
340182
|
setQwenAuthState({
|
|
340450
340183
|
deviceAuth: null,
|
|
@@ -340484,7 +340217,7 @@ var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) =>
|
|
|
340484
340217
|
qwenOAuth2Events.off(QwenOAuth2Event.AuthProgress, handleAuthProgress);
|
|
340485
340218
|
};
|
|
340486
340219
|
}, [isQwenAuth, isAuthenticating]);
|
|
340487
|
-
const cancelQwenAuth = (0,
|
|
340220
|
+
const cancelQwenAuth = (0, import_react99.useCallback)(() => {
|
|
340488
340221
|
qwenOAuth2Events.emit(QwenOAuth2Event.AuthCancel);
|
|
340489
340222
|
setQwenAuthState({
|
|
340490
340223
|
deviceAuth: null,
|
|
@@ -340499,22 +340232,22 @@ var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) =>
|
|
|
340499
340232
|
}, "useQwenAuth");
|
|
340500
340233
|
|
|
340501
340234
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
340502
|
-
var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
340235
|
+
var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
340503
340236
|
const unAuthenticated = settings.merged.security?.auth?.selectedType === void 0;
|
|
340504
|
-
const [authState, setAuthState] = (0,
|
|
340237
|
+
const [authState, setAuthState] = (0, import_react100.useState)(
|
|
340505
340238
|
unAuthenticated ? "updating" /* Updating */ : "unauthenticated" /* Unauthenticated */
|
|
340506
340239
|
);
|
|
340507
|
-
const [authError, setAuthError] = (0,
|
|
340508
|
-
const [isAuthenticating, setIsAuthenticating] = (0,
|
|
340509
|
-
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0,
|
|
340510
|
-
const [pendingAuthType, setPendingAuthType] = (0,
|
|
340240
|
+
const [authError, setAuthError] = (0, import_react100.useState)(null);
|
|
340241
|
+
const [isAuthenticating, setIsAuthenticating] = (0, import_react100.useState)(false);
|
|
340242
|
+
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react100.useState)(unAuthenticated);
|
|
340243
|
+
const [pendingAuthType, setPendingAuthType] = (0, import_react100.useState)(
|
|
340511
340244
|
void 0
|
|
340512
340245
|
);
|
|
340513
340246
|
const { qwenAuthState, cancelQwenAuth } = useQwenAuth(
|
|
340514
340247
|
pendingAuthType,
|
|
340515
340248
|
isAuthenticating
|
|
340516
340249
|
);
|
|
340517
|
-
const onAuthError = (0,
|
|
340250
|
+
const onAuthError = (0, import_react100.useCallback)(
|
|
340518
340251
|
(error) => {
|
|
340519
340252
|
setAuthError(error);
|
|
340520
340253
|
if (error) {
|
|
@@ -340524,7 +340257,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340524
340257
|
},
|
|
340525
340258
|
[setAuthError, setAuthState]
|
|
340526
340259
|
);
|
|
340527
|
-
const handleAuthFailure = (0,
|
|
340260
|
+
const handleAuthFailure = (0, import_react100.useCallback)(
|
|
340528
340261
|
(error) => {
|
|
340529
340262
|
setIsAuthenticating(false);
|
|
340530
340263
|
const errorMessage = `Failed to authenticate. Message: ${getErrorMessage(error)}`;
|
|
@@ -340541,7 +340274,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340541
340274
|
},
|
|
340542
340275
|
[onAuthError, pendingAuthType, config]
|
|
340543
340276
|
);
|
|
340544
|
-
const handleAuthSuccess = (0,
|
|
340277
|
+
const handleAuthSuccess = (0, import_react100.useCallback)(
|
|
340545
340278
|
async (authType, scope, credentials) => {
|
|
340546
340279
|
try {
|
|
340547
340280
|
settings.setValue(scope, "security.auth.selectedType", authType);
|
|
@@ -340576,10 +340309,17 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340576
340309
|
setIsAuthenticating(false);
|
|
340577
340310
|
const authEvent = new AuthEvent(authType, "manual", "success");
|
|
340578
340311
|
logAuth(config, authEvent);
|
|
340312
|
+
addItem(
|
|
340313
|
+
{
|
|
340314
|
+
type: "info" /* INFO */,
|
|
340315
|
+
text: `Authenticated successfully with ${authType} credentials.`
|
|
340316
|
+
},
|
|
340317
|
+
Date.now()
|
|
340318
|
+
);
|
|
340579
340319
|
},
|
|
340580
|
-
[settings, handleAuthFailure, config]
|
|
340320
|
+
[settings, handleAuthFailure, config, addItem]
|
|
340581
340321
|
);
|
|
340582
|
-
const performAuth = (0,
|
|
340322
|
+
const performAuth = (0, import_react100.useCallback)(
|
|
340583
340323
|
async (authType, scope, credentials) => {
|
|
340584
340324
|
try {
|
|
340585
340325
|
await config.refreshAuth(authType);
|
|
@@ -340590,7 +340330,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340590
340330
|
},
|
|
340591
340331
|
[config, handleAuthSuccess, handleAuthFailure]
|
|
340592
340332
|
);
|
|
340593
|
-
const handleAuthSelect = (0,
|
|
340333
|
+
const handleAuthSelect = (0, import_react100.useCallback)(
|
|
340594
340334
|
async (authType, scope, credentials) => {
|
|
340595
340335
|
if (!authType) {
|
|
340596
340336
|
setIsAuthDialogOpen(false);
|
|
@@ -340616,10 +340356,10 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340616
340356
|
},
|
|
340617
340357
|
[config, performAuth]
|
|
340618
340358
|
);
|
|
340619
|
-
const openAuthDialog = (0,
|
|
340359
|
+
const openAuthDialog = (0, import_react100.useCallback)(() => {
|
|
340620
340360
|
setIsAuthDialogOpen(true);
|
|
340621
340361
|
}, []);
|
|
340622
|
-
const cancelAuthentication = (0,
|
|
340362
|
+
const cancelAuthentication = (0, import_react100.useCallback)(() => {
|
|
340623
340363
|
if (isAuthenticating && pendingAuthType === AuthType2.QWEN_OAUTH) {
|
|
340624
340364
|
cancelQwenAuth();
|
|
340625
340365
|
}
|
|
@@ -340631,7 +340371,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340631
340371
|
setIsAuthDialogOpen(true);
|
|
340632
340372
|
setAuthError(null);
|
|
340633
340373
|
}, [isAuthenticating, pendingAuthType, cancelQwenAuth, config]);
|
|
340634
|
-
(0,
|
|
340374
|
+
(0, import_react100.useEffect)(() => {
|
|
340635
340375
|
const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
|
|
340636
340376
|
if (defaultAuthType && ![AuthType2.QWEN_OAUTH, AuthType2.USE_OPENAI].includes(
|
|
340637
340377
|
defaultAuthType
|
|
@@ -340658,7 +340398,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
340658
340398
|
|
|
340659
340399
|
// packages/cli/src/ui/hooks/useQuotaAndFallback.ts
|
|
340660
340400
|
init_esbuild_shims();
|
|
340661
|
-
var
|
|
340401
|
+
var import_react101 = __toESM(require_react(), 1);
|
|
340662
340402
|
function useQuotaAndFallback({
|
|
340663
340403
|
config,
|
|
340664
340404
|
historyManager,
|
|
@@ -340666,9 +340406,9 @@ function useQuotaAndFallback({
|
|
|
340666
340406
|
setAuthState,
|
|
340667
340407
|
setModelSwitchedFromQuotaError
|
|
340668
340408
|
}) {
|
|
340669
|
-
const [proQuotaRequest, setProQuotaRequest] = (0,
|
|
340670
|
-
const isDialogPending = (0,
|
|
340671
|
-
(0,
|
|
340409
|
+
const [proQuotaRequest, setProQuotaRequest] = (0, import_react101.useState)(null);
|
|
340410
|
+
const isDialogPending = (0, import_react101.useRef)(false);
|
|
340411
|
+
(0, import_react101.useEffect)(() => {
|
|
340672
340412
|
const fallbackHandler = /* @__PURE__ */ __name(async (failedModel, fallbackModel, error) => {
|
|
340673
340413
|
if (config.isInFallbackMode()) {
|
|
340674
340414
|
return null;
|
|
@@ -340746,7 +340486,7 @@ function useQuotaAndFallback({
|
|
|
340746
340486
|
}, "fallbackHandler");
|
|
340747
340487
|
config.setFallbackModelHandler(fallbackHandler);
|
|
340748
340488
|
}, [config, historyManager, userTier, setModelSwitchedFromQuotaError]);
|
|
340749
|
-
const handleProQuotaChoice = (0,
|
|
340489
|
+
const handleProQuotaChoice = (0, import_react101.useCallback)(
|
|
340750
340490
|
(choice2) => {
|
|
340751
340491
|
if (!proQuotaRequest) return;
|
|
340752
340492
|
const intent = choice2 === "auth" ? "auth" : "retry";
|
|
@@ -340776,13 +340516,13 @@ __name(useQuotaAndFallback, "useQuotaAndFallback");
|
|
|
340776
340516
|
|
|
340777
340517
|
// packages/cli/src/ui/hooks/useEditorSettings.ts
|
|
340778
340518
|
init_esbuild_shims();
|
|
340779
|
-
var
|
|
340519
|
+
var import_react102 = __toESM(require_react(), 1);
|
|
340780
340520
|
var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
|
|
340781
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0,
|
|
340782
|
-
const openEditorDialog = (0,
|
|
340521
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react102.useState)(false);
|
|
340522
|
+
const openEditorDialog = (0, import_react102.useCallback)(() => {
|
|
340783
340523
|
setIsEditorDialogOpen(true);
|
|
340784
340524
|
}, []);
|
|
340785
|
-
const handleEditorSelect = (0,
|
|
340525
|
+
const handleEditorSelect = (0, import_react102.useCallback)(
|
|
340786
340526
|
(editorType, scope) => {
|
|
340787
340527
|
if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
|
|
340788
340528
|
return;
|
|
@@ -340804,7 +340544,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
340804
340544
|
},
|
|
340805
340545
|
[loadedSettings, setEditorError, addItem]
|
|
340806
340546
|
);
|
|
340807
|
-
const exitEditorDialog = (0,
|
|
340547
|
+
const exitEditorDialog = (0, import_react102.useCallback)(() => {
|
|
340808
340548
|
setIsEditorDialogOpen(false);
|
|
340809
340549
|
}, []);
|
|
340810
340550
|
return {
|
|
@@ -340817,13 +340557,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
340817
340557
|
|
|
340818
340558
|
// packages/cli/src/ui/hooks/useSettingsCommand.ts
|
|
340819
340559
|
init_esbuild_shims();
|
|
340820
|
-
var
|
|
340560
|
+
var import_react103 = __toESM(require_react(), 1);
|
|
340821
340561
|
function useSettingsCommand() {
|
|
340822
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0,
|
|
340823
|
-
const openSettingsDialog = (0,
|
|
340562
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react103.useState)(false);
|
|
340563
|
+
const openSettingsDialog = (0, import_react103.useCallback)(() => {
|
|
340824
340564
|
setIsSettingsDialogOpen(true);
|
|
340825
340565
|
}, []);
|
|
340826
|
-
const closeSettingsDialog = (0,
|
|
340566
|
+
const closeSettingsDialog = (0, import_react103.useCallback)(() => {
|
|
340827
340567
|
setIsSettingsDialogOpen(false);
|
|
340828
340568
|
}, []);
|
|
340829
340569
|
return {
|
|
@@ -340836,13 +340576,13 @@ __name(useSettingsCommand, "useSettingsCommand");
|
|
|
340836
340576
|
|
|
340837
340577
|
// packages/cli/src/ui/hooks/useModelCommand.ts
|
|
340838
340578
|
init_esbuild_shims();
|
|
340839
|
-
var
|
|
340579
|
+
var import_react104 = __toESM(require_react(), 1);
|
|
340840
340580
|
var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
340841
|
-
const [isModelDialogOpen, setIsModelDialogOpen] = (0,
|
|
340842
|
-
const openModelDialog = (0,
|
|
340581
|
+
const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react104.useState)(false);
|
|
340582
|
+
const openModelDialog = (0, import_react104.useCallback)(() => {
|
|
340843
340583
|
setIsModelDialogOpen(true);
|
|
340844
340584
|
}, []);
|
|
340845
|
-
const closeModelDialog = (0,
|
|
340585
|
+
const closeModelDialog = (0, import_react104.useCallback)(() => {
|
|
340846
340586
|
setIsModelDialogOpen(false);
|
|
340847
340587
|
}, []);
|
|
340848
340588
|
return {
|
|
@@ -340854,13 +340594,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
|
340854
340594
|
|
|
340855
340595
|
// packages/cli/src/ui/hooks/useApprovalModeCommand.ts
|
|
340856
340596
|
init_esbuild_shims();
|
|
340857
|
-
var
|
|
340597
|
+
var import_react105 = __toESM(require_react(), 1);
|
|
340858
340598
|
var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
|
|
340859
|
-
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0,
|
|
340860
|
-
const openApprovalModeDialog = (0,
|
|
340599
|
+
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react105.useState)(false);
|
|
340600
|
+
const openApprovalModeDialog = (0, import_react105.useCallback)(() => {
|
|
340861
340601
|
setIsApprovalModeDialogOpen(true);
|
|
340862
340602
|
}, []);
|
|
340863
|
-
const handleApprovalModeSelect = (0,
|
|
340603
|
+
const handleApprovalModeSelect = (0, import_react105.useCallback)(
|
|
340864
340604
|
(mode, scope) => {
|
|
340865
340605
|
try {
|
|
340866
340606
|
if (!mode) {
|
|
@@ -340886,7 +340626,7 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
|
|
|
340886
340626
|
|
|
340887
340627
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
340888
340628
|
init_esbuild_shims();
|
|
340889
|
-
var
|
|
340629
|
+
var import_react108 = __toESM(require_react(), 1);
|
|
340890
340630
|
init_node();
|
|
340891
340631
|
import process37 from "node:process";
|
|
340892
340632
|
|
|
@@ -340981,7 +340721,7 @@ import { execSync as execSync4 } from "node:child_process";
|
|
|
340981
340721
|
|
|
340982
340722
|
// packages/cli/src/generated/git-commit.ts
|
|
340983
340723
|
init_esbuild_shims();
|
|
340984
|
-
var GIT_COMMIT_INFO2 = "
|
|
340724
|
+
var GIT_COMMIT_INFO2 = "67d519a3";
|
|
340985
340725
|
|
|
340986
340726
|
// packages/cli/src/utils/systemInfo.ts
|
|
340987
340727
|
async function getNpmVersion() {
|
|
@@ -341176,7 +340916,7 @@ ${bugReportUrl}`
|
|
|
341176
340916
|
|
|
341177
340917
|
// packages/cli/src/ui/commands/chatCommand.ts
|
|
341178
340918
|
init_esbuild_shims();
|
|
341179
|
-
var
|
|
340919
|
+
var import_react106 = __toESM(require_react(), 1);
|
|
341180
340920
|
import * as fsPromises5 from "node:fs/promises";
|
|
341181
340921
|
import path82 from "node:path";
|
|
341182
340922
|
var getSavedChatTags = /* @__PURE__ */ __name(async (context2, mtSortDesc) => {
|
|
@@ -341263,11 +341003,11 @@ var saveCommand = {
|
|
|
341263
341003
|
if (exists2) {
|
|
341264
341004
|
return {
|
|
341265
341005
|
type: "confirm_action",
|
|
341266
|
-
prompt:
|
|
341006
|
+
prompt: import_react106.default.createElement(
|
|
341267
341007
|
Text,
|
|
341268
341008
|
null,
|
|
341269
341009
|
"A checkpoint with the tag ",
|
|
341270
|
-
|
|
341010
|
+
import_react106.default.createElement(Text, { color: theme.text.accent }, tag2),
|
|
341271
341011
|
" already exists. Do you want to overwrite it?"
|
|
341272
341012
|
),
|
|
341273
341013
|
originalInvocation: {
|
|
@@ -342259,7 +341999,7 @@ var ideCommand = /* @__PURE__ */ __name(async () => {
|
|
|
342259
341999
|
init_esbuild_shims();
|
|
342260
342000
|
import * as fs75 from "node:fs";
|
|
342261
342001
|
import * as path85 from "node:path";
|
|
342262
|
-
var
|
|
342002
|
+
var import_react107 = __toESM(require_react(), 1);
|
|
342263
342003
|
var initCommand = {
|
|
342264
342004
|
name: "init",
|
|
342265
342005
|
description: "Analyzes the project and creates a tailored QWEN.md file.",
|
|
@@ -342285,7 +342025,7 @@ var initCommand = {
|
|
|
342285
342025
|
type: "confirm_action",
|
|
342286
342026
|
// TODO: Move to .tsx file to use JSX syntax instead of React.createElement
|
|
342287
342027
|
// For now, using React.createElement to maintain .ts compatibility for PR review
|
|
342288
|
-
prompt:
|
|
342028
|
+
prompt: import_react107.default.createElement(
|
|
342289
342029
|
Text,
|
|
342290
342030
|
null,
|
|
342291
342031
|
`A ${contextFileName} file already exists in this directory. Do you want to regenerate it?`
|
|
@@ -344778,41 +344518,41 @@ var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
|
344778
344518
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
344779
344519
|
var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized) => {
|
|
344780
344520
|
const session = useSessionStats();
|
|
344781
|
-
const [commands, setCommands] = (0,
|
|
344782
|
-
const [reloadTrigger, setReloadTrigger] = (0,
|
|
344783
|
-
const reloadCommands = (0,
|
|
344521
|
+
const [commands, setCommands] = (0, import_react108.useState)([]);
|
|
344522
|
+
const [reloadTrigger, setReloadTrigger] = (0, import_react108.useState)(0);
|
|
344523
|
+
const reloadCommands = (0, import_react108.useCallback)(() => {
|
|
344784
344524
|
setReloadTrigger((v) => v + 1);
|
|
344785
344525
|
}, []);
|
|
344786
|
-
const [shellConfirmationRequest, setShellConfirmationRequest] = (0,
|
|
344787
|
-
const [confirmationRequest, setConfirmationRequest] = (0,
|
|
344788
|
-
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0,
|
|
344789
|
-
const [sessionShellAllowlist, setSessionShellAllowlist] = (0,
|
|
344526
|
+
const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react108.useState)(null);
|
|
344527
|
+
const [confirmationRequest, setConfirmationRequest] = (0, import_react108.useState)(null);
|
|
344528
|
+
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0, import_react108.useState)(null);
|
|
344529
|
+
const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react108.useState)(
|
|
344790
344530
|
/* @__PURE__ */ new Set()
|
|
344791
344531
|
);
|
|
344792
|
-
const gitService = (0,
|
|
344532
|
+
const gitService = (0, import_react108.useMemo)(() => {
|
|
344793
344533
|
if (!config?.getProjectRoot()) {
|
|
344794
344534
|
return;
|
|
344795
344535
|
}
|
|
344796
344536
|
return new GitService(config.getProjectRoot(), config.storage);
|
|
344797
344537
|
}, [config]);
|
|
344798
|
-
const logger6 = (0,
|
|
344538
|
+
const logger6 = (0, import_react108.useMemo)(() => {
|
|
344799
344539
|
const l2 = new Logger(
|
|
344800
344540
|
config?.getSessionId() || "",
|
|
344801
344541
|
config?.storage ?? new Storage(process37.cwd())
|
|
344802
344542
|
);
|
|
344803
344543
|
return l2;
|
|
344804
344544
|
}, [config]);
|
|
344805
|
-
const [pendingItem, setPendingItem] = (0,
|
|
344545
|
+
const [pendingItem, setPendingItem] = (0, import_react108.useState)(
|
|
344806
344546
|
null
|
|
344807
344547
|
);
|
|
344808
|
-
const pendingHistoryItems = (0,
|
|
344548
|
+
const pendingHistoryItems = (0, import_react108.useMemo)(() => {
|
|
344809
344549
|
const items = [];
|
|
344810
344550
|
if (pendingItem != null) {
|
|
344811
344551
|
items.push(pendingItem);
|
|
344812
344552
|
}
|
|
344813
344553
|
return items;
|
|
344814
344554
|
}, [pendingItem]);
|
|
344815
|
-
const addMessage = (0,
|
|
344555
|
+
const addMessage = (0, import_react108.useCallback)(
|
|
344816
344556
|
(message) => {
|
|
344817
344557
|
let historyItemContent;
|
|
344818
344558
|
if (message.type === "about" /* ABOUT */) {
|
|
@@ -344868,7 +344608,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
344868
344608
|
},
|
|
344869
344609
|
[addItem]
|
|
344870
344610
|
);
|
|
344871
|
-
const commandContext = (0,
|
|
344611
|
+
const commandContext = (0, import_react108.useMemo)(
|
|
344872
344612
|
() => ({
|
|
344873
344613
|
services: {
|
|
344874
344614
|
config,
|
|
@@ -344920,7 +344660,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
344920
344660
|
extensionsUpdateState
|
|
344921
344661
|
]
|
|
344922
344662
|
);
|
|
344923
|
-
(0,
|
|
344663
|
+
(0, import_react108.useEffect)(() => {
|
|
344924
344664
|
if (!config) {
|
|
344925
344665
|
return;
|
|
344926
344666
|
}
|
|
@@ -344938,7 +344678,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
344938
344678
|
})();
|
|
344939
344679
|
};
|
|
344940
344680
|
}, [config, reloadCommands]);
|
|
344941
|
-
(0,
|
|
344681
|
+
(0, import_react108.useEffect)(() => {
|
|
344942
344682
|
const controller = new AbortController();
|
|
344943
344683
|
const load = /* @__PURE__ */ __name(async () => {
|
|
344944
344684
|
const loaders = [
|
|
@@ -344957,7 +344697,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
344957
344697
|
controller.abort();
|
|
344958
344698
|
};
|
|
344959
344699
|
}, [config, reloadTrigger, isConfigInitialized]);
|
|
344960
|
-
const handleSlashCommand2 = (0,
|
|
344700
|
+
const handleSlashCommand2 = (0, import_react108.useCallback)(
|
|
344961
344701
|
async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed) => {
|
|
344962
344702
|
if (typeof rawQuery !== "string") {
|
|
344963
344703
|
return false;
|
|
@@ -345266,7 +345006,7 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
345266
345006
|
|
|
345267
345007
|
// packages/cli/src/ui/hooks/useConsoleMessages.ts
|
|
345268
345008
|
init_esbuild_shims();
|
|
345269
|
-
var
|
|
345009
|
+
var import_react109 = __toESM(require_react(), 1);
|
|
345270
345010
|
function consoleMessagesReducer(state, action) {
|
|
345271
345011
|
switch (action.type) {
|
|
345272
345012
|
case "ADD_MESSAGES": {
|
|
@@ -345292,11 +345032,11 @@ function consoleMessagesReducer(state, action) {
|
|
|
345292
345032
|
}
|
|
345293
345033
|
__name(consoleMessagesReducer, "consoleMessagesReducer");
|
|
345294
345034
|
function useConsoleMessages() {
|
|
345295
|
-
const [consoleMessages, dispatch] = (0,
|
|
345296
|
-
const messageQueueRef = (0,
|
|
345297
|
-
const timeoutRef = (0,
|
|
345298
|
-
const [, startTransition] = (0,
|
|
345299
|
-
const processQueue = (0,
|
|
345035
|
+
const [consoleMessages, dispatch] = (0, import_react109.useReducer)(consoleMessagesReducer, []);
|
|
345036
|
+
const messageQueueRef = (0, import_react109.useRef)([]);
|
|
345037
|
+
const timeoutRef = (0, import_react109.useRef)(null);
|
|
345038
|
+
const [, startTransition] = (0, import_react109.useTransition)();
|
|
345039
|
+
const processQueue = (0, import_react109.useCallback)(() => {
|
|
345300
345040
|
if (messageQueueRef.current.length > 0) {
|
|
345301
345041
|
const messagesToProcess = messageQueueRef.current;
|
|
345302
345042
|
messageQueueRef.current = [];
|
|
@@ -345306,7 +345046,7 @@ function useConsoleMessages() {
|
|
|
345306
345046
|
}
|
|
345307
345047
|
timeoutRef.current = null;
|
|
345308
345048
|
}, []);
|
|
345309
|
-
const handleNewMessage = (0,
|
|
345049
|
+
const handleNewMessage = (0, import_react109.useCallback)(
|
|
345310
345050
|
(message) => {
|
|
345311
345051
|
messageQueueRef.current.push(message);
|
|
345312
345052
|
if (!timeoutRef.current) {
|
|
@@ -345315,7 +345055,7 @@ function useConsoleMessages() {
|
|
|
345315
345055
|
},
|
|
345316
345056
|
[processQueue]
|
|
345317
345057
|
);
|
|
345318
|
-
const clearConsoleMessages = (0,
|
|
345058
|
+
const clearConsoleMessages = (0, import_react109.useCallback)(() => {
|
|
345319
345059
|
if (timeoutRef.current) {
|
|
345320
345060
|
clearTimeout(timeoutRef.current);
|
|
345321
345061
|
timeoutRef.current = null;
|
|
@@ -345325,7 +345065,7 @@ function useConsoleMessages() {
|
|
|
345325
345065
|
dispatch({ type: "CLEAR" });
|
|
345326
345066
|
});
|
|
345327
345067
|
}, []);
|
|
345328
|
-
(0,
|
|
345068
|
+
(0, import_react109.useEffect)(
|
|
345329
345069
|
() => () => {
|
|
345330
345070
|
if (timeoutRef.current) {
|
|
345331
345071
|
clearTimeout(timeoutRef.current);
|
|
@@ -345355,10 +345095,10 @@ __name(computeWindowTitle, "computeWindowTitle");
|
|
|
345355
345095
|
|
|
345356
345096
|
// packages/cli/src/ui/hooks/useLogger.ts
|
|
345357
345097
|
init_esbuild_shims();
|
|
345358
|
-
var
|
|
345098
|
+
var import_react110 = __toESM(require_react(), 1);
|
|
345359
345099
|
var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
345360
|
-
const [logger6, setLogger] = (0,
|
|
345361
|
-
(0,
|
|
345100
|
+
const [logger6, setLogger] = (0, import_react110.useState)(null);
|
|
345101
|
+
(0, import_react110.useEffect)(() => {
|
|
345362
345102
|
const newLogger = new Logger(sessionId, storage);
|
|
345363
345103
|
newLogger.initialize().then(() => {
|
|
345364
345104
|
setLogger(newLogger);
|
|
@@ -345370,12 +345110,12 @@ var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
|
345370
345110
|
|
|
345371
345111
|
// packages/cli/src/ui/hooks/useGeminiStream.ts
|
|
345372
345112
|
init_esbuild_shims();
|
|
345373
|
-
var
|
|
345113
|
+
var import_react115 = __toESM(require_react(), 1);
|
|
345374
345114
|
init_node();
|
|
345375
345115
|
|
|
345376
345116
|
// packages/cli/src/ui/hooks/shellCommandProcessor.ts
|
|
345377
345117
|
init_esbuild_shims();
|
|
345378
|
-
var
|
|
345118
|
+
var import_react111 = __toESM(require_react(), 1);
|
|
345379
345119
|
init_node();
|
|
345380
345120
|
import crypto17 from "node:crypto";
|
|
345381
345121
|
import path92 from "node:path";
|
|
@@ -345404,8 +345144,8 @@ ${modelContent}
|
|
|
345404
345144
|
}
|
|
345405
345145
|
__name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
|
|
345406
345146
|
var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
|
|
345407
|
-
const [activeShellPtyId, setActiveShellPtyId] = (0,
|
|
345408
|
-
const handleShellCommand = (0,
|
|
345147
|
+
const [activeShellPtyId, setActiveShellPtyId] = (0, import_react111.useState)(null);
|
|
345148
|
+
const handleShellCommand = (0, import_react111.useCallback)(
|
|
345409
345149
|
(rawQuery, abortSignal) => {
|
|
345410
345150
|
if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
|
|
345411
345151
|
return false;
|
|
@@ -345654,7 +345394,7 @@ ${finalOutput}`;
|
|
|
345654
345394
|
// packages/cli/src/ui/hooks/useVisionAutoSwitch.ts
|
|
345655
345395
|
init_esbuild_shims();
|
|
345656
345396
|
init_node();
|
|
345657
|
-
var
|
|
345397
|
+
var import_react112 = __toESM(require_react(), 1);
|
|
345658
345398
|
function hasImageParts(parts) {
|
|
345659
345399
|
if (typeof parts === "string") {
|
|
345660
345400
|
return false;
|
|
@@ -345743,8 +345483,8 @@ function processVisionSwitchOutcome(outcome) {
|
|
|
345743
345483
|
}
|
|
345744
345484
|
__name(processVisionSwitchOutcome, "processVisionSwitchOutcome");
|
|
345745
345485
|
function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true, onVisionSwitchRequired) {
|
|
345746
|
-
const originalModelRef = (0,
|
|
345747
|
-
const handleVisionSwitch = (0,
|
|
345486
|
+
const originalModelRef = (0, import_react112.useRef)(null);
|
|
345487
|
+
const handleVisionSwitch = (0, import_react112.useCallback)(
|
|
345748
345488
|
async (query, userMessageTimestamp, isContinuation) => {
|
|
345749
345489
|
if (isContinuation || !onVisionSwitchRequired) {
|
|
345750
345490
|
return { shouldProceed: true };
|
|
@@ -345845,7 +345585,7 @@ function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true,
|
|
|
345845
345585
|
},
|
|
345846
345586
|
[config, addItem, visionModelPreviewEnabled, onVisionSwitchRequired]
|
|
345847
345587
|
);
|
|
345848
|
-
const restoreOriginalModel = (0,
|
|
345588
|
+
const restoreOriginalModel = (0, import_react112.useCallback)(async () => {
|
|
345849
345589
|
if (originalModelRef.current) {
|
|
345850
345590
|
await config.setModel(originalModelRef.current, {
|
|
345851
345591
|
reason: "vision_auto_switch",
|
|
@@ -346260,11 +346000,11 @@ var findLastSafeSplitPoint = /* @__PURE__ */ __name((content) => {
|
|
|
346260
346000
|
|
|
346261
346001
|
// packages/cli/src/ui/hooks/useStateAndRef.ts
|
|
346262
346002
|
init_esbuild_shims();
|
|
346263
|
-
var
|
|
346003
|
+
var import_react113 = __toESM(require_react(), 1);
|
|
346264
346004
|
var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
346265
|
-
const [state, setState] =
|
|
346266
|
-
const ref =
|
|
346267
|
-
const setStateInternal =
|
|
346005
|
+
const [state, setState] = import_react113.default.useState(initialValue);
|
|
346006
|
+
const ref = import_react113.default.useRef(initialValue);
|
|
346007
|
+
const setStateInternal = import_react113.default.useCallback(
|
|
346268
346008
|
(newStateOrCallback) => {
|
|
346269
346009
|
let newValue;
|
|
346270
346010
|
if (typeof newStateOrCallback === "function") {
|
|
@@ -346282,10 +346022,10 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
|
346282
346022
|
|
|
346283
346023
|
// packages/cli/src/ui/hooks/useReactToolScheduler.ts
|
|
346284
346024
|
init_esbuild_shims();
|
|
346285
|
-
var
|
|
346025
|
+
var import_react114 = __toESM(require_react(), 1);
|
|
346286
346026
|
function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
|
|
346287
|
-
const [toolCallsForDisplay, setToolCallsForDisplay] = (0,
|
|
346288
|
-
const outputUpdateHandler = (0,
|
|
346027
|
+
const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react114.useState)([]);
|
|
346028
|
+
const outputUpdateHandler = (0, import_react114.useCallback)(
|
|
346289
346029
|
(toolCallId, outputChunk) => {
|
|
346290
346030
|
setToolCallsForDisplay(
|
|
346291
346031
|
(prevCalls) => prevCalls.map((tc) => {
|
|
@@ -346299,13 +346039,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
346299
346039
|
},
|
|
346300
346040
|
[]
|
|
346301
346041
|
);
|
|
346302
|
-
const allToolCallsCompleteHandler = (0,
|
|
346042
|
+
const allToolCallsCompleteHandler = (0, import_react114.useCallback)(
|
|
346303
346043
|
async (completedToolCalls) => {
|
|
346304
346044
|
await onComplete(completedToolCalls);
|
|
346305
346045
|
},
|
|
346306
346046
|
[onComplete]
|
|
346307
346047
|
);
|
|
346308
|
-
const toolCallsUpdateHandler = (0,
|
|
346048
|
+
const toolCallsUpdateHandler = (0, import_react114.useCallback)(
|
|
346309
346049
|
(updatedCoreToolCalls) => {
|
|
346310
346050
|
setToolCallsForDisplay(
|
|
346311
346051
|
(prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
|
|
@@ -346332,7 +346072,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
346332
346072
|
},
|
|
346333
346073
|
[setToolCallsForDisplay]
|
|
346334
346074
|
);
|
|
346335
|
-
const scheduler = (0,
|
|
346075
|
+
const scheduler = (0, import_react114.useMemo)(
|
|
346336
346076
|
() => new CoreToolScheduler({
|
|
346337
346077
|
outputUpdateHandler,
|
|
346338
346078
|
onAllToolCallsComplete: allToolCallsCompleteHandler,
|
|
@@ -346351,13 +346091,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
346351
346091
|
onEditorClose
|
|
346352
346092
|
]
|
|
346353
346093
|
);
|
|
346354
|
-
const schedule = (0,
|
|
346094
|
+
const schedule = (0, import_react114.useCallback)(
|
|
346355
346095
|
(request4, signal) => {
|
|
346356
346096
|
void scheduler.schedule(request4, signal);
|
|
346357
346097
|
},
|
|
346358
346098
|
[scheduler]
|
|
346359
346099
|
);
|
|
346360
|
-
const markToolsAsSubmitted = (0,
|
|
346100
|
+
const markToolsAsSubmitted = (0, import_react114.useCallback)(
|
|
346361
346101
|
(callIdsToMark) => {
|
|
346362
346102
|
setToolCallsForDisplay(
|
|
346363
346103
|
(prevCalls) => prevCalls.map(
|
|
@@ -346497,18 +346237,18 @@ function showCitations(settings) {
|
|
|
346497
346237
|
}
|
|
346498
346238
|
__name(showCitations, "showCitations");
|
|
346499
346239
|
var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, config, settings, onDebugMessage, handleSlashCommand2, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, visionModelPreviewEnabled, setShellInputFocused, terminalWidth, terminalHeight, onVisionSwitchRequired, isShellFocused) => {
|
|
346500
|
-
const [initError, setInitError] = (0,
|
|
346501
|
-
const abortControllerRef = (0,
|
|
346502
|
-
const turnCancelledRef = (0,
|
|
346503
|
-
const isSubmittingQueryRef = (0,
|
|
346504
|
-
const [isResponding, setIsResponding] = (0,
|
|
346505
|
-
const [thought, setThought] = (0,
|
|
346240
|
+
const [initError, setInitError] = (0, import_react115.useState)(null);
|
|
346241
|
+
const abortControllerRef = (0, import_react115.useRef)(null);
|
|
346242
|
+
const turnCancelledRef = (0, import_react115.useRef)(false);
|
|
346243
|
+
const isSubmittingQueryRef = (0, import_react115.useRef)(false);
|
|
346244
|
+
const [isResponding, setIsResponding] = (0, import_react115.useState)(false);
|
|
346245
|
+
const [thought, setThought] = (0, import_react115.useState)(null);
|
|
346506
346246
|
const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
|
|
346507
|
-
const processedMemoryToolsRef = (0,
|
|
346247
|
+
const processedMemoryToolsRef = (0, import_react115.useRef)(/* @__PURE__ */ new Set());
|
|
346508
346248
|
const { startNewPrompt, getPromptCount } = useSessionStats();
|
|
346509
346249
|
const storage = config.storage;
|
|
346510
346250
|
const logger6 = useLogger(storage);
|
|
346511
|
-
const gitService = (0,
|
|
346251
|
+
const gitService = (0, import_react115.useMemo)(() => {
|
|
346512
346252
|
if (!config.getProjectRoot()) {
|
|
346513
346253
|
return;
|
|
346514
346254
|
}
|
|
@@ -346532,11 +346272,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346532
346272
|
getPreferredEditor,
|
|
346533
346273
|
onEditorClose
|
|
346534
346274
|
);
|
|
346535
|
-
const pendingToolCallGroupDisplay = (0,
|
|
346275
|
+
const pendingToolCallGroupDisplay = (0, import_react115.useMemo)(
|
|
346536
346276
|
() => toolCalls.length ? mapToDisplay(toolCalls) : void 0,
|
|
346537
346277
|
[toolCalls]
|
|
346538
346278
|
);
|
|
346539
|
-
const activeToolPtyId = (0,
|
|
346279
|
+
const activeToolPtyId = (0, import_react115.useMemo)(() => {
|
|
346540
346280
|
const executingShellTool = toolCalls?.find(
|
|
346541
346281
|
(tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
|
|
346542
346282
|
);
|
|
@@ -346545,12 +346285,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346545
346285
|
}
|
|
346546
346286
|
return void 0;
|
|
346547
346287
|
}, [toolCalls]);
|
|
346548
|
-
const loopDetectedRef = (0,
|
|
346288
|
+
const loopDetectedRef = (0, import_react115.useRef)(false);
|
|
346549
346289
|
const [
|
|
346550
346290
|
loopDetectionConfirmationRequest,
|
|
346551
346291
|
setLoopDetectionConfirmationRequest
|
|
346552
|
-
] = (0,
|
|
346553
|
-
const onExec = (0,
|
|
346292
|
+
] = (0, import_react115.useState)(null);
|
|
346293
|
+
const onExec = (0, import_react115.useCallback)(async (done) => {
|
|
346554
346294
|
setIsResponding(true);
|
|
346555
346295
|
await done;
|
|
346556
346296
|
setIsResponding(false);
|
|
@@ -346573,12 +346313,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346573
346313
|
onVisionSwitchRequired
|
|
346574
346314
|
);
|
|
346575
346315
|
const activePtyId = activeShellPtyId || activeToolPtyId;
|
|
346576
|
-
(0,
|
|
346316
|
+
(0, import_react115.useEffect)(() => {
|
|
346577
346317
|
if (!activePtyId) {
|
|
346578
346318
|
setShellInputFocused(false);
|
|
346579
346319
|
}
|
|
346580
346320
|
}, [activePtyId, setShellInputFocused]);
|
|
346581
|
-
const streamingState = (0,
|
|
346321
|
+
const streamingState = (0, import_react115.useMemo)(() => {
|
|
346582
346322
|
if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
|
|
346583
346323
|
return "waiting_for_confirmation" /* WaitingForConfirmation */;
|
|
346584
346324
|
}
|
|
@@ -346589,7 +346329,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346589
346329
|
}
|
|
346590
346330
|
return "idle" /* Idle */;
|
|
346591
346331
|
}, [isResponding, toolCalls]);
|
|
346592
|
-
(0,
|
|
346332
|
+
(0, import_react115.useEffect)(() => {
|
|
346593
346333
|
if (config.getApprovalMode() === ApprovalMode.YOLO && streamingState === "idle" /* Idle */) {
|
|
346594
346334
|
const lastUserMessageIndex = history.findLastIndex(
|
|
346595
346335
|
(item) => item.type === "user" /* USER */
|
|
@@ -346603,7 +346343,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346603
346343
|
}
|
|
346604
346344
|
}
|
|
346605
346345
|
}, [streamingState, config, history]);
|
|
346606
|
-
const cancelOngoingRequest = (0,
|
|
346346
|
+
const cancelOngoingRequest = (0, import_react115.useCallback)(() => {
|
|
346607
346347
|
if (streamingState !== "responding" /* Responding */) {
|
|
346608
346348
|
return;
|
|
346609
346349
|
}
|
|
@@ -346652,7 +346392,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346652
346392
|
},
|
|
346653
346393
|
{ isActive: streamingState === "responding" /* Responding */ }
|
|
346654
346394
|
);
|
|
346655
|
-
const prepareQueryForGemini = (0,
|
|
346395
|
+
const prepareQueryForGemini = (0, import_react115.useCallback)(
|
|
346656
346396
|
async (query, userMessageTimestamp, abortSignal, prompt_id) => {
|
|
346657
346397
|
if (turnCancelledRef.current) {
|
|
346658
346398
|
return { queryToSend: null, shouldProceed: false };
|
|
@@ -346747,7 +346487,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346747
346487
|
scheduleToolCalls
|
|
346748
346488
|
]
|
|
346749
346489
|
);
|
|
346750
|
-
const handleContentEvent = (0,
|
|
346490
|
+
const handleContentEvent = (0, import_react115.useCallback)(
|
|
346751
346491
|
(eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
|
|
346752
346492
|
if (turnCancelledRef.current) {
|
|
346753
346493
|
return "";
|
|
@@ -346783,7 +346523,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346783
346523
|
},
|
|
346784
346524
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem]
|
|
346785
346525
|
);
|
|
346786
|
-
const handleUserCancelledEvent = (0,
|
|
346526
|
+
const handleUserCancelledEvent = (0, import_react115.useCallback)(
|
|
346787
346527
|
(userMessageTimestamp) => {
|
|
346788
346528
|
if (turnCancelledRef.current) {
|
|
346789
346529
|
return;
|
|
@@ -346812,7 +346552,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346812
346552
|
},
|
|
346813
346553
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought]
|
|
346814
346554
|
);
|
|
346815
|
-
const handleErrorEvent = (0,
|
|
346555
|
+
const handleErrorEvent = (0, import_react115.useCallback)(
|
|
346816
346556
|
(eventValue, userMessageTimestamp) => {
|
|
346817
346557
|
if (pendingHistoryItemRef.current) {
|
|
346818
346558
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -346835,7 +346575,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346835
346575
|
},
|
|
346836
346576
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought]
|
|
346837
346577
|
);
|
|
346838
|
-
const handleCitationEvent = (0,
|
|
346578
|
+
const handleCitationEvent = (0, import_react115.useCallback)(
|
|
346839
346579
|
(text, userMessageTimestamp) => {
|
|
346840
346580
|
if (!showCitations(settings)) {
|
|
346841
346581
|
return;
|
|
@@ -346848,7 +346588,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346848
346588
|
},
|
|
346849
346589
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, settings]
|
|
346850
346590
|
);
|
|
346851
|
-
const handleFinishedEvent = (0,
|
|
346591
|
+
const handleFinishedEvent = (0, import_react115.useCallback)(
|
|
346852
346592
|
(event, userMessageTimestamp) => {
|
|
346853
346593
|
const finishReason = event.value.reason;
|
|
346854
346594
|
if (!finishReason) {
|
|
@@ -346882,7 +346622,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346882
346622
|
},
|
|
346883
346623
|
[addItem]
|
|
346884
346624
|
);
|
|
346885
|
-
const handleChatCompressionEvent = (0,
|
|
346625
|
+
const handleChatCompressionEvent = (0, import_react115.useCallback)(
|
|
346886
346626
|
(eventValue, userMessageTimestamp) => {
|
|
346887
346627
|
if (pendingHistoryItemRef.current) {
|
|
346888
346628
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -346898,7 +346638,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346898
346638
|
},
|
|
346899
346639
|
[addItem, config, pendingHistoryItemRef, setPendingHistoryItem]
|
|
346900
346640
|
);
|
|
346901
|
-
const handleMaxSessionTurnsEvent = (0,
|
|
346641
|
+
const handleMaxSessionTurnsEvent = (0, import_react115.useCallback)(
|
|
346902
346642
|
() => addItem(
|
|
346903
346643
|
{
|
|
346904
346644
|
type: "info",
|
|
@@ -346908,7 +346648,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346908
346648
|
),
|
|
346909
346649
|
[addItem, config]
|
|
346910
346650
|
);
|
|
346911
|
-
const handleSessionTokenLimitExceededEvent = (0,
|
|
346651
|
+
const handleSessionTokenLimitExceededEvent = (0, import_react115.useCallback)(
|
|
346912
346652
|
(value) => addItem(
|
|
346913
346653
|
{
|
|
346914
346654
|
type: "error",
|
|
@@ -346923,7 +346663,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346923
346663
|
),
|
|
346924
346664
|
[addItem]
|
|
346925
346665
|
);
|
|
346926
|
-
const handleLoopDetectionConfirmation = (0,
|
|
346666
|
+
const handleLoopDetectionConfirmation = (0, import_react115.useCallback)(
|
|
346927
346667
|
(result) => {
|
|
346928
346668
|
setLoopDetectionConfirmationRequest(null);
|
|
346929
346669
|
if (result.userSelection === "disable") {
|
|
@@ -346947,12 +346687,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
346947
346687
|
},
|
|
346948
346688
|
[config, addItem]
|
|
346949
346689
|
);
|
|
346950
|
-
const handleLoopDetectedEvent = (0,
|
|
346690
|
+
const handleLoopDetectedEvent = (0, import_react115.useCallback)(() => {
|
|
346951
346691
|
setLoopDetectionConfirmationRequest({
|
|
346952
346692
|
onComplete: handleLoopDetectionConfirmation
|
|
346953
346693
|
});
|
|
346954
346694
|
}, [handleLoopDetectionConfirmation]);
|
|
346955
|
-
const processGeminiStreamEvents = (0,
|
|
346695
|
+
const processGeminiStreamEvents = (0, import_react115.useCallback)(
|
|
346956
346696
|
async (stream2, userMessageTimestamp, signal) => {
|
|
346957
346697
|
let geminiMessageBuffer = "";
|
|
346958
346698
|
const toolCallRequests = [];
|
|
@@ -347026,7 +346766,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
347026
346766
|
handleCitationEvent
|
|
347027
346767
|
]
|
|
347028
346768
|
);
|
|
347029
|
-
const submitQuery = (0,
|
|
346769
|
+
const submitQuery = (0, import_react115.useCallback)(
|
|
347030
346770
|
async (query, options2, prompt_id) => {
|
|
347031
346771
|
if (isSubmittingQueryRef.current && !options2?.isContinuation) {
|
|
347032
346772
|
return;
|
|
@@ -347159,7 +346899,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
347159
346899
|
restoreOriginalModel
|
|
347160
346900
|
]
|
|
347161
346901
|
);
|
|
347162
|
-
const handleApprovalModeChange = (0,
|
|
346902
|
+
const handleApprovalModeChange = (0, import_react115.useCallback)(
|
|
347163
346903
|
async (newApprovalMode) => {
|
|
347164
346904
|
if (newApprovalMode === ApprovalMode.YOLO || newApprovalMode === ApprovalMode.AUTO_EDIT) {
|
|
347165
346905
|
let awaitingApprovalCalls = toolCalls.filter(
|
|
@@ -347188,7 +346928,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
347188
346928
|
},
|
|
347189
346929
|
[toolCalls]
|
|
347190
346930
|
);
|
|
347191
|
-
const handleCompletedTools = (0,
|
|
346931
|
+
const handleCompletedTools = (0, import_react115.useCallback)(
|
|
347192
346932
|
async (completedToolCallsFromScheduler) => {
|
|
347193
346933
|
if (isResponding) {
|
|
347194
346934
|
return;
|
|
@@ -347273,13 +347013,13 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
347273
347013
|
modelSwitchedFromQuotaError
|
|
347274
347014
|
]
|
|
347275
347015
|
);
|
|
347276
|
-
const pendingHistoryItems = (0,
|
|
347016
|
+
const pendingHistoryItems = (0, import_react115.useMemo)(
|
|
347277
347017
|
() => [pendingHistoryItem, pendingToolCallGroupDisplay].filter(
|
|
347278
347018
|
(i) => i !== void 0 && i !== null
|
|
347279
347019
|
),
|
|
347280
347020
|
[pendingHistoryItem, pendingToolCallGroupDisplay]
|
|
347281
347021
|
);
|
|
347282
|
-
(0,
|
|
347022
|
+
(0, import_react115.useEffect)(() => {
|
|
347283
347023
|
const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
|
|
347284
347024
|
if (!config.getCheckpointingEnabled()) {
|
|
347285
347025
|
return;
|
|
@@ -347398,7 +347138,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
347398
347138
|
|
|
347399
347139
|
// packages/cli/src/ui/hooks/vim.ts
|
|
347400
347140
|
init_esbuild_shims();
|
|
347401
|
-
var
|
|
347141
|
+
var import_react116 = __toESM(require_react(), 1);
|
|
347402
347142
|
var DIGIT_MULTIPLIER = 10;
|
|
347403
347143
|
var DEFAULT_COUNT = 1;
|
|
347404
347144
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -347461,22 +347201,22 @@ var vimReducer = /* @__PURE__ */ __name((state, action) => {
|
|
|
347461
347201
|
}, "vimReducer");
|
|
347462
347202
|
function useVim(buffer, onSubmit) {
|
|
347463
347203
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
347464
|
-
const [state, dispatch] = (0,
|
|
347465
|
-
(0,
|
|
347204
|
+
const [state, dispatch] = (0, import_react116.useReducer)(vimReducer, initialVimState);
|
|
347205
|
+
(0, import_react116.useEffect)(() => {
|
|
347466
347206
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
347467
347207
|
}, [vimMode]);
|
|
347468
|
-
const updateMode = (0,
|
|
347208
|
+
const updateMode = (0, import_react116.useCallback)(
|
|
347469
347209
|
(mode) => {
|
|
347470
347210
|
setVimMode(mode);
|
|
347471
347211
|
dispatch({ type: "SET_MODE", mode });
|
|
347472
347212
|
},
|
|
347473
347213
|
[setVimMode]
|
|
347474
347214
|
);
|
|
347475
|
-
const getCurrentCount = (0,
|
|
347215
|
+
const getCurrentCount = (0, import_react116.useCallback)(
|
|
347476
347216
|
() => state.count || DEFAULT_COUNT,
|
|
347477
347217
|
[state.count]
|
|
347478
347218
|
);
|
|
347479
|
-
const executeCommand = (0,
|
|
347219
|
+
const executeCommand = (0, import_react116.useCallback)(
|
|
347480
347220
|
(cmdType, count) => {
|
|
347481
347221
|
switch (cmdType) {
|
|
347482
347222
|
case CMD_TYPES.DELETE_WORD_FORWARD: {
|
|
@@ -347552,7 +347292,7 @@ function useVim(buffer, onSubmit) {
|
|
|
347552
347292
|
},
|
|
347553
347293
|
[buffer, updateMode]
|
|
347554
347294
|
);
|
|
347555
|
-
const handleInsertModeInput = (0,
|
|
347295
|
+
const handleInsertModeInput = (0, import_react116.useCallback)(
|
|
347556
347296
|
(normalizedKey) => {
|
|
347557
347297
|
if (normalizedKey.name === "escape") {
|
|
347558
347298
|
buffer.vimEscapeInsertMode();
|
|
@@ -347583,7 +347323,7 @@ function useVim(buffer, onSubmit) {
|
|
|
347583
347323
|
},
|
|
347584
347324
|
[buffer, dispatch, updateMode, onSubmit]
|
|
347585
347325
|
);
|
|
347586
|
-
const normalizeKey = (0,
|
|
347326
|
+
const normalizeKey = (0, import_react116.useCallback)(
|
|
347587
347327
|
(key) => ({
|
|
347588
347328
|
name: key.name || "",
|
|
347589
347329
|
sequence: key.sequence || "",
|
|
@@ -347594,7 +347334,7 @@ function useVim(buffer, onSubmit) {
|
|
|
347594
347334
|
}),
|
|
347595
347335
|
[]
|
|
347596
347336
|
);
|
|
347597
|
-
const handleChangeMovement = (0,
|
|
347337
|
+
const handleChangeMovement = (0, import_react116.useCallback)(
|
|
347598
347338
|
(movement) => {
|
|
347599
347339
|
const count = getCurrentCount();
|
|
347600
347340
|
dispatch({ type: "CLEAR_COUNT" });
|
|
@@ -347615,7 +347355,7 @@ function useVim(buffer, onSubmit) {
|
|
|
347615
347355
|
},
|
|
347616
347356
|
[getCurrentCount, dispatch, buffer, updateMode]
|
|
347617
347357
|
);
|
|
347618
|
-
const handleOperatorMotion = (0,
|
|
347358
|
+
const handleOperatorMotion = (0, import_react116.useCallback)(
|
|
347619
347359
|
(operator2, motion) => {
|
|
347620
347360
|
const count = getCurrentCount();
|
|
347621
347361
|
const commandMap = {
|
|
@@ -347642,7 +347382,7 @@ function useVim(buffer, onSubmit) {
|
|
|
347642
347382
|
},
|
|
347643
347383
|
[getCurrentCount, executeCommand, dispatch]
|
|
347644
347384
|
);
|
|
347645
|
-
const handleInput = (0,
|
|
347385
|
+
const handleInput = (0, import_react116.useCallback)(
|
|
347646
347386
|
(key) => {
|
|
347647
347387
|
if (!vimEnabled) {
|
|
347648
347388
|
return false;
|
|
@@ -348003,14 +347743,14 @@ __name(initializeApp, "initializeApp");
|
|
|
348003
347743
|
|
|
348004
347744
|
// packages/cli/src/ui/hooks/useBracketedPaste.ts
|
|
348005
347745
|
init_esbuild_shims();
|
|
348006
|
-
var
|
|
347746
|
+
var import_react117 = __toESM(require_react(), 1);
|
|
348007
347747
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
348008
347748
|
var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
348009
347749
|
var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
348010
347750
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
348011
347751
|
process.stdout.write(DISABLE_BRACKETED_PASTE);
|
|
348012
347752
|
}, "cleanup");
|
|
348013
|
-
(0,
|
|
347753
|
+
(0, import_react117.useEffect)(() => {
|
|
348014
347754
|
process.stdout.write(ENABLE_BRACKETED_PASTE);
|
|
348015
347755
|
process.on("exit", cleanup);
|
|
348016
347756
|
process.on("SIGINT", cleanup);
|
|
@@ -348029,13 +347769,13 @@ init_esbuild_shims();
|
|
|
348029
347769
|
|
|
348030
347770
|
// packages/cli/src/ui/hooks/useTimer.ts
|
|
348031
347771
|
init_esbuild_shims();
|
|
348032
|
-
var
|
|
347772
|
+
var import_react118 = __toESM(require_react(), 1);
|
|
348033
347773
|
var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
348034
|
-
const [elapsedTime, setElapsedTime] = (0,
|
|
348035
|
-
const timerRef = (0,
|
|
348036
|
-
const prevResetKeyRef = (0,
|
|
348037
|
-
const prevIsActiveRef = (0,
|
|
348038
|
-
(0,
|
|
347774
|
+
const [elapsedTime, setElapsedTime] = (0, import_react118.useState)(0);
|
|
347775
|
+
const timerRef = (0, import_react118.useRef)(null);
|
|
347776
|
+
const prevResetKeyRef = (0, import_react118.useRef)(resetKey);
|
|
347777
|
+
const prevIsActiveRef = (0, import_react118.useRef)(isActive);
|
|
347778
|
+
(0, import_react118.useEffect)(() => {
|
|
348039
347779
|
let shouldResetTime = false;
|
|
348040
347780
|
if (prevResetKeyRef.current !== resetKey) {
|
|
348041
347781
|
shouldResetTime = true;
|
|
@@ -348073,7 +347813,7 @@ var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
|
348073
347813
|
|
|
348074
347814
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
348075
347815
|
init_esbuild_shims();
|
|
348076
|
-
var
|
|
347816
|
+
var import_react119 = __toESM(require_react(), 1);
|
|
348077
347817
|
var WITTY_LOADING_PHRASES = [
|
|
348078
347818
|
"I'm Feeling Lucky",
|
|
348079
347819
|
"Shipping awesomeness... ",
|
|
@@ -348208,11 +347948,11 @@ var WITTY_LOADING_PHRASES = [
|
|
|
348208
347948
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
348209
347949
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
348210
347950
|
const loadingPhrases = customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES;
|
|
348211
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
347951
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react119.useState)(
|
|
348212
347952
|
loadingPhrases[0]
|
|
348213
347953
|
);
|
|
348214
|
-
const phraseIntervalRef = (0,
|
|
348215
|
-
(0,
|
|
347954
|
+
const phraseIntervalRef = (0, import_react119.useRef)(null);
|
|
347955
|
+
(0, import_react119.useEffect)(() => {
|
|
348216
347956
|
if (isWaiting) {
|
|
348217
347957
|
setCurrentLoadingPhrase("Waiting for user confirmation...");
|
|
348218
347958
|
if (phraseIntervalRef.current) {
|
|
@@ -348249,9 +347989,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
348249
347989
|
}, "usePhraseCycler");
|
|
348250
347990
|
|
|
348251
347991
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
348252
|
-
var
|
|
347992
|
+
var import_react120 = __toESM(require_react(), 1);
|
|
348253
347993
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases) => {
|
|
348254
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
347994
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react120.useState)(0);
|
|
348255
347995
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
348256
347996
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
348257
347997
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -348261,9 +348001,9 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
348261
348001
|
isWaiting,
|
|
348262
348002
|
customWittyPhrases
|
|
348263
348003
|
);
|
|
348264
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
348265
|
-
const prevStreamingStateRef = (0,
|
|
348266
|
-
(0,
|
|
348004
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react120.useState)(0);
|
|
348005
|
+
const prevStreamingStateRef = (0, import_react120.useRef)(null);
|
|
348006
|
+
(0, import_react120.useEffect)(() => {
|
|
348267
348007
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
348268
348008
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
348269
348009
|
setRetainedElapsedTime(0);
|
|
@@ -348283,20 +348023,20 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
348283
348023
|
|
|
348284
348024
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
348285
348025
|
init_esbuild_shims();
|
|
348286
|
-
var
|
|
348026
|
+
var import_react121 = __toESM(require_react(), 1);
|
|
348287
348027
|
import * as process38 from "node:process";
|
|
348288
348028
|
var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
348289
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
348290
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
348291
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
348029
|
+
const [isTrusted, setIsTrusted] = (0, import_react121.useState)(void 0);
|
|
348030
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react121.useState)(false);
|
|
348031
|
+
const [isRestarting, setIsRestarting] = (0, import_react121.useState)(false);
|
|
348292
348032
|
const folderTrust = settings.merged.security?.folderTrust?.enabled;
|
|
348293
|
-
(0,
|
|
348033
|
+
(0, import_react121.useEffect)(() => {
|
|
348294
348034
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
|
|
348295
348035
|
setIsTrusted(trusted);
|
|
348296
348036
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
348297
348037
|
onTrustChange(trusted);
|
|
348298
348038
|
}, [folderTrust, onTrustChange, settings.merged]);
|
|
348299
|
-
const handleFolderTrustSelect = (0,
|
|
348039
|
+
const handleFolderTrustSelect = (0, import_react121.useCallback)(
|
|
348300
348040
|
(choice2) => {
|
|
348301
348041
|
const trustedFolders = loadTrustedFolders();
|
|
348302
348042
|
const cwd7 = process38.cwd();
|
|
@@ -348346,7 +348086,7 @@ init_esbuild_shims();
|
|
|
348346
348086
|
// node_modules/update-notifier/update-notifier.js
|
|
348347
348087
|
init_esbuild_shims();
|
|
348348
348088
|
import process47 from "node:process";
|
|
348349
|
-
import { spawn as
|
|
348089
|
+
import { spawn as spawn7 } from "node:child_process";
|
|
348350
348090
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
348351
348091
|
import path102 from "node:path";
|
|
348352
348092
|
import { format as format3 } from "node:util";
|
|
@@ -351060,7 +350800,7 @@ var UpdateNotifier = class {
|
|
|
351060
350800
|
if (Date.now() - this.config.get("lastUpdateCheck") < this.#updateCheckInterval) {
|
|
351061
350801
|
return;
|
|
351062
350802
|
}
|
|
351063
|
-
|
|
350803
|
+
spawn7(process47.execPath, [path102.join(__dirname8, "check.js"), JSON.stringify(this.#options)], {
|
|
351064
350804
|
detached: true,
|
|
351065
350805
|
stdio: "ignore"
|
|
351066
350806
|
}).unref();
|
|
@@ -351311,8 +351051,8 @@ var updateEventEmitter = new EventEmitter9();
|
|
|
351311
351051
|
|
|
351312
351052
|
// packages/cli/src/utils/spawnWrapper.ts
|
|
351313
351053
|
init_esbuild_shims();
|
|
351314
|
-
import { spawn as
|
|
351315
|
-
var spawnWrapper =
|
|
351054
|
+
import { spawn as spawn8 } from "node:child_process";
|
|
351055
|
+
var spawnWrapper = spawn8;
|
|
351316
351056
|
|
|
351317
351057
|
// packages/cli/src/utils/handleAutoUpdate.ts
|
|
351318
351058
|
function handleAutoUpdate(info, settings, projectRoot, spawnFn = spawnWrapper) {
|
|
@@ -351480,27 +351220,27 @@ var ConsolePatcher = class {
|
|
|
351480
351220
|
|
|
351481
351221
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
351482
351222
|
init_esbuild_shims();
|
|
351483
|
-
var
|
|
351223
|
+
var import_react122 = __toESM(require_react(), 1);
|
|
351484
351224
|
function useMessageQueue({
|
|
351485
351225
|
isConfigInitialized,
|
|
351486
351226
|
streamingState,
|
|
351487
351227
|
submitQuery
|
|
351488
351228
|
}) {
|
|
351489
|
-
const [messageQueue, setMessageQueue] = (0,
|
|
351490
|
-
const addMessage = (0,
|
|
351229
|
+
const [messageQueue, setMessageQueue] = (0, import_react122.useState)([]);
|
|
351230
|
+
const addMessage = (0, import_react122.useCallback)((message) => {
|
|
351491
351231
|
const trimmedMessage = message.trim();
|
|
351492
351232
|
if (trimmedMessage.length > 0) {
|
|
351493
351233
|
setMessageQueue((prev) => [...prev, trimmedMessage]);
|
|
351494
351234
|
}
|
|
351495
351235
|
}, []);
|
|
351496
|
-
const clearQueue = (0,
|
|
351236
|
+
const clearQueue = (0, import_react122.useCallback)(() => {
|
|
351497
351237
|
setMessageQueue([]);
|
|
351498
351238
|
}, []);
|
|
351499
|
-
const getQueuedMessagesText = (0,
|
|
351239
|
+
const getQueuedMessagesText = (0, import_react122.useCallback)(() => {
|
|
351500
351240
|
if (messageQueue.length === 0) return "";
|
|
351501
351241
|
return messageQueue.join("\n\n");
|
|
351502
351242
|
}, [messageQueue]);
|
|
351503
|
-
(0,
|
|
351243
|
+
(0, import_react122.useEffect)(() => {
|
|
351504
351244
|
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
351505
351245
|
const combinedMessage = messageQueue.join("\n\n");
|
|
351506
351246
|
setMessageQueue([]);
|
|
@@ -351518,15 +351258,15 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
351518
351258
|
|
|
351519
351259
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
351520
351260
|
init_esbuild_shims();
|
|
351521
|
-
var
|
|
351261
|
+
var import_react123 = __toESM(require_react(), 1);
|
|
351522
351262
|
function useAutoAcceptIndicator({
|
|
351523
351263
|
config,
|
|
351524
351264
|
addItem,
|
|
351525
351265
|
onApprovalModeChange
|
|
351526
351266
|
}) {
|
|
351527
351267
|
const currentConfigValue = config.getApprovalMode();
|
|
351528
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
351529
|
-
(0,
|
|
351268
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react123.useState)(currentConfigValue);
|
|
351269
|
+
(0, import_react123.useEffect)(() => {
|
|
351530
351270
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
351531
351271
|
}, [currentConfigValue]);
|
|
351532
351272
|
useKeypress(
|
|
@@ -351559,14 +351299,14 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
351559
351299
|
|
|
351560
351300
|
// packages/cli/src/ui/hooks/useWorkspaceMigration.ts
|
|
351561
351301
|
init_esbuild_shims();
|
|
351562
|
-
var
|
|
351302
|
+
var import_react124 = __toESM(require_react(), 1);
|
|
351563
351303
|
import process48 from "node:process";
|
|
351564
351304
|
function useWorkspaceMigration(settings) {
|
|
351565
|
-
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0,
|
|
351566
|
-
const [workspaceExtensions, setWorkspaceExtensions] = (0,
|
|
351305
|
+
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0, import_react124.useState)(false);
|
|
351306
|
+
const [workspaceExtensions, setWorkspaceExtensions] = (0, import_react124.useState)(
|
|
351567
351307
|
[]
|
|
351568
351308
|
);
|
|
351569
|
-
(0,
|
|
351309
|
+
(0, import_react124.useEffect)(() => {
|
|
351570
351310
|
if (!(settings.merged.experimental?.extensionManagement ?? true)) {
|
|
351571
351311
|
return;
|
|
351572
351312
|
}
|
|
@@ -351608,15 +351348,18 @@ __name(useWorkspaceMigration, "useWorkspaceMigration");
|
|
|
351608
351348
|
|
|
351609
351349
|
// packages/cli/src/ui/hooks/useGitBranchName.ts
|
|
351610
351350
|
init_esbuild_shims();
|
|
351611
|
-
var
|
|
351351
|
+
var import_react125 = __toESM(require_react(), 1);
|
|
351612
351352
|
import fs89 from "node:fs";
|
|
351613
351353
|
import fsPromises7 from "node:fs/promises";
|
|
351614
351354
|
import path104 from "node:path";
|
|
351615
351355
|
function useGitBranchName(cwd7) {
|
|
351616
|
-
const [branchName, setBranchName] = (0,
|
|
351617
|
-
const fetchBranchName = (0,
|
|
351356
|
+
const [branchName, setBranchName] = (0, import_react125.useState)(void 0);
|
|
351357
|
+
const fetchBranchName = (0, import_react125.useCallback)(async () => {
|
|
351618
351358
|
try {
|
|
351619
|
-
|
|
351359
|
+
if (!isCommandAvailable("git").available) {
|
|
351360
|
+
return;
|
|
351361
|
+
}
|
|
351362
|
+
const { stdout } = await execCommand(
|
|
351620
351363
|
"git",
|
|
351621
351364
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
351622
351365
|
{ cwd: cwd7 }
|
|
@@ -351625,7 +351368,7 @@ function useGitBranchName(cwd7) {
|
|
|
351625
351368
|
if (branch && branch !== "HEAD") {
|
|
351626
351369
|
setBranchName(branch);
|
|
351627
351370
|
} else {
|
|
351628
|
-
const { stdout: hashStdout } = await
|
|
351371
|
+
const { stdout: hashStdout } = await execCommand(
|
|
351629
351372
|
"git",
|
|
351630
351373
|
["rev-parse", "--short", "HEAD"],
|
|
351631
351374
|
{ cwd: cwd7 }
|
|
@@ -351636,7 +351379,7 @@ function useGitBranchName(cwd7) {
|
|
|
351636
351379
|
setBranchName(void 0);
|
|
351637
351380
|
}
|
|
351638
351381
|
}, [cwd7, setBranchName]);
|
|
351639
|
-
(0,
|
|
351382
|
+
(0, import_react125.useEffect)(() => {
|
|
351640
351383
|
fetchBranchName();
|
|
351641
351384
|
const gitLogsHeadPath = path104.join(cwd7, ".git", "logs", "HEAD");
|
|
351642
351385
|
let watcher;
|
|
@@ -351662,7 +351405,7 @@ __name(useGitBranchName, "useGitBranchName");
|
|
|
351662
351405
|
|
|
351663
351406
|
// packages/cli/src/ui/hooks/useExtensionUpdates.ts
|
|
351664
351407
|
init_esbuild_shims();
|
|
351665
|
-
var
|
|
351408
|
+
var import_react126 = __toESM(require_react(), 1);
|
|
351666
351409
|
function confirmationRequestsReducer(state, action) {
|
|
351667
351410
|
switch (action.type) {
|
|
351668
351411
|
case "add":
|
|
@@ -351676,15 +351419,15 @@ function confirmationRequestsReducer(state, action) {
|
|
|
351676
351419
|
}
|
|
351677
351420
|
__name(confirmationRequestsReducer, "confirmationRequestsReducer");
|
|
351678
351421
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) => {
|
|
351679
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
351422
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react126.useReducer)(
|
|
351680
351423
|
extensionUpdatesReducer,
|
|
351681
351424
|
initialExtensionUpdatesState
|
|
351682
351425
|
);
|
|
351683
351426
|
const [
|
|
351684
351427
|
confirmUpdateExtensionRequests,
|
|
351685
351428
|
dispatchConfirmUpdateExtensionRequests
|
|
351686
|
-
] = (0,
|
|
351687
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
351429
|
+
] = (0, import_react126.useReducer)(confirmationRequestsReducer, []);
|
|
351430
|
+
const addConfirmUpdateExtensionRequest = (0, import_react126.useCallback)(
|
|
351688
351431
|
(original) => {
|
|
351689
351432
|
const wrappedRequest = {
|
|
351690
351433
|
prompt: original.prompt,
|
|
@@ -351703,7 +351446,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
351703
351446
|
},
|
|
351704
351447
|
[dispatchConfirmUpdateExtensionRequests]
|
|
351705
351448
|
);
|
|
351706
|
-
(0,
|
|
351449
|
+
(0, import_react126.useEffect)(() => {
|
|
351707
351450
|
(async () => {
|
|
351708
351451
|
await checkForAllExtensionUpdates(
|
|
351709
351452
|
extensions,
|
|
@@ -351711,7 +351454,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
351711
351454
|
);
|
|
351712
351455
|
})();
|
|
351713
351456
|
}, [extensions, extensions.length, dispatchExtensionStateUpdate]);
|
|
351714
|
-
(0,
|
|
351457
|
+
(0, import_react126.useEffect)(() => {
|
|
351715
351458
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
351716
351459
|
return;
|
|
351717
351460
|
}
|
|
@@ -351776,7 +351519,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
351776
351519
|
addItem,
|
|
351777
351520
|
cwd7
|
|
351778
351521
|
]);
|
|
351779
|
-
const extensionsUpdateStateComputed = (0,
|
|
351522
|
+
const extensionsUpdateStateComputed = (0, import_react126.useMemo)(() => {
|
|
351780
351523
|
const result = /* @__PURE__ */ new Map();
|
|
351781
351524
|
for (const [
|
|
351782
351525
|
key,
|
|
@@ -351797,13 +351540,13 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
351797
351540
|
|
|
351798
351541
|
// packages/cli/src/ui/hooks/useQuitConfirmation.ts
|
|
351799
351542
|
init_esbuild_shims();
|
|
351800
|
-
var
|
|
351543
|
+
var import_react127 = __toESM(require_react(), 1);
|
|
351801
351544
|
var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
351802
|
-
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0,
|
|
351803
|
-
const showQuitConfirmation = (0,
|
|
351545
|
+
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0, import_react127.useState)(false);
|
|
351546
|
+
const showQuitConfirmation = (0, import_react127.useCallback)(() => {
|
|
351804
351547
|
setIsQuitConfirmationOpen(true);
|
|
351805
351548
|
}, []);
|
|
351806
|
-
const handleQuitConfirmationSelect = (0,
|
|
351549
|
+
const handleQuitConfirmationSelect = (0, import_react127.useCallback)((choice2) => {
|
|
351807
351550
|
setIsQuitConfirmationOpen(false);
|
|
351808
351551
|
if (choice2 === "cancel" /* CANCEL */) {
|
|
351809
351552
|
return { shouldQuit: false, action: "cancel" };
|
|
@@ -351825,14 +351568,14 @@ var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
|
351825
351568
|
|
|
351826
351569
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
351827
351570
|
init_esbuild_shims();
|
|
351828
|
-
var
|
|
351571
|
+
var import_react128 = __toESM(require_react(), 1);
|
|
351829
351572
|
function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
351830
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
351831
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
351832
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
351833
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
351834
|
-
const [inputFillText, setInputFillText] = (0,
|
|
351835
|
-
const checkWelcomeBack = (0,
|
|
351573
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react128.useState)(null);
|
|
351574
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react128.useState)(false);
|
|
351575
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react128.useState)(null);
|
|
351576
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react128.useState)(false);
|
|
351577
|
+
const [inputFillText, setInputFillText] = (0, import_react128.useState)(null);
|
|
351578
|
+
const checkWelcomeBack = (0, import_react128.useCallback)(async () => {
|
|
351836
351579
|
if (settings.ui?.enableWelcomeBack === false) {
|
|
351837
351580
|
return;
|
|
351838
351581
|
}
|
|
@@ -351846,7 +351589,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
351846
351589
|
console.debug("Welcome back check failed:", error);
|
|
351847
351590
|
}
|
|
351848
351591
|
}, [settings.ui?.enableWelcomeBack]);
|
|
351849
|
-
const handleWelcomeBackSelection = (0,
|
|
351592
|
+
const handleWelcomeBackSelection = (0, import_react128.useCallback)(
|
|
351850
351593
|
(choice2) => {
|
|
351851
351594
|
setWelcomeBackChoice(choice2);
|
|
351852
351595
|
setShowWelcomeBackDialog(false);
|
|
@@ -351858,21 +351601,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
351858
351601
|
},
|
|
351859
351602
|
[welcomeBackInfo]
|
|
351860
351603
|
);
|
|
351861
|
-
const handleWelcomeBackClose = (0,
|
|
351604
|
+
const handleWelcomeBackClose = (0, import_react128.useCallback)(() => {
|
|
351862
351605
|
setWelcomeBackChoice("restart");
|
|
351863
351606
|
setShowWelcomeBackDialog(false);
|
|
351864
351607
|
}, []);
|
|
351865
|
-
const clearInputFill = (0,
|
|
351608
|
+
const clearInputFill = (0, import_react128.useCallback)(() => {
|
|
351866
351609
|
setShouldFillInput(false);
|
|
351867
351610
|
setInputFillText(null);
|
|
351868
351611
|
}, []);
|
|
351869
|
-
(0,
|
|
351612
|
+
(0, import_react128.useEffect)(() => {
|
|
351870
351613
|
if (shouldFillInput && inputFillText) {
|
|
351871
351614
|
buffer.setText(inputFillText);
|
|
351872
351615
|
clearInputFill();
|
|
351873
351616
|
}
|
|
351874
351617
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
351875
|
-
(0,
|
|
351618
|
+
(0, import_react128.useEffect)(() => {
|
|
351876
351619
|
checkWelcomeBack();
|
|
351877
351620
|
}, [checkWelcomeBack]);
|
|
351878
351621
|
return {
|
|
@@ -351893,9 +351636,9 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
351893
351636
|
|
|
351894
351637
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
351895
351638
|
init_esbuild_shims();
|
|
351896
|
-
var
|
|
351639
|
+
var import_react129 = __toESM(require_react(), 1);
|
|
351897
351640
|
function useDialogClose(options2) {
|
|
351898
|
-
const closeAnyOpenDialog = (0,
|
|
351641
|
+
const closeAnyOpenDialog = (0, import_react129.useCallback)(() => {
|
|
351899
351642
|
if (options2.isThemeDialogOpen) {
|
|
351900
351643
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
351901
351644
|
return true;
|
|
@@ -351927,14 +351670,14 @@ __name(useDialogClose, "useDialogClose");
|
|
|
351927
351670
|
|
|
351928
351671
|
// packages/cli/src/ui/hooks/useInitializationAuthError.ts
|
|
351929
351672
|
init_esbuild_shims();
|
|
351930
|
-
var
|
|
351673
|
+
var import_react130 = __toESM(require_react(), 1);
|
|
351931
351674
|
var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
|
|
351932
|
-
const hasHandled = (0,
|
|
351933
|
-
const authErrorRef = (0,
|
|
351934
|
-
const onAuthErrorRef = (0,
|
|
351675
|
+
const hasHandled = (0, import_react130.useRef)(false);
|
|
351676
|
+
const authErrorRef = (0, import_react130.useRef)(authError);
|
|
351677
|
+
const onAuthErrorRef = (0, import_react130.useRef)(onAuthError);
|
|
351935
351678
|
authErrorRef.current = authError;
|
|
351936
351679
|
onAuthErrorRef.current = onAuthError;
|
|
351937
|
-
(0,
|
|
351680
|
+
(0, import_react130.useEffect)(() => {
|
|
351938
351681
|
if (hasHandled.current) {
|
|
351939
351682
|
return;
|
|
351940
351683
|
}
|
|
@@ -351947,13 +351690,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
|
|
|
351947
351690
|
|
|
351948
351691
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
351949
351692
|
init_esbuild_shims();
|
|
351950
|
-
var
|
|
351693
|
+
var import_react131 = __toESM(require_react(), 1);
|
|
351951
351694
|
function useSubagentCreateDialog() {
|
|
351952
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
351953
|
-
const openSubagentCreateDialog = (0,
|
|
351695
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react131.useState)(false);
|
|
351696
|
+
const openSubagentCreateDialog = (0, import_react131.useCallback)(() => {
|
|
351954
351697
|
setIsSubagentCreateDialogOpen(true);
|
|
351955
351698
|
}, []);
|
|
351956
|
-
const closeSubagentCreateDialog = (0,
|
|
351699
|
+
const closeSubagentCreateDialog = (0, import_react131.useCallback)(() => {
|
|
351957
351700
|
setIsSubagentCreateDialogOpen(false);
|
|
351958
351701
|
}, []);
|
|
351959
351702
|
return {
|
|
@@ -351966,13 +351709,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
351966
351709
|
|
|
351967
351710
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
351968
351711
|
init_esbuild_shims();
|
|
351969
|
-
var
|
|
351712
|
+
var import_react132 = __toESM(require_react(), 1);
|
|
351970
351713
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
351971
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
351972
|
-
const openAgentsManagerDialog = (0,
|
|
351714
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react132.useState)(false);
|
|
351715
|
+
const openAgentsManagerDialog = (0, import_react132.useCallback)(() => {
|
|
351973
351716
|
setIsAgentsManagerDialogOpen(true);
|
|
351974
351717
|
}, []);
|
|
351975
|
-
const closeAgentsManagerDialog = (0,
|
|
351718
|
+
const closeAgentsManagerDialog = (0, import_react132.useCallback)(() => {
|
|
351976
351719
|
setIsAgentsManagerDialogOpen(false);
|
|
351977
351720
|
}, []);
|
|
351978
351721
|
return {
|
|
@@ -351984,7 +351727,7 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
351984
351727
|
|
|
351985
351728
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
351986
351729
|
init_esbuild_shims();
|
|
351987
|
-
var
|
|
351730
|
+
var import_react133 = __toESM(require_react(), 1);
|
|
351988
351731
|
|
|
351989
351732
|
// packages/cli/src/utils/attentionNotification.ts
|
|
351990
351733
|
init_esbuild_shims();
|
|
@@ -352012,9 +351755,9 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
352012
351755
|
streamingState,
|
|
352013
351756
|
elapsedTime
|
|
352014
351757
|
}) => {
|
|
352015
|
-
const awaitingNotificationSentRef = (0,
|
|
352016
|
-
const respondingElapsedRef = (0,
|
|
352017
|
-
(0,
|
|
351758
|
+
const awaitingNotificationSentRef = (0, import_react133.useRef)(false);
|
|
351759
|
+
const respondingElapsedRef = (0, import_react133.useRef)(0);
|
|
351760
|
+
(0, import_react133.useEffect)(() => {
|
|
352018
351761
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
352019
351762
|
notifyTerminalAttention("tool_approval" /* ToolApproval */);
|
|
352020
351763
|
awaitingNotificationSentRef.current = true;
|
|
@@ -352023,7 +351766,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
352023
351766
|
awaitingNotificationSentRef.current = false;
|
|
352024
351767
|
}
|
|
352025
351768
|
}, [isFocused, streamingState]);
|
|
352026
|
-
(0,
|
|
351769
|
+
(0, import_react133.useEffect)(() => {
|
|
352027
351770
|
if (streamingState === "responding" /* Responding */) {
|
|
352028
351771
|
respondingElapsedRef.current = elapsedTime;
|
|
352029
351772
|
return;
|
|
@@ -352059,22 +351802,22 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352059
351802
|
const { settings, config, initializationResult } = props;
|
|
352060
351803
|
const historyManager = useHistory();
|
|
352061
351804
|
useMemoryMonitor(historyManager);
|
|
352062
|
-
const [corgiMode, setCorgiMode] = (0,
|
|
352063
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
352064
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
352065
|
-
const [themeError, setThemeError] = (0,
|
|
351805
|
+
const [corgiMode, setCorgiMode] = (0, import_react134.useState)(false);
|
|
351806
|
+
const [debugMessage, setDebugMessage] = (0, import_react134.useState)("");
|
|
351807
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react134.useState)(null);
|
|
351808
|
+
const [themeError, setThemeError] = (0, import_react134.useState)(
|
|
352066
351809
|
initializationResult.themeError
|
|
352067
351810
|
);
|
|
352068
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
352069
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
352070
|
-
const [geminiMdFileCount, setGeminiMdFileCount] = (0,
|
|
351811
|
+
const [isProcessing, setIsProcessing] = (0, import_react134.useState)(false);
|
|
351812
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react134.useState)(false);
|
|
351813
|
+
const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react134.useState)(
|
|
352071
351814
|
initializationResult.geminiMdFileCount
|
|
352072
351815
|
);
|
|
352073
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
352074
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
352075
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
352076
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
352077
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
351816
|
+
const [shellModeActive, setShellModeActive] = (0, import_react134.useState)(false);
|
|
351817
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react134.useState)(false);
|
|
351818
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react134.useState)(0);
|
|
351819
|
+
const [updateInfo, setUpdateInfo] = (0, import_react134.useState)(null);
|
|
351820
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react134.useState)(
|
|
352078
351821
|
config.isTrustedFolder()
|
|
352079
351822
|
);
|
|
352080
351823
|
const extensions = config.getExtensions();
|
|
@@ -352089,38 +351832,38 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352089
351832
|
historyManager.addItem,
|
|
352090
351833
|
config.getWorkingDir()
|
|
352091
351834
|
);
|
|
352092
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
352093
|
-
const openPermissionsDialog = (0,
|
|
351835
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react134.useState)(false);
|
|
351836
|
+
const openPermissionsDialog = (0, import_react134.useCallback)(
|
|
352094
351837
|
() => setPermissionsDialogOpen(true),
|
|
352095
351838
|
[]
|
|
352096
351839
|
);
|
|
352097
|
-
const closePermissionsDialog = (0,
|
|
351840
|
+
const closePermissionsDialog = (0, import_react134.useCallback)(
|
|
352098
351841
|
() => setPermissionsDialogOpen(false),
|
|
352099
351842
|
[]
|
|
352100
351843
|
);
|
|
352101
|
-
const getEffectiveModel2 = (0,
|
|
351844
|
+
const getEffectiveModel2 = (0, import_react134.useCallback)(() => {
|
|
352102
351845
|
if (config.isInFallbackMode()) {
|
|
352103
351846
|
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
352104
351847
|
}
|
|
352105
351848
|
return config.getModel();
|
|
352106
351849
|
}, [config]);
|
|
352107
|
-
const [currentModel, setCurrentModel] = (0,
|
|
352108
|
-
const [userTier] = (0,
|
|
352109
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
351850
|
+
const [currentModel, setCurrentModel] = (0, import_react134.useState)(getEffectiveModel2());
|
|
351851
|
+
const [userTier] = (0, import_react134.useState)(void 0);
|
|
351852
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react134.useState)(false);
|
|
352110
351853
|
const logger6 = useLogger(config.storage);
|
|
352111
|
-
const [userMessages, setUserMessages] = (0,
|
|
351854
|
+
const [userMessages, setUserMessages] = (0, import_react134.useState)([]);
|
|
352112
351855
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
352113
351856
|
const { stdin, setRawMode } = use_stdin_default();
|
|
352114
351857
|
const { stdout } = use_stdout_default();
|
|
352115
351858
|
const { stats: sessionStats } = useSessionStats();
|
|
352116
351859
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
352117
|
-
const mainControlsRef = (0,
|
|
352118
|
-
const originalTitleRef = (0,
|
|
351860
|
+
const mainControlsRef = (0, import_react134.useRef)(null);
|
|
351861
|
+
const originalTitleRef = (0, import_react134.useRef)(
|
|
352119
351862
|
computeWindowTitle(basename14(config.getTargetDir()))
|
|
352120
351863
|
);
|
|
352121
|
-
const lastTitleRef = (0,
|
|
351864
|
+
const lastTitleRef = (0, import_react134.useRef)(null);
|
|
352122
351865
|
const staticExtraHeight = 3;
|
|
352123
|
-
(0,
|
|
351866
|
+
(0, import_react134.useEffect)(() => {
|
|
352124
351867
|
(async () => {
|
|
352125
351868
|
await config.initialize();
|
|
352126
351869
|
setConfigInitialized(true);
|
|
@@ -352130,11 +351873,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352130
351873
|
await ideClient.disconnect();
|
|
352131
351874
|
});
|
|
352132
351875
|
}, [config]);
|
|
352133
|
-
(0,
|
|
351876
|
+
(0, import_react134.useEffect)(
|
|
352134
351877
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
352135
351878
|
[historyManager.addItem]
|
|
352136
351879
|
);
|
|
352137
|
-
(0,
|
|
351880
|
+
(0, import_react134.useEffect)(() => {
|
|
352138
351881
|
const checkModelChange = /* @__PURE__ */ __name(() => {
|
|
352139
351882
|
const effectiveModel = getEffectiveModel2();
|
|
352140
351883
|
if (effectiveModel !== currentModel) {
|
|
@@ -352150,7 +351893,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352150
351893
|
handleNewMessage,
|
|
352151
351894
|
clearConsoleMessages: clearConsoleMessagesState
|
|
352152
351895
|
} = useConsoleMessages();
|
|
352153
|
-
(0,
|
|
351896
|
+
(0, import_react134.useEffect)(() => {
|
|
352154
351897
|
const consolePatcher = new ConsolePatcher({
|
|
352155
351898
|
onNewMessage: handleNewMessage,
|
|
352156
351899
|
debugMode: config.getDebugMode()
|
|
@@ -352158,13 +351901,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352158
351901
|
consolePatcher.patch();
|
|
352159
351902
|
registerCleanup(consolePatcher.cleanup);
|
|
352160
351903
|
}, [handleNewMessage, config]);
|
|
352161
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
351904
|
+
const { inputWidth, suggestionsWidth } = (0, import_react134.useMemo)(() => {
|
|
352162
351905
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
352163
351906
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
352164
351907
|
}, [terminalWidth]);
|
|
352165
351908
|
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
|
|
352166
351909
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
352167
|
-
const isValidPath = (0,
|
|
351910
|
+
const isValidPath = (0, import_react134.useCallback)((filePath) => {
|
|
352168
351911
|
try {
|
|
352169
351912
|
return fs90.existsSync(filePath) && fs90.statSync(filePath).isFile();
|
|
352170
351913
|
} catch (_e) {
|
|
@@ -352179,7 +351922,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352179
351922
|
isValidPath,
|
|
352180
351923
|
shellModeActive
|
|
352181
351924
|
});
|
|
352182
|
-
(0,
|
|
351925
|
+
(0, import_react134.useEffect)(() => {
|
|
352183
351926
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
352184
351927
|
const pastMessagesRaw = await logger6?.getPreviousUserMessages() || [];
|
|
352185
351928
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -352202,7 +351945,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352202
351945
|
}, "fetchUserMessages");
|
|
352203
351946
|
fetchUserMessages();
|
|
352204
351947
|
}, [historyManager.history, logger6]);
|
|
352205
|
-
const refreshStatic = (0,
|
|
351948
|
+
const refreshStatic = (0, import_react134.useCallback)(() => {
|
|
352206
351949
|
stdout.write(base_exports.clearTerminal);
|
|
352207
351950
|
setHistoryRemountKey((prev) => prev + 1);
|
|
352208
351951
|
}, [setHistoryRemountKey, stdout]);
|
|
@@ -352233,7 +351976,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352233
351976
|
handleAuthSelect,
|
|
352234
351977
|
openAuthDialog,
|
|
352235
351978
|
cancelAuthentication
|
|
352236
|
-
} = useAuthCommand(settings, config);
|
|
351979
|
+
} = useAuthCommand(settings, config, historyManager.addItem);
|
|
352237
351980
|
const { proQuotaRequest, handleProQuotaChoice } = useQuotaAndFallback({
|
|
352238
351981
|
config,
|
|
352239
351982
|
historyManager,
|
|
@@ -352242,7 +351985,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352242
351985
|
setModelSwitchedFromQuotaError
|
|
352243
351986
|
});
|
|
352244
351987
|
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
352245
|
-
(0,
|
|
351988
|
+
(0, import_react134.useEffect)(() => {
|
|
352246
351989
|
if (settings.merged.security?.auth?.enforcedType && settings.merged.security?.auth.selectedType && settings.merged.security?.auth.enforcedType !== settings.merged.security?.auth.selectedType) {
|
|
352247
351990
|
onAuthError(
|
|
352248
351991
|
`Authentication is enforced to be ${settings.merged.security?.auth.enforcedType}, but you are currently using ${settings.merged.security?.auth.selectedType}.`
|
|
@@ -352261,7 +352004,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352261
352004
|
settings.merged.security?.auth?.useExternal,
|
|
352262
352005
|
onAuthError
|
|
352263
352006
|
]);
|
|
352264
|
-
const [editorError, setEditorError] = (0,
|
|
352007
|
+
const [editorError, setEditorError] = (0, import_react134.useState)(null);
|
|
352265
352008
|
const {
|
|
352266
352009
|
isEditorDialogOpen,
|
|
352267
352010
|
openEditorDialog,
|
|
@@ -352288,9 +352031,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352288
352031
|
openAgentsManagerDialog,
|
|
352289
352032
|
closeAgentsManagerDialog
|
|
352290
352033
|
} = useAgentsManagerDialog();
|
|
352291
|
-
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0,
|
|
352292
|
-
const [visionSwitchResolver, setVisionSwitchResolver] = (0,
|
|
352293
|
-
const slashCommandActions = (0,
|
|
352034
|
+
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0, import_react134.useState)(false);
|
|
352035
|
+
const [visionSwitchResolver, setVisionSwitchResolver] = (0, import_react134.useState)(null);
|
|
352036
|
+
const slashCommandActions = (0, import_react134.useMemo)(
|
|
352294
352037
|
() => ({
|
|
352295
352038
|
openAuthDialog,
|
|
352296
352039
|
openThemeDialog,
|
|
@@ -352353,14 +352096,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352353
352096
|
extensionsUpdateStateInternal,
|
|
352354
352097
|
isConfigInitialized
|
|
352355
352098
|
);
|
|
352356
|
-
const handleVisionSwitchRequired = (0,
|
|
352099
|
+
const handleVisionSwitchRequired = (0, import_react134.useCallback)(
|
|
352357
352100
|
async (_query) => new Promise((resolve24, reject) => {
|
|
352358
352101
|
setVisionSwitchResolver({ resolve: resolve24, reject });
|
|
352359
352102
|
setIsVisionSwitchDialogOpen(true);
|
|
352360
352103
|
}),
|
|
352361
352104
|
[]
|
|
352362
352105
|
);
|
|
352363
|
-
const handleVisionSwitchSelect = (0,
|
|
352106
|
+
const handleVisionSwitchSelect = (0, import_react134.useCallback)(
|
|
352364
352107
|
(outcome) => {
|
|
352365
352108
|
setIsVisionSwitchDialogOpen(false);
|
|
352366
352109
|
if (visionSwitchResolver) {
|
|
@@ -352371,10 +352114,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352371
352114
|
},
|
|
352372
352115
|
[visionSwitchResolver]
|
|
352373
352116
|
);
|
|
352374
|
-
const onDebugMessage = (0,
|
|
352117
|
+
const onDebugMessage = (0, import_react134.useCallback)((message) => {
|
|
352375
352118
|
console.debug(message);
|
|
352376
352119
|
}, []);
|
|
352377
|
-
const performMemoryRefresh = (0,
|
|
352120
|
+
const performMemoryRefresh = (0, import_react134.useCallback)(async () => {
|
|
352378
352121
|
historyManager.addItem(
|
|
352379
352122
|
{
|
|
352380
352123
|
type: "info" /* INFO */,
|
|
@@ -352425,7 +352168,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352425
352168
|
console.error("Error refreshing memory:", error);
|
|
352426
352169
|
}
|
|
352427
352170
|
}, [config, historyManager, settings.merged]);
|
|
352428
|
-
const cancelHandlerRef = (0,
|
|
352171
|
+
const cancelHandlerRef = (0, import_react134.useRef)(() => {
|
|
352429
352172
|
});
|
|
352430
352173
|
const {
|
|
352431
352174
|
streamingState,
|
|
@@ -352472,7 +352215,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352472
352215
|
streamingState,
|
|
352473
352216
|
submitQuery
|
|
352474
352217
|
});
|
|
352475
|
-
const handleFinalSubmit = (0,
|
|
352218
|
+
const handleFinalSubmit = (0, import_react134.useCallback)(
|
|
352476
352219
|
(submittedValue) => {
|
|
352477
352220
|
addMessage(submittedValue);
|
|
352478
352221
|
},
|
|
@@ -352485,7 +352228,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352485
352228
|
handleWelcomeBackSelection,
|
|
352486
352229
|
handleWelcomeBackClose
|
|
352487
352230
|
} = useWelcomeBack(config, handleFinalSubmit, buffer, settings.merged);
|
|
352488
|
-
cancelHandlerRef.current = (0,
|
|
352231
|
+
cancelHandlerRef.current = (0, import_react134.useCallback)(() => {
|
|
352489
352232
|
const pendingHistoryItems2 = [
|
|
352490
352233
|
...pendingSlashCommandHistoryItems,
|
|
352491
352234
|
...pendingGeminiHistoryItems
|
|
@@ -352514,7 +352257,7 @@ ${queuedText}` : queuedText;
|
|
|
352514
352257
|
pendingSlashCommandHistoryItems,
|
|
352515
352258
|
pendingGeminiHistoryItems
|
|
352516
352259
|
]);
|
|
352517
|
-
const handleClearScreen = (0,
|
|
352260
|
+
const handleClearScreen = (0, import_react134.useCallback)(() => {
|
|
352518
352261
|
historyManager.clearItems();
|
|
352519
352262
|
clearConsoleMessagesState();
|
|
352520
352263
|
console.clear();
|
|
@@ -352522,8 +352265,8 @@ ${queuedText}` : queuedText;
|
|
|
352522
352265
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
352523
352266
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
352524
352267
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */) && !proQuotaRequest;
|
|
352525
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
352526
|
-
(0,
|
|
352268
|
+
const [controlsHeight, setControlsHeight] = (0, import_react134.useState)(0);
|
|
352269
|
+
(0, import_react134.useLayoutEffect)(() => {
|
|
352527
352270
|
if (mainControlsRef.current) {
|
|
352528
352271
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
352529
352272
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -352546,14 +352289,14 @@ ${queuedText}` : queuedText;
|
|
|
352546
352289
|
});
|
|
352547
352290
|
const isFocused = useFocus();
|
|
352548
352291
|
useBracketedPaste();
|
|
352549
|
-
const contextFileNames = (0,
|
|
352292
|
+
const contextFileNames = (0, import_react134.useMemo)(() => {
|
|
352550
352293
|
const fromSettings = settings.merged.context?.fileName;
|
|
352551
352294
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
|
|
352552
352295
|
}, [settings.merged.context?.fileName]);
|
|
352553
|
-
const initialPrompt = (0,
|
|
352554
|
-
const initialPromptSubmitted = (0,
|
|
352296
|
+
const initialPrompt = (0, import_react134.useMemo)(() => config.getQuestion(), [config]);
|
|
352297
|
+
const initialPromptSubmitted = (0, import_react134.useRef)(false);
|
|
352555
352298
|
const geminiClient = config.getGeminiClient();
|
|
352556
|
-
(0,
|
|
352299
|
+
(0, import_react134.useEffect)(() => {
|
|
352557
352300
|
if (activePtyId) {
|
|
352558
352301
|
ShellExecutionService.resizePty(
|
|
352559
352302
|
activePtyId,
|
|
@@ -352562,7 +352305,7 @@ ${queuedText}` : queuedText;
|
|
|
352562
352305
|
);
|
|
352563
352306
|
}
|
|
352564
352307
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
352565
|
-
(0,
|
|
352308
|
+
(0, import_react134.useEffect)(() => {
|
|
352566
352309
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && !isVisionSwitchDialogOpen && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
|
|
352567
352310
|
handleFinalSubmit(initialPrompt);
|
|
352568
352311
|
initialPromptSubmitted.current = true;
|
|
@@ -352580,9 +352323,9 @@ ${queuedText}` : queuedText;
|
|
|
352580
352323
|
welcomeBackChoice,
|
|
352581
352324
|
geminiClient
|
|
352582
352325
|
]);
|
|
352583
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0,
|
|
352584
|
-
const [currentIDE, setCurrentIDE] = (0,
|
|
352585
|
-
(0,
|
|
352326
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react134.useState)(false);
|
|
352327
|
+
const [currentIDE, setCurrentIDE] = (0, import_react134.useState)(null);
|
|
352328
|
+
(0, import_react134.useEffect)(() => {
|
|
352586
352329
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
352587
352330
|
const ideClient = await IdeClient.getInstance();
|
|
352588
352331
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -352593,28 +352336,28 @@ ${queuedText}` : queuedText;
|
|
|
352593
352336
|
const shouldShowIdePrompt = Boolean(
|
|
352594
352337
|
currentIDE && !config.getIdeMode() && !settings.merged.ide?.hasSeenNudge && !idePromptAnswered
|
|
352595
352338
|
);
|
|
352596
|
-
const [showErrorDetails, setShowErrorDetails] = (0,
|
|
352597
|
-
const [showToolDescriptions, setShowToolDescriptions] = (0,
|
|
352598
|
-
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0,
|
|
352599
|
-
const ctrlCTimerRef = (0,
|
|
352600
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0,
|
|
352601
|
-
const ctrlDTimerRef = (0,
|
|
352602
|
-
const [constrainHeight, setConstrainHeight] = (0,
|
|
352603
|
-
const [ideContextState, setIdeContextState] = (0,
|
|
352604
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
352605
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0,
|
|
352339
|
+
const [showErrorDetails, setShowErrorDetails] = (0, import_react134.useState)(false);
|
|
352340
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react134.useState)(false);
|
|
352341
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react134.useState)(false);
|
|
352342
|
+
const ctrlCTimerRef = (0, import_react134.useRef)(null);
|
|
352343
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react134.useState)(false);
|
|
352344
|
+
const ctrlDTimerRef = (0, import_react134.useRef)(null);
|
|
352345
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react134.useState)(true);
|
|
352346
|
+
const [ideContextState, setIdeContextState] = (0, import_react134.useState)();
|
|
352347
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react134.useState)(false);
|
|
352348
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react134.useState)(false);
|
|
352606
352349
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
|
|
352607
352350
|
const {
|
|
352608
352351
|
needsRestart: ideNeedsRestart,
|
|
352609
352352
|
restartReason: ideTrustRestartReason
|
|
352610
352353
|
} = useIdeTrustListener();
|
|
352611
|
-
const isInitialMount = (0,
|
|
352612
|
-
(0,
|
|
352354
|
+
const isInitialMount = (0, import_react134.useRef)(true);
|
|
352355
|
+
(0, import_react134.useEffect)(() => {
|
|
352613
352356
|
if (ideNeedsRestart) {
|
|
352614
352357
|
setShowIdeRestartPrompt(true);
|
|
352615
352358
|
}
|
|
352616
352359
|
}, [ideNeedsRestart]);
|
|
352617
|
-
(0,
|
|
352360
|
+
(0, import_react134.useEffect)(() => {
|
|
352618
352361
|
if (isInitialMount.current) {
|
|
352619
352362
|
isInitialMount.current = false;
|
|
352620
352363
|
return;
|
|
@@ -352626,12 +352369,12 @@ ${queuedText}` : queuedText;
|
|
|
352626
352369
|
clearTimeout(handler);
|
|
352627
352370
|
};
|
|
352628
352371
|
}, [terminalWidth, refreshStatic]);
|
|
352629
|
-
(0,
|
|
352372
|
+
(0, import_react134.useEffect)(() => {
|
|
352630
352373
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
352631
352374
|
setIdeContextState(ideContextStore.get());
|
|
352632
352375
|
return unsubscribe;
|
|
352633
352376
|
}, []);
|
|
352634
|
-
(0,
|
|
352377
|
+
(0, import_react134.useEffect)(() => {
|
|
352635
352378
|
const openDebugConsole = /* @__PURE__ */ __name(() => {
|
|
352636
352379
|
setShowErrorDetails(true);
|
|
352637
352380
|
setConstrainHeight(false);
|
|
@@ -352650,10 +352393,10 @@ ${queuedText}` : queuedText;
|
|
|
352650
352393
|
appEvents.off("log-error" /* LogError */, logErrorHandler);
|
|
352651
352394
|
};
|
|
352652
352395
|
}, [handleNewMessage]);
|
|
352653
|
-
const handleEscapePromptChange = (0,
|
|
352396
|
+
const handleEscapePromptChange = (0, import_react134.useCallback)((showPrompt) => {
|
|
352654
352397
|
setShowEscapePrompt(showPrompt);
|
|
352655
352398
|
}, []);
|
|
352656
|
-
const handleIdePromptComplete = (0,
|
|
352399
|
+
const handleIdePromptComplete = (0, import_react134.useCallback)(
|
|
352657
352400
|
(result) => {
|
|
352658
352401
|
if (result.userSelection === "yes") {
|
|
352659
352402
|
handleSlashCommand2("/ide install");
|
|
@@ -352691,7 +352434,7 @@ ${queuedText}` : queuedText;
|
|
|
352691
352434
|
handleWelcomeBackClose,
|
|
352692
352435
|
quitConfirmationRequest
|
|
352693
352436
|
});
|
|
352694
|
-
const handleExit = (0,
|
|
352437
|
+
const handleExit = (0, import_react134.useCallback)(
|
|
352695
352438
|
(pressedOnce, setPressedOnce, timerRef) => {
|
|
352696
352439
|
if (pressedOnce) {
|
|
352697
352440
|
if (timerRef.current) {
|
|
@@ -352734,7 +352477,7 @@ ${queuedText}` : queuedText;
|
|
|
352734
352477
|
buffer
|
|
352735
352478
|
]
|
|
352736
352479
|
);
|
|
352737
|
-
const handleGlobalKeypress = (0,
|
|
352480
|
+
const handleGlobalKeypress = (0, import_react134.useCallback)(
|
|
352738
352481
|
(key) => {
|
|
352739
352482
|
if (settings.merged.general?.debugKeystrokeLogging) {
|
|
352740
352483
|
console.log("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
@@ -352807,7 +352550,7 @@ ${queuedText}` : queuedText;
|
|
|
352807
352550
|
]
|
|
352808
352551
|
);
|
|
352809
352552
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
352810
|
-
(0,
|
|
352553
|
+
(0, import_react134.useEffect)(() => {
|
|
352811
352554
|
if (!settings.merged.ui?.showStatusInTitle || settings.merged.ui?.hideWindowTitle)
|
|
352812
352555
|
return;
|
|
352813
352556
|
let title;
|
|
@@ -352829,23 +352572,23 @@ ${queuedText}` : queuedText;
|
|
|
352829
352572
|
settings.merged.ui?.hideWindowTitle,
|
|
352830
352573
|
stdout
|
|
352831
352574
|
]);
|
|
352832
|
-
const filteredConsoleMessages = (0,
|
|
352575
|
+
const filteredConsoleMessages = (0, import_react134.useMemo)(() => {
|
|
352833
352576
|
if (config.getDebugMode()) {
|
|
352834
352577
|
return consoleMessages;
|
|
352835
352578
|
}
|
|
352836
352579
|
return consoleMessages.filter((msg) => msg.type !== "debug");
|
|
352837
352580
|
}, [consoleMessages, config]);
|
|
352838
|
-
const errorCount = (0,
|
|
352581
|
+
const errorCount = (0, import_react134.useMemo)(
|
|
352839
352582
|
() => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
|
|
352840
352583
|
[filteredConsoleMessages]
|
|
352841
352584
|
);
|
|
352842
352585
|
const nightly = props.version.includes("nightly");
|
|
352843
352586
|
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest || !!quitConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isVisionSwitchDialogOpen || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || !!proQuotaRequest || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isApprovalModeDialogOpen;
|
|
352844
|
-
const pendingHistoryItems = (0,
|
|
352587
|
+
const pendingHistoryItems = (0, import_react134.useMemo)(
|
|
352845
352588
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
352846
352589
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
352847
352590
|
);
|
|
352848
|
-
const uiState = (0,
|
|
352591
|
+
const uiState = (0, import_react134.useMemo)(
|
|
352849
352592
|
() => ({
|
|
352850
352593
|
history: historyManager.history,
|
|
352851
352594
|
historyManager,
|
|
@@ -353034,7 +352777,7 @@ ${queuedText}` : queuedText;
|
|
|
353034
352777
|
isAgentsManagerDialogOpen
|
|
353035
352778
|
]
|
|
353036
352779
|
);
|
|
353037
|
-
const uiActions = (0,
|
|
352780
|
+
const uiActions = (0, import_react134.useMemo)(
|
|
353038
352781
|
() => ({
|
|
353039
352782
|
handleThemeSelect,
|
|
353040
352783
|
handleThemeHighlight,
|
|
@@ -353180,7 +352923,7 @@ import { randomUUID as randomUUID8 } from "node:crypto";
|
|
|
353180
352923
|
// packages/cli/src/utils/sandbox.ts
|
|
353181
352924
|
init_esbuild_shims();
|
|
353182
352925
|
var import_shell_quote5 = __toESM(require_shell_quote(), 1);
|
|
353183
|
-
import { exec as exec4, execSync as execSync7, spawn as
|
|
352926
|
+
import { exec as exec4, execSync as execSync7, spawn as spawn9 } from "node:child_process";
|
|
353184
352927
|
import os39 from "node:os";
|
|
353185
352928
|
import path105 from "node:path";
|
|
353186
352929
|
import fs91 from "node:fs";
|
|
@@ -353388,7 +353131,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353388
353131
|
sandboxEnv["NO_PROXY"] = noProxy;
|
|
353389
353132
|
sandboxEnv["no_proxy"] = noProxy;
|
|
353390
353133
|
}
|
|
353391
|
-
proxyProcess2 =
|
|
353134
|
+
proxyProcess2 = spawn9(proxyCommand2, {
|
|
353392
353135
|
stdio: ["ignore", "pipe", "pipe"],
|
|
353393
353136
|
shell: true,
|
|
353394
353137
|
detached: true
|
|
@@ -353419,7 +353162,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353419
353162
|
);
|
|
353420
353163
|
}
|
|
353421
353164
|
process.stdin.pause();
|
|
353422
|
-
sandboxProcess2 =
|
|
353165
|
+
sandboxProcess2 = spawn9(config.command, args2, {
|
|
353423
353166
|
stdio: "inherit"
|
|
353424
353167
|
});
|
|
353425
353168
|
return new Promise((resolve24, reject) => {
|
|
@@ -353738,7 +353481,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353738
353481
|
let sandboxProcess = void 0;
|
|
353739
353482
|
if (proxyCommand) {
|
|
353740
353483
|
const proxyContainerCommand = `${config.command} run --rm --init ${userFlag} --name ${SANDBOX_PROXY_NAME} --network ${SANDBOX_PROXY_NAME} -p 8877:8877 -v ${process.cwd()}:${workdir} --workdir ${workdir} ${image2} ${proxyCommand}`;
|
|
353741
|
-
proxyProcess =
|
|
353484
|
+
proxyProcess = spawn9(proxyContainerCommand, {
|
|
353742
353485
|
stdio: ["ignore", "pipe", "pipe"],
|
|
353743
353486
|
shell: true,
|
|
353744
353487
|
detached: true
|
|
@@ -353770,7 +353513,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353770
353513
|
);
|
|
353771
353514
|
}
|
|
353772
353515
|
process.stdin.pause();
|
|
353773
|
-
sandboxProcess =
|
|
353516
|
+
sandboxProcess = spawn9(config.command, args, {
|
|
353774
353517
|
stdio: "inherit"
|
|
353775
353518
|
});
|
|
353776
353519
|
return new Promise((resolve24, reject) => {
|
|
@@ -353796,7 +353539,7 @@ __name(start_sandbox, "start_sandbox");
|
|
|
353796
353539
|
async function imageExists(sandbox, image2) {
|
|
353797
353540
|
return new Promise((resolve24) => {
|
|
353798
353541
|
const args = ["images", "-q", image2];
|
|
353799
|
-
const checkProcess =
|
|
353542
|
+
const checkProcess = spawn9(sandbox, args);
|
|
353800
353543
|
let stdoutData = "";
|
|
353801
353544
|
if (checkProcess.stdout) {
|
|
353802
353545
|
checkProcess.stdout.on("data", (data) => {
|
|
@@ -353821,7 +353564,7 @@ async function pullImage(sandbox, image2) {
|
|
|
353821
353564
|
console.info(`Attempting to pull image ${image2} using ${sandbox}...`);
|
|
353822
353565
|
return new Promise((resolve24) => {
|
|
353823
353566
|
const args = ["pull", image2];
|
|
353824
|
-
const pullProcess =
|
|
353567
|
+
const pullProcess = spawn9(sandbox, args, { stdio: "pipe" });
|
|
353825
353568
|
let stderrData = "";
|
|
353826
353569
|
const onStdoutData = /* @__PURE__ */ __name((data) => {
|
|
353827
353570
|
console.info(data.toString().trim());
|
|
@@ -353973,11 +353716,15 @@ var ripgrepAvailabilityCheck = {
|
|
|
353973
353716
|
if (!options2.useRipgrep) {
|
|
353974
353717
|
return null;
|
|
353975
353718
|
}
|
|
353976
|
-
|
|
353977
|
-
|
|
353978
|
-
|
|
353719
|
+
try {
|
|
353720
|
+
const isAvailable = await canUseRipgrep(options2.useBuiltinRipgrep);
|
|
353721
|
+
if (!isAvailable) {
|
|
353722
|
+
return "Ripgrep not available: Please install ripgrep globally to enable faster file content search. Falling back to built-in grep.";
|
|
353723
|
+
}
|
|
353724
|
+
return null;
|
|
353725
|
+
} catch (error) {
|
|
353726
|
+
return `Ripgrep not available: ${error instanceof Error ? error.message : "Unknown error"}. Falling back to built-in grep.`;
|
|
353979
353727
|
}
|
|
353980
|
-
return null;
|
|
353981
353728
|
}, "check")
|
|
353982
353729
|
};
|
|
353983
353730
|
var WARNING_CHECKS = [
|
|
@@ -354246,9 +353993,9 @@ __name(runNonInteractive, "runNonInteractive");
|
|
|
354246
353993
|
|
|
354247
353994
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
354248
353995
|
init_esbuild_shims();
|
|
354249
|
-
var
|
|
353996
|
+
var import_react135 = __toESM(require_react(), 1);
|
|
354250
353997
|
function useKittyKeyboardProtocol() {
|
|
354251
|
-
const [status] = (0,
|
|
353998
|
+
const [status] = (0, import_react135.useState)({
|
|
354252
353999
|
supported: isKittyProtocolSupported(),
|
|
354253
354000
|
enabled: isKittyProtocolEnabled(),
|
|
354254
354001
|
checking: false
|
|
@@ -354259,7 +354006,7 @@ __name(useKittyKeyboardProtocol, "useKittyKeyboardProtocol");
|
|
|
354259
354006
|
|
|
354260
354007
|
// packages/cli/src/utils/relaunch.ts
|
|
354261
354008
|
init_esbuild_shims();
|
|
354262
|
-
import { spawn as
|
|
354009
|
+
import { spawn as spawn10 } from "node:child_process";
|
|
354263
354010
|
async function relaunchOnExitCode(runner) {
|
|
354264
354011
|
while (true) {
|
|
354265
354012
|
try {
|
|
@@ -354291,7 +354038,7 @@ async function relaunchAppInChildProcess(additionalNodeArgs, additionalScriptArg
|
|
|
354291
354038
|
];
|
|
354292
354039
|
const newEnv = { ...process.env, GEMINI_CLI_NO_RELAUNCH: "true" };
|
|
354293
354040
|
process.stdin.pause();
|
|
354294
|
-
const child =
|
|
354041
|
+
const child = spawn10(process.execPath, nodeArgs, {
|
|
354295
354042
|
stdio: "inherit",
|
|
354296
354043
|
env: newEnv
|
|
354297
354044
|
});
|
|
@@ -356099,7 +355846,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
356099
355846
|
) });
|
|
356100
355847
|
}, "AppWrapper");
|
|
356101
355848
|
const instance = render_default(
|
|
356102
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
355849
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_react136.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(AppWrapper, {}),
|
|
356103
355850
|
{
|
|
356104
355851
|
exitOnCtrlC: false,
|
|
356105
355852
|
isScreenReaderEnabled: config.getScreenReader()
|