@rdmind/rdmind 0.0.28-alpha.2 → 0.0.28-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +767 -984
- 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 useMemo25(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 useState66(a) {
|
|
26884
26884
|
var b = C();
|
|
26885
26885
|
a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a;
|
|
26886
26886
|
x.push({
|
|
@@ -98480,30 +98480,31 @@ var init_qwenOAuth2 = __esm({
|
|
|
98480
98480
|
body: objectToUrlEncoded(bodyData)
|
|
98481
98481
|
});
|
|
98482
98482
|
if (!response.ok) {
|
|
98483
|
+
const responseText = await response.text();
|
|
98484
|
+
let errorData = null;
|
|
98483
98485
|
try {
|
|
98484
|
-
|
|
98485
|
-
if (response.status === 400 && errorData.error === "authorization_pending") {
|
|
98486
|
-
return { status: "pending" };
|
|
98487
|
-
}
|
|
98488
|
-
if (response.status === 429 && errorData.error === "slow_down") {
|
|
98489
|
-
return {
|
|
98490
|
-
status: "pending",
|
|
98491
|
-
slowDown: true
|
|
98492
|
-
};
|
|
98493
|
-
}
|
|
98494
|
-
const error = new Error(
|
|
98495
|
-
`Device token poll failed: ${errorData.error || "Unknown error"} - ${errorData.error_description || "No details provided"}`
|
|
98496
|
-
);
|
|
98497
|
-
error.status = response.status;
|
|
98498
|
-
throw error;
|
|
98486
|
+
errorData = JSON.parse(responseText);
|
|
98499
98487
|
} catch (_parseError) {
|
|
98500
|
-
const
|
|
98501
|
-
|
|
98502
|
-
`Device token poll failed: ${response.status} ${response.statusText}. Response: ${errorData}`
|
|
98488
|
+
const error2 = new Error(
|
|
98489
|
+
`Device token poll failed: ${response.status} ${response.statusText}. Response: ${responseText}`
|
|
98503
98490
|
);
|
|
98504
|
-
|
|
98505
|
-
throw
|
|
98491
|
+
error2.status = response.status;
|
|
98492
|
+
throw error2;
|
|
98493
|
+
}
|
|
98494
|
+
if (response.status === 400 && errorData.error === "authorization_pending") {
|
|
98495
|
+
return { status: "pending" };
|
|
98506
98496
|
}
|
|
98497
|
+
if (response.status === 429 && errorData.error === "slow_down") {
|
|
98498
|
+
return {
|
|
98499
|
+
status: "pending",
|
|
98500
|
+
slowDown: true
|
|
98501
|
+
};
|
|
98502
|
+
}
|
|
98503
|
+
const error = new Error(
|
|
98504
|
+
`Device token poll failed: ${errorData.error || "Unknown error"} - ${errorData.error_description}`
|
|
98505
|
+
);
|
|
98506
|
+
error.status = response.status;
|
|
98507
|
+
throw error;
|
|
98507
98508
|
}
|
|
98508
98509
|
return await response.json();
|
|
98509
98510
|
}
|
|
@@ -114537,16 +114538,21 @@ var init_types3 = __esm({
|
|
|
114537
114538
|
}
|
|
114538
114539
|
};
|
|
114539
114540
|
RipgrepFallbackEvent = class {
|
|
114540
|
-
constructor(error) {
|
|
114541
|
-
this.error = error;
|
|
114542
|
-
this["event.name"] = "ripgrep_fallback";
|
|
114543
|
-
this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
114544
|
-
}
|
|
114545
114541
|
static {
|
|
114546
114542
|
__name(this, "RipgrepFallbackEvent");
|
|
114547
114543
|
}
|
|
114548
114544
|
"event.name";
|
|
114549
114545
|
"event.timestamp";
|
|
114546
|
+
use_ripgrep;
|
|
114547
|
+
use_builtin_ripgrep;
|
|
114548
|
+
error;
|
|
114549
|
+
constructor(use_ripgrep, use_builtin_ripgrep, error) {
|
|
114550
|
+
this["event.name"] = "ripgrep_fallback";
|
|
114551
|
+
this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
114552
|
+
this.use_ripgrep = use_ripgrep;
|
|
114553
|
+
this.use_builtin_ripgrep = use_builtin_ripgrep;
|
|
114554
|
+
this.error = error;
|
|
114555
|
+
}
|
|
114550
114556
|
};
|
|
114551
114557
|
LoopDetectedEvent = class {
|
|
114552
114558
|
static {
|
|
@@ -121516,8 +121522,16 @@ var init_qwen_logger = __esm({
|
|
|
121516
121522
|
this.enqueueLogEvent(rumEvent);
|
|
121517
121523
|
this.flushIfNeeded();
|
|
121518
121524
|
}
|
|
121519
|
-
logRipgrepFallbackEvent() {
|
|
121520
|
-
const rumEvent = this.createActionEvent("misc", "ripgrep_fallback", {
|
|
121525
|
+
logRipgrepFallbackEvent(event) {
|
|
121526
|
+
const rumEvent = this.createActionEvent("misc", "ripgrep_fallback", {
|
|
121527
|
+
snapshots: JSON.stringify({
|
|
121528
|
+
platform: process.platform,
|
|
121529
|
+
arch: process.arch,
|
|
121530
|
+
use_ripgrep: event.use_ripgrep,
|
|
121531
|
+
use_builtin_ripgrep: event.use_builtin_ripgrep,
|
|
121532
|
+
error: event.error ?? void 0
|
|
121533
|
+
})
|
|
121534
|
+
});
|
|
121521
121535
|
this.enqueueLogEvent(rumEvent);
|
|
121522
121536
|
this.flushIfNeeded();
|
|
121523
121537
|
}
|
|
@@ -172135,7 +172149,7 @@ function logFlashFallback(config, event) {
|
|
|
172135
172149
|
logger6.emit(logRecord);
|
|
172136
172150
|
}
|
|
172137
172151
|
function logRipgrepFallback(config, event) {
|
|
172138
|
-
QwenLogger.getInstance(config)?.logRipgrepFallbackEvent();
|
|
172152
|
+
QwenLogger.getInstance(config)?.logRipgrepFallbackEvent(event);
|
|
172139
172153
|
if (!isTelemetrySdkInitialized()) return;
|
|
172140
172154
|
const attributes = {
|
|
172141
172155
|
...getCommonAttributes(config),
|
|
@@ -184647,7 +184661,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
184647
184661
|
};
|
|
184648
184662
|
}
|
|
184649
184663
|
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
184650
|
-
const version2 = "0.0.28-alpha.
|
|
184664
|
+
const version2 = "0.0.28-alpha.4";
|
|
184651
184665
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
184652
184666
|
const baseHeaders = {
|
|
184653
184667
|
"User-Agent": userAgent2
|
|
@@ -198987,7 +199001,11 @@ var init_shellReadOnlyChecker = __esm({
|
|
|
198987
199001
|
|
|
198988
199002
|
// packages/core/src/utils/shell-utils.ts
|
|
198989
199003
|
import os17 from "node:os";
|
|
198990
|
-
import {
|
|
199004
|
+
import {
|
|
199005
|
+
execFile as execFile6,
|
|
199006
|
+
execFileSync as execFileSync2
|
|
199007
|
+
} from "node:child_process";
|
|
199008
|
+
import { accessSync, constants as fsConstants2 } from "node:fs";
|
|
198991
199009
|
function getShellConfiguration() {
|
|
198992
199010
|
if (isWindows3()) {
|
|
198993
199011
|
const comSpec = process.env["ComSpec"] || "cmd.exe";
|
|
@@ -199235,6 +199253,61 @@ function checkCommandPermissions(command2, config, sessionAllowlist) {
|
|
|
199235
199253
|
}
|
|
199236
199254
|
return { allAllowed: true, disallowedCommands: [] };
|
|
199237
199255
|
}
|
|
199256
|
+
function execCommand(command2, args, options2 = {}) {
|
|
199257
|
+
return new Promise((resolve26, reject) => {
|
|
199258
|
+
const child = execFile6(
|
|
199259
|
+
command2,
|
|
199260
|
+
args,
|
|
199261
|
+
{ encoding: "utf8", ...options2 },
|
|
199262
|
+
(error, stdout, stderr) => {
|
|
199263
|
+
if (error) {
|
|
199264
|
+
if (!options2.preserveOutputOnError) {
|
|
199265
|
+
reject(error);
|
|
199266
|
+
} else {
|
|
199267
|
+
resolve26({
|
|
199268
|
+
stdout: stdout ?? "",
|
|
199269
|
+
stderr: stderr ?? "",
|
|
199270
|
+
code: typeof error.code === "number" ? error.code : 1
|
|
199271
|
+
});
|
|
199272
|
+
}
|
|
199273
|
+
return;
|
|
199274
|
+
}
|
|
199275
|
+
resolve26({ stdout: stdout ?? "", stderr: stderr ?? "", code: 0 });
|
|
199276
|
+
}
|
|
199277
|
+
);
|
|
199278
|
+
child.on("error", reject);
|
|
199279
|
+
});
|
|
199280
|
+
}
|
|
199281
|
+
function resolveCommandPath(command2) {
|
|
199282
|
+
try {
|
|
199283
|
+
const isWin = process.platform === "win32";
|
|
199284
|
+
const checkCommand = isWin ? "where" : "command";
|
|
199285
|
+
const checkArgs = isWin ? [command2] : ["-v", command2];
|
|
199286
|
+
let result = null;
|
|
199287
|
+
try {
|
|
199288
|
+
result = execFileSync2(checkCommand, checkArgs, {
|
|
199289
|
+
encoding: "utf8",
|
|
199290
|
+
shell: isWin
|
|
199291
|
+
}).trim();
|
|
199292
|
+
} catch {
|
|
199293
|
+
console.warn(`Command ${checkCommand} not found`);
|
|
199294
|
+
}
|
|
199295
|
+
if (!result) return { path: null, error: void 0 };
|
|
199296
|
+
if (!isWin) {
|
|
199297
|
+
accessSync(result, fsConstants2.X_OK);
|
|
199298
|
+
}
|
|
199299
|
+
return { path: result, error: void 0 };
|
|
199300
|
+
} catch (error) {
|
|
199301
|
+
return {
|
|
199302
|
+
path: null,
|
|
199303
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
199304
|
+
};
|
|
199305
|
+
}
|
|
199306
|
+
}
|
|
199307
|
+
function isCommandAvailable(command2) {
|
|
199308
|
+
const { path: path115, error } = resolveCommandPath(command2);
|
|
199309
|
+
return { available: path115 !== null, error };
|
|
199310
|
+
}
|
|
199238
199311
|
function isCommandAllowed(command2, config) {
|
|
199239
199312
|
const { allAllowed, blockReason } = checkCommandPermissions(command2, config);
|
|
199240
199313
|
if (allAllowed) {
|
|
@@ -199252,7 +199325,7 @@ function isCommandNeedsPermission(command2) {
|
|
|
199252
199325
|
reason: "Command requires permission to execute."
|
|
199253
199326
|
};
|
|
199254
199327
|
}
|
|
199255
|
-
var import_shell_quote2, SHELL_TOOL_NAMES2, isWindows3
|
|
199328
|
+
var import_shell_quote2, SHELL_TOOL_NAMES2, isWindows3;
|
|
199256
199329
|
var init_shell_utils = __esm({
|
|
199257
199330
|
"packages/core/src/utils/shell-utils.ts"() {
|
|
199258
199331
|
"use strict";
|
|
@@ -199270,28 +199343,9 @@ var init_shell_utils = __esm({
|
|
|
199270
199343
|
__name(stripShellWrapper, "stripShellWrapper");
|
|
199271
199344
|
__name(detectCommandSubstitution, "detectCommandSubstitution");
|
|
199272
199345
|
__name(checkCommandPermissions, "checkCommandPermissions");
|
|
199273
|
-
|
|
199274
|
-
|
|
199275
|
-
|
|
199276
|
-
let stderr = "";
|
|
199277
|
-
child.stdout.on("data", (data) => {
|
|
199278
|
-
stdout += data.toString();
|
|
199279
|
-
});
|
|
199280
|
-
child.stderr.on("data", (data) => {
|
|
199281
|
-
stderr += data.toString();
|
|
199282
|
-
});
|
|
199283
|
-
child.on("close", (code2) => {
|
|
199284
|
-
if (code2 === 0) {
|
|
199285
|
-
resolve26({ stdout, stderr });
|
|
199286
|
-
} else {
|
|
199287
|
-
reject(new Error(`Command failed with exit code ${code2}:
|
|
199288
|
-
${stderr}`));
|
|
199289
|
-
}
|
|
199290
|
-
});
|
|
199291
|
-
child.on("error", (err) => {
|
|
199292
|
-
reject(err);
|
|
199293
|
-
});
|
|
199294
|
-
}), "spawnAsync");
|
|
199346
|
+
__name(execCommand, "execCommand");
|
|
199347
|
+
__name(resolveCommandPath, "resolveCommandPath");
|
|
199348
|
+
__name(isCommandAvailable, "isCommandAvailable");
|
|
199295
199349
|
__name(isCommandAllowed, "isCommandAllowed");
|
|
199296
199350
|
__name(isCommandNeedsPermission, "isCommandNeedsPermission");
|
|
199297
199351
|
}
|
|
@@ -216872,7 +216926,7 @@ var require_dist5 = __commonJS({
|
|
|
216872
216926
|
|
|
216873
216927
|
// node_modules/simple-git/dist/esm/index.js
|
|
216874
216928
|
import { Buffer as Buffer22 } from "node:buffer";
|
|
216875
|
-
import { spawn as
|
|
216929
|
+
import { spawn as spawn2 } from "child_process";
|
|
216876
216930
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
216877
216931
|
function pathspec(...paths) {
|
|
216878
216932
|
const key = new String(paths);
|
|
@@ -219549,7 +219603,7 @@ var init_esm10 = __esm({
|
|
|
219549
219603
|
rejection = reason || rejection;
|
|
219550
219604
|
}
|
|
219551
219605
|
});
|
|
219552
|
-
const spawned =
|
|
219606
|
+
const spawned = spawn2(command2, args, spawnOptions);
|
|
219553
219607
|
spawned.stdout.on(
|
|
219554
219608
|
"data",
|
|
219555
219609
|
onDataReceived(stdOut, "stdOut", logger6, outputLogger.step("stdOut"))
|
|
@@ -221604,7 +221658,7 @@ var init_gitService = __esm({
|
|
|
221604
221658
|
return this.storage.getHistoryDir();
|
|
221605
221659
|
}
|
|
221606
221660
|
async initialize() {
|
|
221607
|
-
const gitAvailable =
|
|
221661
|
+
const { available: gitAvailable } = isCommandAvailable("git");
|
|
221608
221662
|
if (!gitAvailable) {
|
|
221609
221663
|
throw new Error(
|
|
221610
221664
|
"Checkpointing is enabled, but Git is not installed. Please install Git or disable checkpointing to continue."
|
|
@@ -221618,14 +221672,6 @@ var init_gitService = __esm({
|
|
|
221618
221672
|
);
|
|
221619
221673
|
}
|
|
221620
221674
|
}
|
|
221621
|
-
async verifyGitAvailability() {
|
|
221622
|
-
try {
|
|
221623
|
-
await spawnAsync("git", ["--version"]);
|
|
221624
|
-
return true;
|
|
221625
|
-
} catch (_error) {
|
|
221626
|
-
return false;
|
|
221627
|
-
}
|
|
221628
|
-
}
|
|
221629
221675
|
/**
|
|
221630
221676
|
* Creates a hidden git repository in the project root.
|
|
221631
221677
|
* The Git repository is used to support checkpointing.
|
|
@@ -232659,13 +232705,13 @@ var require_cross_spawn = __commonJS({
|
|
|
232659
232705
|
var cp2 = __require("child_process");
|
|
232660
232706
|
var parse12 = require_parse5();
|
|
232661
232707
|
var enoent = require_enoent();
|
|
232662
|
-
function
|
|
232708
|
+
function spawn11(command2, args, options2) {
|
|
232663
232709
|
const parsed = parse12(command2, args, options2);
|
|
232664
232710
|
const spawned = cp2.spawn(parsed.command, parsed.args, parsed.options);
|
|
232665
232711
|
enoent.hookChildProcess(spawned, parsed);
|
|
232666
232712
|
return spawned;
|
|
232667
232713
|
}
|
|
232668
|
-
__name(
|
|
232714
|
+
__name(spawn11, "spawn");
|
|
232669
232715
|
function spawnSync5(command2, args, options2) {
|
|
232670
232716
|
const parsed = parse12(command2, args, options2);
|
|
232671
232717
|
const result = cp2.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
@@ -232673,8 +232719,8 @@ var require_cross_spawn = __commonJS({
|
|
|
232673
232719
|
return result;
|
|
232674
232720
|
}
|
|
232675
232721
|
__name(spawnSync5, "spawnSync");
|
|
232676
|
-
module2.exports =
|
|
232677
|
-
module2.exports.spawn =
|
|
232722
|
+
module2.exports = spawn11;
|
|
232723
|
+
module2.exports.spawn = spawn11;
|
|
232678
232724
|
module2.exports.sync = spawnSync5;
|
|
232679
232725
|
module2.exports._parse = parse12;
|
|
232680
232726
|
module2.exports._enoent = enoent;
|
|
@@ -234706,7 +234752,7 @@ ${fileListDescription}`;
|
|
|
234706
234752
|
import fsPromises2 from "node:fs/promises";
|
|
234707
234753
|
import path38 from "node:path";
|
|
234708
234754
|
import { EOL as EOL2 } from "node:os";
|
|
234709
|
-
import { spawn as
|
|
234755
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
234710
234756
|
var GrepToolInvocation, GrepTool;
|
|
234711
234757
|
var init_grep2 = __esm({
|
|
234712
234758
|
"packages/core/src/tools/grep.ts"() {
|
|
@@ -234719,6 +234765,7 @@ var init_grep2 = __esm({
|
|
|
234719
234765
|
init_errors();
|
|
234720
234766
|
init_gitUtils();
|
|
234721
234767
|
init_tool_error();
|
|
234768
|
+
init_shell_utils();
|
|
234722
234769
|
GrepToolInvocation = class extends BaseToolInvocation {
|
|
234723
234770
|
constructor(config, params) {
|
|
234724
234771
|
super(params);
|
|
@@ -234822,27 +234869,6 @@ var init_grep2 = __esm({
|
|
|
234822
234869
|
};
|
|
234823
234870
|
}
|
|
234824
234871
|
}
|
|
234825
|
-
/**
|
|
234826
|
-
* Checks if a command is available in the system's PATH.
|
|
234827
|
-
* @param {string} command The command name (e.g., 'git', 'grep').
|
|
234828
|
-
* @returns {Promise<boolean>} True if the command is available, false otherwise.
|
|
234829
|
-
*/
|
|
234830
|
-
isCommandAvailable(command2) {
|
|
234831
|
-
return new Promise((resolve26) => {
|
|
234832
|
-
const checkCommand = process.platform === "win32" ? "where" : "command";
|
|
234833
|
-
const checkArgs = process.platform === "win32" ? [command2] : ["-v", command2];
|
|
234834
|
-
try {
|
|
234835
|
-
const child = spawn5(checkCommand, checkArgs, {
|
|
234836
|
-
stdio: "ignore",
|
|
234837
|
-
shell: process.platform === "win32"
|
|
234838
|
-
});
|
|
234839
|
-
child.on("close", (code2) => resolve26(code2 === 0));
|
|
234840
|
-
child.on("error", () => resolve26(false));
|
|
234841
|
-
} catch {
|
|
234842
|
-
resolve26(false);
|
|
234843
|
-
}
|
|
234844
|
-
});
|
|
234845
|
-
}
|
|
234846
234872
|
/**
|
|
234847
234873
|
* Parses the standard output of grep-like commands (git grep, system grep).
|
|
234848
234874
|
* Expects format: filePath:lineNumber:lineContent
|
|
@@ -234901,7 +234927,7 @@ var init_grep2 = __esm({
|
|
|
234901
234927
|
let strategyUsed = "none";
|
|
234902
234928
|
try {
|
|
234903
234929
|
const isGit = isGitRepository(absolutePath);
|
|
234904
|
-
const gitAvailable = isGit &&
|
|
234930
|
+
const gitAvailable = isGit && isCommandAvailable("git").available;
|
|
234905
234931
|
if (gitAvailable) {
|
|
234906
234932
|
strategyUsed = "git grep";
|
|
234907
234933
|
const gitArgs = [
|
|
@@ -234917,7 +234943,7 @@ var init_grep2 = __esm({
|
|
|
234917
234943
|
}
|
|
234918
234944
|
try {
|
|
234919
234945
|
const output = await new Promise((resolve26, reject) => {
|
|
234920
|
-
const child =
|
|
234946
|
+
const child = spawn4("git", gitArgs, {
|
|
234921
234947
|
cwd: absolutePath,
|
|
234922
234948
|
windowsHide: true
|
|
234923
234949
|
});
|
|
@@ -234950,7 +234976,7 @@ var init_grep2 = __esm({
|
|
|
234950
234976
|
);
|
|
234951
234977
|
}
|
|
234952
234978
|
}
|
|
234953
|
-
const grepAvailable =
|
|
234979
|
+
const { available: grepAvailable } = isCommandAvailable("grep");
|
|
234954
234980
|
if (grepAvailable) {
|
|
234955
234981
|
strategyUsed = "system grep";
|
|
234956
234982
|
const grepArgs = ["-r", "-n", "-H", "-E"];
|
|
@@ -234978,7 +235004,7 @@ var init_grep2 = __esm({
|
|
|
234978
235004
|
grepArgs.push(".");
|
|
234979
235005
|
try {
|
|
234980
235006
|
const output = await new Promise((resolve26, reject) => {
|
|
234981
|
-
const child =
|
|
235007
|
+
const child = spawn4("grep", grepArgs, {
|
|
234982
235008
|
cwd: absolutePath,
|
|
234983
235009
|
windowsHide: true
|
|
234984
235010
|
});
|
|
@@ -235801,6 +235827,10 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
235801
235827
|
// packages/core/src/utils/ripgrepUtils.ts
|
|
235802
235828
|
import path41 from "node:path";
|
|
235803
235829
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
235830
|
+
import { execFile as execFile7 } from "node:child_process";
|
|
235831
|
+
function wslTimeout() {
|
|
235832
|
+
return process.platform === "linux" && process.env["WSL_INTEROP"] ? RIPGREP_WSL_TIMEOUT_MS : RIPGREP_RUN_TIMEOUT_MS;
|
|
235833
|
+
}
|
|
235804
235834
|
function getPlatformString(platform15) {
|
|
235805
235835
|
switch (platform15) {
|
|
235806
235836
|
case "darwin":
|
|
@@ -235846,58 +235876,162 @@ function getBuiltinRipgrep() {
|
|
|
235846
235876
|
);
|
|
235847
235877
|
return vendorPath;
|
|
235848
235878
|
}
|
|
235849
|
-
async function
|
|
235850
|
-
|
|
235851
|
-
|
|
235852
|
-
const
|
|
235853
|
-
|
|
235854
|
-
|
|
235855
|
-
|
|
235856
|
-
|
|
235857
|
-
|
|
235858
|
-
|
|
235859
|
-
|
|
235860
|
-
|
|
235879
|
+
async function resolveRipgrep(useBuiltin = true) {
|
|
235880
|
+
if (cachedSelection) return cachedSelection;
|
|
235881
|
+
if (useBuiltin) {
|
|
235882
|
+
const rgPath = getBuiltinRipgrep();
|
|
235883
|
+
if (rgPath && await fileExists(rgPath)) {
|
|
235884
|
+
cachedSelection = { mode: "builtin", command: rgPath };
|
|
235885
|
+
return cachedSelection;
|
|
235886
|
+
}
|
|
235887
|
+
}
|
|
235888
|
+
const { available, error } = isCommandAvailable(RIPGREP_COMMAND);
|
|
235889
|
+
if (available) {
|
|
235890
|
+
cachedSelection = { mode: "system", command: RIPGREP_COMMAND };
|
|
235891
|
+
return cachedSelection;
|
|
235892
|
+
}
|
|
235893
|
+
if (error) {
|
|
235894
|
+
throw error;
|
|
235861
235895
|
}
|
|
235896
|
+
return null;
|
|
235862
235897
|
}
|
|
235863
|
-
async function
|
|
235898
|
+
async function ensureRipgrepHealthy(selection) {
|
|
235899
|
+
if (cachedHealth && cachedHealth.selection.command === selection.command && cachedHealth.working)
|
|
235900
|
+
return;
|
|
235864
235901
|
try {
|
|
235865
|
-
|
|
235866
|
-
|
|
235867
|
-
|
|
235868
|
-
|
|
235902
|
+
const { stdout, code: code2 } = await execCommand(
|
|
235903
|
+
selection.command,
|
|
235904
|
+
["--version"],
|
|
235905
|
+
{
|
|
235906
|
+
timeout: RIPGREP_TEST_TIMEOUT_MS
|
|
235869
235907
|
}
|
|
235870
|
-
|
|
235871
|
-
|
|
235872
|
-
|
|
235873
|
-
|
|
235908
|
+
);
|
|
235909
|
+
const working = code2 === 0 && stdout.startsWith("ripgrep");
|
|
235910
|
+
cachedHealth = { working, lastTested: Date.now(), selection };
|
|
235911
|
+
} catch (error) {
|
|
235912
|
+
cachedHealth = { working: false, lastTested: Date.now(), selection };
|
|
235913
|
+
throw error;
|
|
235874
235914
|
}
|
|
235875
235915
|
}
|
|
235916
|
+
async function ensureMacBinarySigned(selection) {
|
|
235917
|
+
if (process.platform !== "darwin") return;
|
|
235918
|
+
if (macSigningAttempted) return;
|
|
235919
|
+
macSigningAttempted = true;
|
|
235920
|
+
if (selection.mode !== "builtin") return;
|
|
235921
|
+
const binaryPath = selection.command;
|
|
235922
|
+
const inspect2 = await execCommand("codesign", ["-vv", "-d", binaryPath], {
|
|
235923
|
+
preserveOutputOnError: false
|
|
235924
|
+
});
|
|
235925
|
+
const alreadySigned = inspect2.stdout?.split("\n").some((line) => line.includes("linker-signed")) ?? false;
|
|
235926
|
+
if (!alreadySigned) return;
|
|
235927
|
+
await execCommand("codesign", [
|
|
235928
|
+
"--sign",
|
|
235929
|
+
"-",
|
|
235930
|
+
"--force",
|
|
235931
|
+
"--preserve-metadata=entitlements,requirements,flags,runtime",
|
|
235932
|
+
binaryPath
|
|
235933
|
+
]);
|
|
235934
|
+
await execCommand("xattr", ["-d", "com.apple.quarantine", binaryPath]);
|
|
235935
|
+
}
|
|
235876
235936
|
async function canUseRipgrep(useBuiltin = true) {
|
|
235877
|
-
const
|
|
235878
|
-
|
|
235937
|
+
const selection = await resolveRipgrep(useBuiltin);
|
|
235938
|
+
if (!selection) {
|
|
235939
|
+
return false;
|
|
235940
|
+
}
|
|
235941
|
+
await ensureRipgrepHealthy(selection);
|
|
235942
|
+
return true;
|
|
235879
235943
|
}
|
|
235880
|
-
|
|
235944
|
+
async function runRipgrep(args, signal) {
|
|
235945
|
+
const selection = await resolveRipgrep();
|
|
235946
|
+
if (!selection) {
|
|
235947
|
+
throw new Error("ripgrep not found.");
|
|
235948
|
+
}
|
|
235949
|
+
await ensureRipgrepHealthy(selection);
|
|
235950
|
+
return new Promise((resolve26) => {
|
|
235951
|
+
const child = execFile7(
|
|
235952
|
+
selection.command,
|
|
235953
|
+
args,
|
|
235954
|
+
{
|
|
235955
|
+
maxBuffer: RIPGREP_BUFFER_LIMIT,
|
|
235956
|
+
timeout: wslTimeout(),
|
|
235957
|
+
signal
|
|
235958
|
+
},
|
|
235959
|
+
(error, stdout = "", stderr = "") => {
|
|
235960
|
+
if (!error) {
|
|
235961
|
+
resolve26({
|
|
235962
|
+
stdout,
|
|
235963
|
+
truncated: false
|
|
235964
|
+
});
|
|
235965
|
+
return;
|
|
235966
|
+
}
|
|
235967
|
+
const errorCode = error.code;
|
|
235968
|
+
if (errorCode === 1) {
|
|
235969
|
+
resolve26({ stdout: "", truncated: false });
|
|
235970
|
+
return;
|
|
235971
|
+
}
|
|
235972
|
+
const wasKilled = error.signal === "SIGTERM" || error.name === "AbortError";
|
|
235973
|
+
const overflow = errorCode === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
235974
|
+
const syntaxError2 = errorCode === 2;
|
|
235975
|
+
const truncated = wasKilled || overflow;
|
|
235976
|
+
let partialOutput = stdout;
|
|
235977
|
+
if (truncated && partialOutput.length > 0) {
|
|
235978
|
+
const lines = partialOutput.split("\n");
|
|
235979
|
+
if (lines.length > 0) {
|
|
235980
|
+
lines.pop();
|
|
235981
|
+
partialOutput = lines.join("\n");
|
|
235982
|
+
}
|
|
235983
|
+
}
|
|
235984
|
+
if (!syntaxError2 && truncated) {
|
|
235985
|
+
console.warn(
|
|
235986
|
+
`ripgrep exited abnormally (signal=${error.signal} code=${error.code}) with stderr:
|
|
235987
|
+
${stderr.trim() || "(empty)"}`
|
|
235988
|
+
);
|
|
235989
|
+
}
|
|
235990
|
+
resolve26({
|
|
235991
|
+
stdout: partialOutput,
|
|
235992
|
+
truncated,
|
|
235993
|
+
error: error instanceof Error ? error : void 0
|
|
235994
|
+
});
|
|
235995
|
+
}
|
|
235996
|
+
);
|
|
235997
|
+
child.on(
|
|
235998
|
+
"error",
|
|
235999
|
+
(err) => resolve26({ stdout: "", truncated: false, error: err })
|
|
236000
|
+
);
|
|
236001
|
+
});
|
|
236002
|
+
}
|
|
236003
|
+
var RIPGREP_COMMAND, RIPGREP_BUFFER_LIMIT, RIPGREP_TEST_TIMEOUT_MS, RIPGREP_RUN_TIMEOUT_MS, RIPGREP_WSL_TIMEOUT_MS, cachedSelection, cachedHealth, macSigningAttempted, __filename2, __dirname3;
|
|
235881
236004
|
var init_ripgrepUtils = __esm({
|
|
235882
236005
|
"packages/core/src/utils/ripgrepUtils.ts"() {
|
|
235883
236006
|
"use strict";
|
|
235884
236007
|
init_esbuild_shims();
|
|
235885
236008
|
init_fileUtils();
|
|
236009
|
+
init_shell_utils();
|
|
236010
|
+
RIPGREP_COMMAND = "rg";
|
|
236011
|
+
RIPGREP_BUFFER_LIMIT = 2e7;
|
|
236012
|
+
RIPGREP_TEST_TIMEOUT_MS = 5e3;
|
|
236013
|
+
RIPGREP_RUN_TIMEOUT_MS = 1e4;
|
|
236014
|
+
RIPGREP_WSL_TIMEOUT_MS = 6e4;
|
|
236015
|
+
cachedSelection = null;
|
|
236016
|
+
cachedHealth = null;
|
|
236017
|
+
macSigningAttempted = false;
|
|
236018
|
+
__name(wslTimeout, "wslTimeout");
|
|
235886
236019
|
__filename2 = fileURLToPath5(import.meta.url);
|
|
235887
236020
|
__dirname3 = path41.dirname(__filename2);
|
|
235888
236021
|
__name(getPlatformString, "getPlatformString");
|
|
235889
236022
|
__name(getArchitectureString, "getArchitectureString");
|
|
235890
236023
|
__name(getBuiltinRipgrep, "getBuiltinRipgrep");
|
|
235891
|
-
__name(
|
|
235892
|
-
__name(
|
|
236024
|
+
__name(resolveRipgrep, "resolveRipgrep");
|
|
236025
|
+
__name(ensureRipgrepHealthy, "ensureRipgrepHealthy");
|
|
236026
|
+
__name(ensureMacBinarySigned, "ensureMacBinarySigned");
|
|
235893
236027
|
__name(canUseRipgrep, "canUseRipgrep");
|
|
236028
|
+
__name(runRipgrep, "runRipgrep");
|
|
235894
236029
|
}
|
|
235895
236030
|
});
|
|
235896
236031
|
|
|
235897
236032
|
// packages/core/src/tools/ripGrep.ts
|
|
235898
236033
|
import fs38 from "node:fs";
|
|
235899
236034
|
import path42 from "node:path";
|
|
235900
|
-
import { spawn as spawn6 } from "node:child_process";
|
|
235901
236035
|
var GrepToolInvocation2, RipGrepTool;
|
|
235902
236036
|
var init_ripGrep = __esm({
|
|
235903
236037
|
"packages/core/src/tools/ripGrep.ts"() {
|
|
@@ -236032,51 +236166,11 @@ var init_ripGrep = __esm({
|
|
|
236032
236166
|
}
|
|
236033
236167
|
rgArgs.push("--threads", "4");
|
|
236034
236168
|
rgArgs.push(absolutePath);
|
|
236035
|
-
|
|
236036
|
-
|
|
236037
|
-
|
|
236038
|
-
);
|
|
236039
|
-
if (!rgCommand) {
|
|
236040
|
-
throw new Error("ripgrep binary not found.");
|
|
236041
|
-
}
|
|
236042
|
-
const output = await new Promise((resolve26, reject) => {
|
|
236043
|
-
const child = spawn6(rgCommand, rgArgs, {
|
|
236044
|
-
windowsHide: true
|
|
236045
|
-
});
|
|
236046
|
-
const stdoutChunks = [];
|
|
236047
|
-
const stderrChunks = [];
|
|
236048
|
-
const cleanup = /* @__PURE__ */ __name(() => {
|
|
236049
|
-
if (options2.signal.aborted) {
|
|
236050
|
-
child.kill();
|
|
236051
|
-
}
|
|
236052
|
-
}, "cleanup");
|
|
236053
|
-
options2.signal.addEventListener("abort", cleanup, { once: true });
|
|
236054
|
-
child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
236055
|
-
child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
|
|
236056
|
-
child.on("error", (err) => {
|
|
236057
|
-
options2.signal.removeEventListener("abort", cleanup);
|
|
236058
|
-
reject(new Error(`failed to start ripgrep: ${err.message}.`));
|
|
236059
|
-
});
|
|
236060
|
-
child.on("close", (code2) => {
|
|
236061
|
-
options2.signal.removeEventListener("abort", cleanup);
|
|
236062
|
-
const stdoutData = Buffer.concat(stdoutChunks).toString("utf8");
|
|
236063
|
-
const stderrData = Buffer.concat(stderrChunks).toString("utf8");
|
|
236064
|
-
if (code2 === 0) {
|
|
236065
|
-
resolve26(stdoutData);
|
|
236066
|
-
} else if (code2 === 1) {
|
|
236067
|
-
resolve26("");
|
|
236068
|
-
} else {
|
|
236069
|
-
reject(
|
|
236070
|
-
new Error(`ripgrep exited with code ${code2}: ${stderrData}`)
|
|
236071
|
-
);
|
|
236072
|
-
}
|
|
236073
|
-
});
|
|
236074
|
-
});
|
|
236075
|
-
return output;
|
|
236076
|
-
} catch (error) {
|
|
236077
|
-
console.error(`Ripgrep failed: ${getErrorMessage(error)}`);
|
|
236078
|
-
throw error;
|
|
236169
|
+
const result = await runRipgrep(rgArgs, options2.signal);
|
|
236170
|
+
if (result.error && !result.stdout) {
|
|
236171
|
+
throw result.error;
|
|
236079
236172
|
}
|
|
236173
|
+
return result.stdout;
|
|
236080
236174
|
}
|
|
236081
236175
|
getFileFilteringOptions() {
|
|
236082
236176
|
const options2 = this.config.getFileFilteringOptions?.();
|
|
@@ -238455,7 +238549,7 @@ var init_sa_impersonation_provider = __esm({
|
|
|
238455
238549
|
});
|
|
238456
238550
|
|
|
238457
238551
|
// packages/core/src/utils/secure-browser-launcher.ts
|
|
238458
|
-
import { execFile as
|
|
238552
|
+
import { execFile as execFile8 } from "node:child_process";
|
|
238459
238553
|
import { promisify as promisify6 } from "node:util";
|
|
238460
238554
|
import { platform as platform5 } from "node:os";
|
|
238461
238555
|
import { URL as URL3 } from "node:url";
|
|
@@ -238568,7 +238662,7 @@ var init_secure_browser_launcher = __esm({
|
|
|
238568
238662
|
"packages/core/src/utils/secure-browser-launcher.ts"() {
|
|
238569
238663
|
"use strict";
|
|
238570
238664
|
init_esbuild_shims();
|
|
238571
|
-
execFileAsync5 = promisify6(
|
|
238665
|
+
execFileAsync5 = promisify6(execFile8);
|
|
238572
238666
|
__name(validateUrl, "validateUrl");
|
|
238573
238667
|
__name(openBrowserSecurely, "openBrowserSecurely");
|
|
238574
238668
|
__name(shouldLaunchBrowser, "shouldLaunchBrowser");
|
|
@@ -240708,7 +240802,7 @@ var init_mcp_client_manager = __esm({
|
|
|
240708
240802
|
});
|
|
240709
240803
|
|
|
240710
240804
|
// packages/core/src/tools/tool-registry.ts
|
|
240711
|
-
import { spawn as
|
|
240805
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
240712
240806
|
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
240713
240807
|
var import_shell_quote4, DiscoveredToolInvocation, DiscoveredTool, ToolRegistry;
|
|
240714
240808
|
var init_tool_registry = __esm({
|
|
@@ -240736,7 +240830,7 @@ var init_tool_registry = __esm({
|
|
|
240736
240830
|
}
|
|
240737
240831
|
async execute(_signal, _updateOutput) {
|
|
240738
240832
|
const callCommand = this.config.getToolCallCommand();
|
|
240739
|
-
const child =
|
|
240833
|
+
const child = spawn5(callCommand, [this.toolName]);
|
|
240740
240834
|
child.stdin.write(JSON.stringify(this.params));
|
|
240741
240835
|
child.stdin.end();
|
|
240742
240836
|
let stdout = "";
|
|
@@ -240957,7 +241051,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
|
|
|
240957
241051
|
"Tool discovery command is empty or contains only whitespace."
|
|
240958
241052
|
);
|
|
240959
241053
|
}
|
|
240960
|
-
const proc2 =
|
|
241054
|
+
const proc2 = spawn5(cmdParts[0], cmdParts.slice(1));
|
|
240961
241055
|
let stdout = "";
|
|
240962
241056
|
const stdoutDecoder = new StringDecoder2("utf8");
|
|
240963
241057
|
let stderr = "";
|
|
@@ -249468,6 +249562,7 @@ var init_config3 = __esm({
|
|
|
249468
249562
|
init_ignorePatterns();
|
|
249469
249563
|
init_workspaceContext();
|
|
249470
249564
|
init_tool_utils();
|
|
249565
|
+
init_errors();
|
|
249471
249566
|
init_constants3();
|
|
249472
249567
|
init_models();
|
|
249473
249568
|
init_storage();
|
|
@@ -249583,7 +249678,6 @@ var init_config3 = __esm({
|
|
|
249583
249678
|
skipNextSpeakerCheck;
|
|
249584
249679
|
shellExecutionConfig;
|
|
249585
249680
|
extensionManagement = true;
|
|
249586
|
-
enablePromptCompletion = false;
|
|
249587
249681
|
skipLoopDetection;
|
|
249588
249682
|
skipStartupContext;
|
|
249589
249683
|
vlmSwitchMode;
|
|
@@ -249689,7 +249783,6 @@ var init_config3 = __esm({
|
|
|
249689
249783
|
this.useSmartEdit = params.useSmartEdit ?? false;
|
|
249690
249784
|
this.extensionManagement = params.extensionManagement ?? true;
|
|
249691
249785
|
this.storage = new Storage(this.targetDir);
|
|
249692
|
-
this.enablePromptCompletion = params.enablePromptCompletion ?? false;
|
|
249693
249786
|
this.vlmSwitchMode = params.vlmSwitchMode;
|
|
249694
249787
|
this.fileExclusions = new FileExclusions(this);
|
|
249695
249788
|
this.eventEmitter = params.eventEmitter;
|
|
@@ -250081,9 +250174,6 @@ var init_config3 = __esm({
|
|
|
250081
250174
|
getScreenReader() {
|
|
250082
250175
|
return this.accessibility.screenReader ?? false;
|
|
250083
250176
|
}
|
|
250084
|
-
getEnablePromptCompletion() {
|
|
250085
|
-
return this.enablePromptCompletion;
|
|
250086
|
-
}
|
|
250087
250177
|
getSkipLoopDetection() {
|
|
250088
250178
|
return this.skipLoopDetection;
|
|
250089
250179
|
}
|
|
@@ -250165,13 +250255,19 @@ var init_config3 = __esm({
|
|
|
250165
250255
|
try {
|
|
250166
250256
|
useRipgrep = await canUseRipgrep(this.getUseBuiltinRipgrep());
|
|
250167
250257
|
} catch (error) {
|
|
250168
|
-
errorString =
|
|
250258
|
+
errorString = getErrorMessage(error);
|
|
250169
250259
|
}
|
|
250170
250260
|
if (useRipgrep) {
|
|
250171
250261
|
registerCoreTool(RipGrepTool, this);
|
|
250172
250262
|
} else {
|
|
250173
|
-
|
|
250174
|
-
|
|
250263
|
+
logRipgrepFallback(
|
|
250264
|
+
this,
|
|
250265
|
+
new RipgrepFallbackEvent(
|
|
250266
|
+
this.getUseRipgrep(),
|
|
250267
|
+
this.getUseBuiltinRipgrep(),
|
|
250268
|
+
errorString || "ripgrep is not available"
|
|
250269
|
+
)
|
|
250270
|
+
);
|
|
250175
250271
|
registerCoreTool(GrepTool, this);
|
|
250176
250272
|
}
|
|
250177
250273
|
} else {
|
|
@@ -250921,33 +251017,26 @@ function encryptApiKey(plaintext2) {
|
|
|
250921
251017
|
}
|
|
250922
251018
|
function decryptApiKey(ciphertext) {
|
|
250923
251019
|
if (!ciphertext || ciphertext.trim() === "") {
|
|
250924
|
-
console.log("[ApiKeyEncryption] decryptApiKey: \u7A7A\u5B57\u7B26\u4E32\uFF0C\u76F4\u63A5\u8FD4\u56DE");
|
|
250925
251020
|
return ciphertext;
|
|
250926
251021
|
}
|
|
250927
251022
|
if (!ciphertext.startsWith("xhs_enc:")) {
|
|
250928
|
-
console.log("[ApiKeyEncryption] decryptApiKey: \u4E0D\u662F\u52A0\u5BC6\u683C\u5F0F\uFF0C\u76F4\u63A5\u8FD4\u56DE\u660E\u6587");
|
|
250929
251023
|
return ciphertext;
|
|
250930
251024
|
}
|
|
250931
|
-
console.log("[ApiKeyEncryption] decryptApiKey: \u68C0\u6D4B\u5230\u52A0\u5BC6\u683C\u5F0F\uFF0C\u5F00\u59CB\u89E3\u5BC6...");
|
|
250932
251025
|
try {
|
|
250933
251026
|
const parts = ciphertext.substring(8).split(":");
|
|
250934
251027
|
if (parts.length !== 3) {
|
|
250935
|
-
throw new Error(
|
|
251028
|
+
throw new Error("\u65E0\u6548\u7684\u52A0\u5BC6\u683C\u5F0F");
|
|
250936
251029
|
}
|
|
250937
251030
|
const [ivBase64, authTagBase64, encryptedBase64] = parts;
|
|
250938
251031
|
const iv = Buffer.from(ivBase64, "base64");
|
|
250939
251032
|
const authTag = Buffer.from(authTagBase64, "base64");
|
|
250940
251033
|
const encrypted = Buffer.from(encryptedBase64, "base64");
|
|
250941
|
-
console.log("[ApiKeyEncryption] decryptApiKey: Base64 \u89E3\u7801\u6210\u529F");
|
|
250942
251034
|
const decipher = crypto15.createDecipheriv("aes-256-gcm", FIXED_KEY, iv);
|
|
250943
251035
|
decipher.setAuthTag(authTag);
|
|
250944
251036
|
let decrypted = decipher.update(encrypted);
|
|
250945
251037
|
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
250946
|
-
|
|
250947
|
-
console.log(`[ApiKeyEncryption] decryptApiKey: \u2705 \u89E3\u5BC6\u6210\u529F: ${plaintext2.substring(0, 8)}...${plaintext2.slice(-8)}`);
|
|
250948
|
-
return plaintext2;
|
|
251038
|
+
return decrypted.toString("utf8");
|
|
250949
251039
|
} catch (error) {
|
|
250950
|
-
console.error("[ApiKeyEncryption] decryptApiKey: \u274C \u89E3\u5BC6\u5931\u8D25:", error);
|
|
250951
251040
|
throw new Error(
|
|
250952
251041
|
`API Key \u89E3\u5BC6\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}\u3002\u8BF7\u91CD\u65B0\u8FDB\u884C SSO \u8BA4\u8BC1\u3002`
|
|
250953
251042
|
);
|
|
@@ -258980,8 +259069,8 @@ var init_git_commit = __esm({
|
|
|
258980
259069
|
"packages/core/src/generated/git-commit.ts"() {
|
|
258981
259070
|
"use strict";
|
|
258982
259071
|
init_esbuild_shims();
|
|
258983
|
-
GIT_COMMIT_INFO = "
|
|
258984
|
-
CLI_VERSION = "0.0.28-alpha.
|
|
259072
|
+
GIT_COMMIT_INFO = "a0e0781";
|
|
259073
|
+
CLI_VERSION = "0.0.28-alpha.4";
|
|
258985
259074
|
}
|
|
258986
259075
|
});
|
|
258987
259076
|
|
|
@@ -260079,8 +260168,11 @@ __export(core_exports2, {
|
|
|
260079
260168
|
discoverTools: () => discoverTools,
|
|
260080
260169
|
encodeTagName: () => encodeTagName,
|
|
260081
260170
|
encryptApiKey: () => encryptApiKey,
|
|
260171
|
+
ensureMacBinarySigned: () => ensureMacBinarySigned,
|
|
260172
|
+
ensureRipgrepHealthy: () => ensureRipgrepHealthy,
|
|
260082
260173
|
escapePath: () => escapePath,
|
|
260083
260174
|
escapeShellArg: () => escapeShellArg,
|
|
260175
|
+
execCommand: () => execCommand,
|
|
260084
260176
|
executeToolCall: () => executeToolCall,
|
|
260085
260177
|
extractExtensionsFromPatterns: () => extractExtensionsFromPatterns,
|
|
260086
260178
|
fetchModelKey: () => fetchModelKey,
|
|
@@ -260128,7 +260220,6 @@ __export(core_exports2, {
|
|
|
260128
260220
|
getQwenOAuthClient: () => getQwenOAuthClient,
|
|
260129
260221
|
getResponseText: () => getResponseText,
|
|
260130
260222
|
getResponseTextFromParts: () => getResponseTextFromParts,
|
|
260131
|
-
getRipgrepCommand: () => getRipgrepCommand,
|
|
260132
260223
|
getShellConfiguration: () => getShellConfiguration,
|
|
260133
260224
|
getSpecificMimeType: () => getSpecificMimeType,
|
|
260134
260225
|
getStructuredResponse: () => getStructuredResponse,
|
|
@@ -260136,7 +260227,6 @@ __export(core_exports2, {
|
|
|
260136
260227
|
getSubagentSystemReminder: () => getSubagentSystemReminder,
|
|
260137
260228
|
getSupportedImageFormatsString: () => getSupportedImageFormatsString,
|
|
260138
260229
|
getSystemEncoding: () => getSystemEncoding,
|
|
260139
|
-
getSystemRipgrep: () => getSystemRipgrep,
|
|
260140
260230
|
getUnsupportedImageFormatWarning: () => getUnsupportedImageFormatWarning,
|
|
260141
260231
|
hasCycleInSchema: () => hasCycleInSchema,
|
|
260142
260232
|
hasNetworkTransport: () => hasNetworkTransport,
|
|
@@ -260147,6 +260237,7 @@ __export(core_exports2, {
|
|
|
260147
260237
|
isBinary: () => isBinary,
|
|
260148
260238
|
isBinaryFile: () => isBinaryFile,
|
|
260149
260239
|
isCommandAllowed: () => isCommandAllowed,
|
|
260240
|
+
isCommandAvailable: () => isCommandAvailable,
|
|
260150
260241
|
isCommandNeedsPermission: () => isCommandNeedsPermission,
|
|
260151
260242
|
isDeviceAuthorizationSuccess: () => isDeviceAuthorizationSuccess,
|
|
260152
260243
|
isDeviceTokenPending: () => isDeviceTokenPending,
|
|
@@ -260253,10 +260344,13 @@ __export(core_exports2, {
|
|
|
260253
260344
|
resetEncodingCache: () => resetEncodingCache,
|
|
260254
260345
|
resetOauthClientForTesting: () => resetOauthClientForTesting,
|
|
260255
260346
|
resolveAndValidatePath: () => resolveAndValidatePath,
|
|
260347
|
+
resolveCommandPath: () => resolveCommandPath,
|
|
260256
260348
|
resolvePath: () => resolvePath,
|
|
260257
260349
|
resolvePathFromEnv: () => resolvePathFromEnv,
|
|
260350
|
+
resolveRipgrep: () => resolveRipgrep,
|
|
260258
260351
|
resolveTelemetrySettings: () => resolveTelemetrySettings,
|
|
260259
260352
|
retryWithBackoff: () => retryWithBackoff,
|
|
260353
|
+
runRipgrep: () => runRipgrep,
|
|
260260
260354
|
safeLiteralReplace: () => safeLiteralReplace,
|
|
260261
260355
|
saveAPIKey: () => saveAPIKey,
|
|
260262
260356
|
saveSSOCredentials: () => saveSSOCredentials,
|
|
@@ -260271,7 +260365,6 @@ __export(core_exports2, {
|
|
|
260271
260365
|
shouldTriggerAutoSSOAuth: () => shouldTriggerAutoSSOAuth,
|
|
260272
260366
|
shutdownTelemetry: () => shutdownTelemetry,
|
|
260273
260367
|
sortFileEntries: () => sortFileEntries,
|
|
260274
|
-
spawnAsync: () => spawnAsync,
|
|
260275
260368
|
splitCommands: () => splitCommands,
|
|
260276
260369
|
ssoAuthEvents: () => ssoAuthEvents,
|
|
260277
260370
|
stripShellWrapper: () => stripShellWrapper,
|
|
@@ -269731,15 +269824,6 @@ var init_settingsSchema = __esm({
|
|
|
269731
269824
|
}
|
|
269732
269825
|
}
|
|
269733
269826
|
},
|
|
269734
|
-
enablePromptCompletion: {
|
|
269735
|
-
type: "boolean",
|
|
269736
|
-
label: "Enable Prompt Completion",
|
|
269737
|
-
category: "General",
|
|
269738
|
-
requiresRestart: true,
|
|
269739
|
-
default: false,
|
|
269740
|
-
description: "Enable AI-powered prompt completion suggestions while typing.",
|
|
269741
|
-
showInDialog: true
|
|
269742
|
-
},
|
|
269743
269827
|
debugKeystrokeLogging: {
|
|
269744
269828
|
type: "boolean",
|
|
269745
269829
|
label: "Debug Keystroke Logging",
|
|
@@ -287716,7 +287800,6 @@ var init_settings = __esm({
|
|
|
287716
287800
|
disableAutoUpdate: "general.disableAutoUpdate",
|
|
287717
287801
|
disableUpdateNag: "general.disableUpdateNag",
|
|
287718
287802
|
dnsResolutionOrder: "advanced.dnsResolutionOrder",
|
|
287719
|
-
enablePromptCompletion: "general.enablePromptCompletion",
|
|
287720
287803
|
enforcedAuthType: "security.auth.enforcedType",
|
|
287721
287804
|
excludeTools: "tools.exclude",
|
|
287722
287805
|
excludeMCPServers: "mcp.excluded",
|
|
@@ -293882,7 +293965,7 @@ var require_command_exists = __commonJS({
|
|
|
293882
293965
|
var fs103 = __require("fs");
|
|
293883
293966
|
var path115 = __require("path");
|
|
293884
293967
|
var access6 = fs103.access;
|
|
293885
|
-
var
|
|
293968
|
+
var accessSync2 = fs103.accessSync;
|
|
293886
293969
|
var constants4 = fs103.constants || fs103;
|
|
293887
293970
|
var isUsingWindows = process.platform == "win32";
|
|
293888
293971
|
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
|
@@ -293896,7 +293979,7 @@ var require_command_exists = __commonJS({
|
|
|
293896
293979
|
}, "fileNotExists");
|
|
293897
293980
|
var fileNotExistsSync = /* @__PURE__ */ __name(function(commandName) {
|
|
293898
293981
|
try {
|
|
293899
|
-
|
|
293982
|
+
accessSync2(commandName, constants4.F_OK);
|
|
293900
293983
|
return false;
|
|
293901
293984
|
} catch (e2) {
|
|
293902
293985
|
return true;
|
|
@@ -293913,7 +293996,7 @@ var require_command_exists = __commonJS({
|
|
|
293913
293996
|
}, "localExecutable");
|
|
293914
293997
|
var localExecutableSync = /* @__PURE__ */ __name(function(commandName) {
|
|
293915
293998
|
try {
|
|
293916
|
-
|
|
293999
|
+
accessSync2(commandName, constants4.F_OK | constants4.X_OK);
|
|
293917
294000
|
return true;
|
|
293918
294001
|
} catch (e2) {
|
|
293919
294002
|
return false;
|
|
@@ -294046,9 +294129,7 @@ async function resolveXhsSsoRuntimeConfig(config, settings) {
|
|
|
294046
294129
|
);
|
|
294047
294130
|
}
|
|
294048
294131
|
}
|
|
294049
|
-
console.log(`[XhsSsoConfig] resolveXhsSsoRuntimeConfig: apiKey=${apiKey ? apiKey.startsWith("xhs_enc:") ? "xhs_enc:..." : `${apiKey.substring(0, 8)}...` : "empty"}`);
|
|
294050
294132
|
const decryptedApiKey = decryptApiKey(apiKey);
|
|
294051
|
-
console.log(`[XhsSsoConfig] resolveXhsSsoRuntimeConfig: \u89E3\u5BC6\u540E=${decryptedApiKey.startsWith("xhs_enc:") ? "\u274C \u4ECD\u662F\u52A0\u5BC6\u683C\u5F0F" : "\u2705 \u89E3\u5BC6\u6210\u529F"}`);
|
|
294052
294133
|
return {
|
|
294053
294134
|
apiKey: decryptedApiKey,
|
|
294054
294135
|
baseUrl,
|
|
@@ -294063,9 +294144,7 @@ async function applyXhsSsoConfig(config, settings, options2 = {}) {
|
|
|
294063
294144
|
if (!apiKey || apiKey.trim() === "") {
|
|
294064
294145
|
throw new Error("\u7F3A\u5C11\u5C0F\u7EA2\u4E66 SSO API Key\uFF0C\u8BF7\u5148\u5B8C\u6210 SSO \u8BA4\u8BC1\u3002");
|
|
294065
294146
|
}
|
|
294066
|
-
console.log(`[XhsSsoConfig] applyXhsSsoConfig: apiKey=${apiKey ? apiKey.startsWith("xhs_enc:") ? "xhs_enc:..." : `${apiKey.substring(0, 8)}...` : "empty"}`);
|
|
294067
294147
|
const decryptedApiKey = decryptApiKey(apiKey);
|
|
294068
|
-
console.log(`[XhsSsoConfig] applyXhsSsoConfig: \u89E3\u5BC6\u540E=${decryptedApiKey.startsWith("xhs_enc:") ? "\u274C \u4ECD\u662F\u52A0\u5BC6\u683C\u5F0F" : "\u2705 \u89E3\u5BC6\u6210\u529F"}`);
|
|
294069
294148
|
const encryptedApiKey = encryptApiKey(decryptedApiKey);
|
|
294070
294149
|
settings.setValue(scope, "security.auth.selectedType", "xhs-sso" /* XHS_SSO */);
|
|
294071
294150
|
settings.setValue(scope, "security.auth.baseUrl", baseUrl);
|
|
@@ -301884,7 +301963,7 @@ init_esbuild_shims();
|
|
|
301884
301963
|
|
|
301885
301964
|
// packages/cli/src/gemini.tsx
|
|
301886
301965
|
init_esbuild_shims();
|
|
301887
|
-
var
|
|
301966
|
+
var import_react137 = __toESM(require_react(), 1);
|
|
301888
301967
|
|
|
301889
301968
|
// node_modules/ink/build/index.js
|
|
301890
301969
|
init_esbuild_shims();
|
|
@@ -308448,7 +308527,7 @@ var measure_element_default = measureElement;
|
|
|
308448
308527
|
|
|
308449
308528
|
// packages/cli/src/ui/AppContainer.tsx
|
|
308450
308529
|
init_esbuild_shims();
|
|
308451
|
-
var
|
|
308530
|
+
var import_react135 = __toESM(require_react(), 1);
|
|
308452
308531
|
|
|
308453
308532
|
// packages/cli/src/ui/App.tsx
|
|
308454
308533
|
init_esbuild_shims();
|
|
@@ -311282,7 +311361,13 @@ var SCREEN_READER_RESPONDING = "responding";
|
|
|
311282
311361
|
|
|
311283
311362
|
// packages/cli/src/ui/utils/commandUtils.ts
|
|
311284
311363
|
init_esbuild_shims();
|
|
311285
|
-
import { spawn as
|
|
311364
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
311365
|
+
var CodePage = {
|
|
311366
|
+
UTF8: 65001,
|
|
311367
|
+
GBK: 936,
|
|
311368
|
+
BIG5: 950,
|
|
311369
|
+
LATIN1: 1252
|
|
311370
|
+
};
|
|
311286
311371
|
var isAtCommand = /* @__PURE__ */ __name((query) => (
|
|
311287
311372
|
// Check if starts with @ OR has a space, then @
|
|
311288
311373
|
query.startsWith("@") || /\s@/.test(query)
|
|
@@ -311301,7 +311386,7 @@ var isSlashCommand = /* @__PURE__ */ __name((query) => {
|
|
|
311301
311386
|
}, "isSlashCommand");
|
|
311302
311387
|
var copyToClipboard = /* @__PURE__ */ __name(async (text) => {
|
|
311303
311388
|
const run = /* @__PURE__ */ __name((cmd, args, options2) => new Promise((resolve26, reject) => {
|
|
311304
|
-
const child = options2 ?
|
|
311389
|
+
const child = options2 ? spawn6(cmd, args, options2) : spawn6(cmd, args);
|
|
311305
311390
|
let stderr = "";
|
|
311306
311391
|
if (child.stderr) {
|
|
311307
311392
|
child.stderr.on("data", (chunk) => stderr += chunk.toString());
|
|
@@ -311327,7 +311412,7 @@ var copyToClipboard = /* @__PURE__ */ __name(async (text) => {
|
|
|
311327
311412
|
const linuxOptions = { stdio: ["pipe", "inherit", "pipe"] };
|
|
311328
311413
|
switch (process.platform) {
|
|
311329
311414
|
case "win32":
|
|
311330
|
-
return run("
|
|
311415
|
+
return run("cmd", ["/c", `chcp ${CodePage.UTF8} >nul && clip`]);
|
|
311331
311416
|
case "darwin":
|
|
311332
311417
|
return run("pbcopy", []);
|
|
311333
311418
|
case "linux":
|
|
@@ -338572,7 +338657,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
338572
338657
|
|
|
338573
338658
|
// packages/cli/src/ui/components/Composer.tsx
|
|
338574
338659
|
init_esbuild_shims();
|
|
338575
|
-
var
|
|
338660
|
+
var import_react97 = __toESM(require_react(), 1);
|
|
338576
338661
|
|
|
338577
338662
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
338578
338663
|
init_esbuild_shims();
|
|
@@ -338818,7 +338903,7 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
338818
338903
|
|
|
338819
338904
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
338820
338905
|
init_esbuild_shims();
|
|
338821
|
-
var
|
|
338906
|
+
var import_react93 = __toESM(require_react(), 1);
|
|
338822
338907
|
|
|
338823
338908
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
338824
338909
|
init_esbuild_shims();
|
|
@@ -339344,7 +339429,7 @@ __name(useReverseSearchCompletion, "useReverseSearchCompletion");
|
|
|
339344
339429
|
|
|
339345
339430
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
339346
339431
|
init_esbuild_shims();
|
|
339347
|
-
var
|
|
339432
|
+
var import_react91 = __toESM(require_react(), 1);
|
|
339348
339433
|
|
|
339349
339434
|
// packages/cli/src/ui/hooks/useAtCompletion.ts
|
|
339350
339435
|
init_esbuild_shims();
|
|
@@ -339878,173 +339963,6 @@ function useSlashCompletion(props) {
|
|
|
339878
339963
|
}
|
|
339879
339964
|
__name(useSlashCompletion, "useSlashCompletion");
|
|
339880
339965
|
|
|
339881
|
-
// packages/cli/src/ui/hooks/usePromptCompletion.ts
|
|
339882
|
-
init_esbuild_shims();
|
|
339883
|
-
var import_react91 = __toESM(require_react(), 1);
|
|
339884
|
-
init_core2();
|
|
339885
|
-
var PROMPT_COMPLETION_MIN_LENGTH = 5;
|
|
339886
|
-
var PROMPT_COMPLETION_DEBOUNCE_MS = 250;
|
|
339887
|
-
function usePromptCompletion({
|
|
339888
|
-
buffer,
|
|
339889
|
-
config,
|
|
339890
|
-
enabled
|
|
339891
|
-
}) {
|
|
339892
|
-
const [ghostText, setGhostText] = (0, import_react91.useState)("");
|
|
339893
|
-
const [isLoadingGhostText, setIsLoadingGhostText] = (0, import_react91.useState)(false);
|
|
339894
|
-
const abortControllerRef = (0, import_react91.useRef)(null);
|
|
339895
|
-
const [justSelectedSuggestion, setJustSelectedSuggestion] = (0, import_react91.useState)(false);
|
|
339896
|
-
const lastSelectedTextRef = (0, import_react91.useRef)("");
|
|
339897
|
-
const lastRequestedTextRef = (0, import_react91.useRef)("");
|
|
339898
|
-
const isPromptCompletionEnabled = enabled && (config?.getEnablePromptCompletion() ?? false);
|
|
339899
|
-
const clearGhostText = (0, import_react91.useCallback)(() => {
|
|
339900
|
-
setGhostText("");
|
|
339901
|
-
setIsLoadingGhostText(false);
|
|
339902
|
-
}, []);
|
|
339903
|
-
const acceptGhostText = (0, import_react91.useCallback)(() => {
|
|
339904
|
-
if (ghostText && ghostText.length > buffer.text.length) {
|
|
339905
|
-
buffer.setText(ghostText);
|
|
339906
|
-
setGhostText("");
|
|
339907
|
-
setJustSelectedSuggestion(true);
|
|
339908
|
-
lastSelectedTextRef.current = ghostText;
|
|
339909
|
-
}
|
|
339910
|
-
}, [ghostText, buffer]);
|
|
339911
|
-
const markSuggestionSelected = (0, import_react91.useCallback)((selectedText) => {
|
|
339912
|
-
setJustSelectedSuggestion(true);
|
|
339913
|
-
lastSelectedTextRef.current = selectedText;
|
|
339914
|
-
}, []);
|
|
339915
|
-
const generatePromptSuggestions = (0, import_react91.useCallback)(async () => {
|
|
339916
|
-
const trimmedText = buffer.text.trim();
|
|
339917
|
-
const geminiClient = config?.getGeminiClient();
|
|
339918
|
-
if (trimmedText === lastRequestedTextRef.current) {
|
|
339919
|
-
return;
|
|
339920
|
-
}
|
|
339921
|
-
if (abortControllerRef.current) {
|
|
339922
|
-
abortControllerRef.current.abort();
|
|
339923
|
-
}
|
|
339924
|
-
if (trimmedText.length < PROMPT_COMPLETION_MIN_LENGTH || !geminiClient || isSlashCommand(trimmedText) || trimmedText.includes("@") || !isPromptCompletionEnabled) {
|
|
339925
|
-
clearGhostText();
|
|
339926
|
-
lastRequestedTextRef.current = "";
|
|
339927
|
-
return;
|
|
339928
|
-
}
|
|
339929
|
-
lastRequestedTextRef.current = trimmedText;
|
|
339930
|
-
setIsLoadingGhostText(true);
|
|
339931
|
-
abortControllerRef.current = new AbortController();
|
|
339932
|
-
const signal = abortControllerRef.current.signal;
|
|
339933
|
-
try {
|
|
339934
|
-
const contents = [
|
|
339935
|
-
{
|
|
339936
|
-
role: "user",
|
|
339937
|
-
parts: [
|
|
339938
|
-
{
|
|
339939
|
-
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.`
|
|
339940
|
-
}
|
|
339941
|
-
]
|
|
339942
|
-
}
|
|
339943
|
-
];
|
|
339944
|
-
const generationConfig = {
|
|
339945
|
-
temperature: 0.3,
|
|
339946
|
-
maxOutputTokens: 16e3,
|
|
339947
|
-
thinkingConfig: {
|
|
339948
|
-
thinkingBudget: 0
|
|
339949
|
-
}
|
|
339950
|
-
};
|
|
339951
|
-
const response = await geminiClient.generateContent(
|
|
339952
|
-
contents,
|
|
339953
|
-
generationConfig,
|
|
339954
|
-
signal,
|
|
339955
|
-
DEFAULT_GEMINI_FLASH_LITE_MODEL
|
|
339956
|
-
);
|
|
339957
|
-
if (signal.aborted) {
|
|
339958
|
-
return;
|
|
339959
|
-
}
|
|
339960
|
-
if (response) {
|
|
339961
|
-
const responseText = getResponseText(response);
|
|
339962
|
-
if (responseText) {
|
|
339963
|
-
const suggestionText = responseText.trim();
|
|
339964
|
-
if (suggestionText.length > 0 && suggestionText.startsWith(trimmedText)) {
|
|
339965
|
-
setGhostText(suggestionText);
|
|
339966
|
-
} else {
|
|
339967
|
-
clearGhostText();
|
|
339968
|
-
}
|
|
339969
|
-
}
|
|
339970
|
-
}
|
|
339971
|
-
} catch (error) {
|
|
339972
|
-
if (!(signal.aborted || error instanceof Error && error.name === "AbortError")) {
|
|
339973
|
-
console.error("prompt completion error:", error);
|
|
339974
|
-
lastRequestedTextRef.current = "";
|
|
339975
|
-
}
|
|
339976
|
-
clearGhostText();
|
|
339977
|
-
} finally {
|
|
339978
|
-
if (!signal.aborted) {
|
|
339979
|
-
setIsLoadingGhostText(false);
|
|
339980
|
-
}
|
|
339981
|
-
}
|
|
339982
|
-
}, [buffer.text, config, clearGhostText, isPromptCompletionEnabled]);
|
|
339983
|
-
const isCursorAtEnd = (0, import_react91.useCallback)(() => {
|
|
339984
|
-
const [cursorRow, cursorCol] = buffer.cursor;
|
|
339985
|
-
const totalLines = buffer.lines.length;
|
|
339986
|
-
if (cursorRow !== totalLines - 1) {
|
|
339987
|
-
return false;
|
|
339988
|
-
}
|
|
339989
|
-
const lastLine = buffer.lines[cursorRow] || "";
|
|
339990
|
-
return cursorCol === lastLine.length;
|
|
339991
|
-
}, [buffer.cursor, buffer.lines]);
|
|
339992
|
-
const handlePromptCompletion = (0, import_react91.useCallback)(() => {
|
|
339993
|
-
if (!isCursorAtEnd()) {
|
|
339994
|
-
clearGhostText();
|
|
339995
|
-
return;
|
|
339996
|
-
}
|
|
339997
|
-
const trimmedText = buffer.text.trim();
|
|
339998
|
-
if (justSelectedSuggestion && trimmedText === lastSelectedTextRef.current) {
|
|
339999
|
-
return;
|
|
340000
|
-
}
|
|
340001
|
-
if (trimmedText !== lastSelectedTextRef.current) {
|
|
340002
|
-
setJustSelectedSuggestion(false);
|
|
340003
|
-
lastSelectedTextRef.current = "";
|
|
340004
|
-
}
|
|
340005
|
-
generatePromptSuggestions();
|
|
340006
|
-
}, [
|
|
340007
|
-
buffer.text,
|
|
340008
|
-
generatePromptSuggestions,
|
|
340009
|
-
justSelectedSuggestion,
|
|
340010
|
-
isCursorAtEnd,
|
|
340011
|
-
clearGhostText
|
|
340012
|
-
]);
|
|
340013
|
-
(0, import_react91.useEffect)(() => {
|
|
340014
|
-
const timeoutId = setTimeout(
|
|
340015
|
-
handlePromptCompletion,
|
|
340016
|
-
PROMPT_COMPLETION_DEBOUNCE_MS
|
|
340017
|
-
);
|
|
340018
|
-
return () => clearTimeout(timeoutId);
|
|
340019
|
-
}, [buffer.text, buffer.cursor, handlePromptCompletion]);
|
|
340020
|
-
(0, import_react91.useEffect)(() => {
|
|
340021
|
-
const currentText = buffer.text.trim();
|
|
340022
|
-
if (ghostText && !isCursorAtEnd()) {
|
|
340023
|
-
clearGhostText();
|
|
340024
|
-
return;
|
|
340025
|
-
}
|
|
340026
|
-
if (ghostText && currentText.length > 0 && !ghostText.startsWith(currentText)) {
|
|
340027
|
-
clearGhostText();
|
|
340028
|
-
}
|
|
340029
|
-
}, [buffer.text, buffer.cursor, ghostText, clearGhostText, isCursorAtEnd]);
|
|
340030
|
-
(0, import_react91.useEffect)(() => () => abortControllerRef.current?.abort(), []);
|
|
340031
|
-
const isActive = (0, import_react91.useMemo)(() => {
|
|
340032
|
-
if (!isPromptCompletionEnabled) return false;
|
|
340033
|
-
if (!isCursorAtEnd()) return false;
|
|
340034
|
-
const trimmedText = buffer.text.trim();
|
|
340035
|
-
return trimmedText.length >= PROMPT_COMPLETION_MIN_LENGTH && !isSlashCommand(trimmedText) && !trimmedText.includes("@");
|
|
340036
|
-
}, [buffer.text, isPromptCompletionEnabled, isCursorAtEnd]);
|
|
340037
|
-
return {
|
|
340038
|
-
text: ghostText,
|
|
340039
|
-
isLoading: isLoadingGhostText,
|
|
340040
|
-
isActive,
|
|
340041
|
-
accept: acceptGhostText,
|
|
340042
|
-
clear: clearGhostText,
|
|
340043
|
-
markSelected: markSuggestionSelected
|
|
340044
|
-
};
|
|
340045
|
-
}
|
|
340046
|
-
__name(usePromptCompletion, "usePromptCompletion");
|
|
340047
|
-
|
|
340048
339966
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
340049
339967
|
function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext, reverseSearchActive = false, config) {
|
|
340050
339968
|
const {
|
|
@@ -340066,7 +339984,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
340066
339984
|
} = useCompletion();
|
|
340067
339985
|
const cursorRow = buffer.cursor[0];
|
|
340068
339986
|
const cursorCol = buffer.cursor[1];
|
|
340069
|
-
const { completionMode, query, completionStart, completionEnd } = (0,
|
|
339987
|
+
const { completionMode, query, completionStart, completionEnd } = (0, import_react91.useMemo)(() => {
|
|
340070
339988
|
const currentLine = buffer.lines[cursorRow] || "";
|
|
340071
339989
|
if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
|
|
340072
339990
|
return {
|
|
@@ -340111,23 +340029,13 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
340111
340029
|
};
|
|
340112
340030
|
}
|
|
340113
340031
|
}
|
|
340114
|
-
const trimmedText = buffer.text.trim();
|
|
340115
|
-
const isPromptCompletionEnabled = config?.getEnablePromptCompletion() ?? false;
|
|
340116
|
-
if (isPromptCompletionEnabled && trimmedText.length >= PROMPT_COMPLETION_MIN_LENGTH && !isSlashCommand(trimmedText) && !trimmedText.includes("@")) {
|
|
340117
|
-
return {
|
|
340118
|
-
completionMode: "PROMPT" /* PROMPT */,
|
|
340119
|
-
query: trimmedText,
|
|
340120
|
-
completionStart: 0,
|
|
340121
|
-
completionEnd: trimmedText.length
|
|
340122
|
-
};
|
|
340123
|
-
}
|
|
340124
340032
|
return {
|
|
340125
340033
|
completionMode: "IDLE" /* IDLE */,
|
|
340126
340034
|
query: null,
|
|
340127
340035
|
completionStart: -1,
|
|
340128
340036
|
completionEnd: -1
|
|
340129
340037
|
};
|
|
340130
|
-
}, [cursorRow, cursorCol, buffer.lines
|
|
340038
|
+
}, [cursorRow, cursorCol, buffer.lines]);
|
|
340131
340039
|
useAtCompletion({
|
|
340132
340040
|
enabled: completionMode === "AT" /* AT */,
|
|
340133
340041
|
pattern: query || "",
|
|
@@ -340145,16 +340053,11 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
340145
340053
|
setIsLoadingSuggestions,
|
|
340146
340054
|
setIsPerfectMatch
|
|
340147
340055
|
});
|
|
340148
|
-
|
|
340149
|
-
buffer,
|
|
340150
|
-
config,
|
|
340151
|
-
enabled: completionMode === "PROMPT" /* PROMPT */
|
|
340152
|
-
});
|
|
340153
|
-
(0, import_react92.useEffect)(() => {
|
|
340056
|
+
(0, import_react91.useEffect)(() => {
|
|
340154
340057
|
setActiveSuggestionIndex(suggestions.length > 0 ? 0 : -1);
|
|
340155
340058
|
setVisibleStartIndex(0);
|
|
340156
340059
|
}, [suggestions, setActiveSuggestionIndex, setVisibleStartIndex]);
|
|
340157
|
-
(0,
|
|
340060
|
+
(0, import_react91.useEffect)(() => {
|
|
340158
340061
|
if (completionMode === "IDLE" /* IDLE */ || reverseSearchActive) {
|
|
340159
340062
|
resetCompletionState();
|
|
340160
340063
|
return;
|
|
@@ -340168,7 +340071,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
340168
340071
|
resetCompletionState,
|
|
340169
340072
|
setShowSuggestions
|
|
340170
340073
|
]);
|
|
340171
|
-
const handleAutocomplete = (0,
|
|
340074
|
+
const handleAutocomplete = (0, import_react91.useCallback)(
|
|
340172
340075
|
(indexToUse) => {
|
|
340173
340076
|
if (indexToUse < 0 || indexToUse >= suggestions.length) {
|
|
340174
340077
|
return;
|
|
@@ -340222,8 +340125,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
340222
340125
|
resetCompletionState,
|
|
340223
340126
|
navigateUp,
|
|
340224
340127
|
navigateDown,
|
|
340225
|
-
handleAutocomplete
|
|
340226
|
-
promptCompletion
|
|
340128
|
+
handleAutocomplete
|
|
340227
340129
|
};
|
|
340228
340130
|
}
|
|
340229
340131
|
__name(useCommandCompletion, "useCommandCompletion");
|
|
@@ -340310,7 +340212,7 @@ async function clipboardHasImage() {
|
|
|
340310
340212
|
return false;
|
|
340311
340213
|
}
|
|
340312
340214
|
try {
|
|
340313
|
-
const { stdout } = await
|
|
340215
|
+
const { stdout } = await execCommand("osascript", ["-e", "clipboard info"]);
|
|
340314
340216
|
const imageRegex = /«class PNGf»|TIFF picture|JPEG picture|GIF picture|«class JPEG»|«class TIFF»/;
|
|
340315
340217
|
return imageRegex.test(stdout);
|
|
340316
340218
|
} catch {
|
|
@@ -340352,7 +340254,7 @@ async function saveClipboardImage(targetDir) {
|
|
|
340352
340254
|
return "error"
|
|
340353
340255
|
end try
|
|
340354
340256
|
`;
|
|
340355
|
-
const { stdout } = await
|
|
340257
|
+
const { stdout } = await execCommand("osascript", ["-e", script]);
|
|
340356
340258
|
if (stdout.trim() === "success") {
|
|
340357
340259
|
try {
|
|
340358
340260
|
const stats = await fs76.stat(tempFilePath);
|
|
@@ -340399,9 +340301,9 @@ import * as path79 from "node:path";
|
|
|
340399
340301
|
|
|
340400
340302
|
// packages/cli/src/ui/contexts/ShellFocusContext.tsx
|
|
340401
340303
|
init_esbuild_shims();
|
|
340402
|
-
var
|
|
340403
|
-
var ShellFocusContext = (0,
|
|
340404
|
-
var useShellFocusState = /* @__PURE__ */ __name(() => (0,
|
|
340304
|
+
var import_react92 = __toESM(require_react(), 1);
|
|
340305
|
+
var ShellFocusContext = (0, import_react92.createContext)(true);
|
|
340306
|
+
var useShellFocusState = /* @__PURE__ */ __name(() => (0, import_react92.useContext)(ShellFocusContext), "useShellFocusState");
|
|
340405
340307
|
|
|
340406
340308
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
340407
340309
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -340432,7 +340334,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340432
340334
|
commandContext,
|
|
340433
340335
|
placeholder = " Type your message or @path/to/file",
|
|
340434
340336
|
focus = true,
|
|
340435
|
-
inputWidth,
|
|
340436
340337
|
suggestionsWidth,
|
|
340437
340338
|
shellModeActive,
|
|
340438
340339
|
setShellModeActive,
|
|
@@ -340442,29 +340343,29 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340442
340343
|
isEmbeddedShellFocused
|
|
340443
340344
|
}) => {
|
|
340444
340345
|
const isShellFocused = useShellFocusState();
|
|
340445
|
-
const [justNavigatedHistory, setJustNavigatedHistory] = (0,
|
|
340446
|
-
const [escPressCount, setEscPressCount] = (0,
|
|
340447
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
340448
|
-
const escapeTimerRef = (0,
|
|
340449
|
-
const [recentPasteTime, setRecentPasteTime] = (0,
|
|
340450
|
-
const pasteTimeoutRef = (0,
|
|
340451
|
-
const [dirs, setDirs] = (0,
|
|
340346
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = (0, import_react93.useState)(false);
|
|
340347
|
+
const [escPressCount, setEscPressCount] = (0, import_react93.useState)(0);
|
|
340348
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react93.useState)(false);
|
|
340349
|
+
const escapeTimerRef = (0, import_react93.useRef)(null);
|
|
340350
|
+
const [recentPasteTime, setRecentPasteTime] = (0, import_react93.useState)(null);
|
|
340351
|
+
const pasteTimeoutRef = (0, import_react93.useRef)(null);
|
|
340352
|
+
const [dirs, setDirs] = (0, import_react93.useState)(
|
|
340452
340353
|
config.getWorkspaceContext().getDirectories()
|
|
340453
340354
|
);
|
|
340454
340355
|
const dirsChanged = config.getWorkspaceContext().getDirectories();
|
|
340455
|
-
(0,
|
|
340356
|
+
(0, import_react93.useEffect)(() => {
|
|
340456
340357
|
if (dirs.length !== dirsChanged.length) {
|
|
340457
340358
|
setDirs(dirsChanged);
|
|
340458
340359
|
}
|
|
340459
340360
|
}, [dirs.length, dirsChanged]);
|
|
340460
|
-
const [reverseSearchActive, setReverseSearchActive] = (0,
|
|
340461
|
-
const [commandSearchActive, setCommandSearchActive] = (0,
|
|
340462
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0,
|
|
340463
|
-
const [cursorPosition, setCursorPosition] = (0,
|
|
340361
|
+
const [reverseSearchActive, setReverseSearchActive] = (0, import_react93.useState)(false);
|
|
340362
|
+
const [commandSearchActive, setCommandSearchActive] = (0, import_react93.useState)(false);
|
|
340363
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0, import_react93.useState)("");
|
|
340364
|
+
const [cursorPosition, setCursorPosition] = (0, import_react93.useState)([
|
|
340464
340365
|
0,
|
|
340465
340366
|
0
|
|
340466
340367
|
]);
|
|
340467
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0,
|
|
340368
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0, import_react93.useState)(-1);
|
|
340468
340369
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
340469
340370
|
const shellHistoryData = shellHistory.history;
|
|
340470
340371
|
const completion3 = useCommandCompletion(
|
|
@@ -340490,7 +340391,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340490
340391
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
340491
340392
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
340492
340393
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused;
|
|
340493
|
-
const resetEscapeState = (0,
|
|
340394
|
+
const resetEscapeState = (0, import_react93.useCallback)(() => {
|
|
340494
340395
|
if (escapeTimerRef.current) {
|
|
340495
340396
|
clearTimeout(escapeTimerRef.current);
|
|
340496
340397
|
escapeTimerRef.current = null;
|
|
@@ -340498,12 +340399,12 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340498
340399
|
setEscPressCount(0);
|
|
340499
340400
|
setShowEscapePrompt(false);
|
|
340500
340401
|
}, []);
|
|
340501
|
-
(0,
|
|
340402
|
+
(0, import_react93.useEffect)(() => {
|
|
340502
340403
|
if (onEscapePromptChange) {
|
|
340503
340404
|
onEscapePromptChange(showEscapePrompt);
|
|
340504
340405
|
}
|
|
340505
340406
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
340506
|
-
(0,
|
|
340407
|
+
(0, import_react93.useEffect)(
|
|
340507
340408
|
() => () => {
|
|
340508
340409
|
if (escapeTimerRef.current) {
|
|
340509
340410
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -340514,7 +340415,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340514
340415
|
},
|
|
340515
340416
|
[]
|
|
340516
340417
|
);
|
|
340517
|
-
const handleSubmitAndClear = (0,
|
|
340418
|
+
const handleSubmitAndClear = (0, import_react93.useCallback)(
|
|
340518
340419
|
(submittedValue) => {
|
|
340519
340420
|
if (shellModeActive) {
|
|
340520
340421
|
shellHistory.addCommandToHistory(submittedValue);
|
|
@@ -340533,7 +340434,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340533
340434
|
resetReverseSearchCompletionState
|
|
340534
340435
|
]
|
|
340535
340436
|
);
|
|
340536
|
-
const customSetTextAndResetCompletionSignal = (0,
|
|
340437
|
+
const customSetTextAndResetCompletionSignal = (0, import_react93.useCallback)(
|
|
340537
340438
|
(newText) => {
|
|
340538
340439
|
buffer.setText(newText);
|
|
340539
340440
|
setJustNavigatedHistory(true);
|
|
@@ -340547,7 +340448,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340547
340448
|
currentQuery: buffer.text,
|
|
340548
340449
|
onChange: customSetTextAndResetCompletionSignal
|
|
340549
340450
|
});
|
|
340550
|
-
(0,
|
|
340451
|
+
(0, import_react93.useEffect)(() => {
|
|
340551
340452
|
if (justNavigatedHistory) {
|
|
340552
340453
|
resetCompletionState();
|
|
340553
340454
|
resetReverseSearchCompletionState();
|
|
@@ -340563,7 +340464,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340563
340464
|
resetReverseSearchCompletionState,
|
|
340564
340465
|
resetCommandSearchCompletionState
|
|
340565
340466
|
]);
|
|
340566
|
-
const handleClipboardImage = (0,
|
|
340467
|
+
const handleClipboardImage = (0, import_react93.useCallback)(async () => {
|
|
340567
340468
|
try {
|
|
340568
340469
|
if (await clipboardHasImage()) {
|
|
340569
340470
|
const imagePath = await saveClipboardImage(config.getTargetDir());
|
|
@@ -340595,7 +340496,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340595
340496
|
console.error("Error handling clipboard image:", error);
|
|
340596
340497
|
}
|
|
340597
340498
|
}, [buffer, config]);
|
|
340598
|
-
const handleInput = (0,
|
|
340499
|
+
const handleInput = (0, import_react93.useCallback)(
|
|
340599
340500
|
(key) => {
|
|
340600
340501
|
if (!focus && !key.paste) {
|
|
340601
340502
|
return;
|
|
@@ -340771,10 +340672,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340771
340672
|
return;
|
|
340772
340673
|
}
|
|
340773
340674
|
}
|
|
340774
|
-
if (key.name === "tab" && !completion3.showSuggestions && completion3.promptCompletion.text) {
|
|
340775
|
-
completion3.promptCompletion.accept();
|
|
340776
|
-
return;
|
|
340777
|
-
}
|
|
340778
340675
|
if (!shellModeActive) {
|
|
340779
340676
|
if (keyMatchers["reverseSearch" /* REVERSE_SEARCH */](key)) {
|
|
340780
340677
|
setCommandSearchActive(true);
|
|
@@ -340867,10 +340764,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340867
340764
|
return;
|
|
340868
340765
|
}
|
|
340869
340766
|
buffer.handleInput(key);
|
|
340870
|
-
if (completion3.promptCompletion.text && key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
340871
|
-
completion3.promptCompletion.clear();
|
|
340872
|
-
setExpandedSuggestionIndex(-1);
|
|
340873
|
-
}
|
|
340874
340767
|
},
|
|
340875
340768
|
[
|
|
340876
340769
|
focus,
|
|
@@ -340901,101 +340794,6 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
340901
340794
|
const linesToRender = buffer.viewportVisualLines;
|
|
340902
340795
|
const [cursorVisualRowAbsolute, cursorVisualColAbsolute] = buffer.visualCursor;
|
|
340903
340796
|
const scrollVisualRow = buffer.visualScrollRow;
|
|
340904
|
-
const getGhostTextLines = (0, import_react94.useCallback)(() => {
|
|
340905
|
-
if (!completion3.promptCompletion.text || !buffer.text || !completion3.promptCompletion.text.startsWith(buffer.text)) {
|
|
340906
|
-
return { inlineGhost: "", additionalLines: [] };
|
|
340907
|
-
}
|
|
340908
|
-
const ghostSuffix = completion3.promptCompletion.text.slice(
|
|
340909
|
-
buffer.text.length
|
|
340910
|
-
);
|
|
340911
|
-
if (!ghostSuffix) {
|
|
340912
|
-
return { inlineGhost: "", additionalLines: [] };
|
|
340913
|
-
}
|
|
340914
|
-
const currentLogicalLine = buffer.lines[buffer.cursor[0]] || "";
|
|
340915
|
-
const cursorCol = buffer.cursor[1];
|
|
340916
|
-
const textBeforeCursor = cpSlice(currentLogicalLine, 0, cursorCol);
|
|
340917
|
-
const usedWidth = stringWidth4(textBeforeCursor);
|
|
340918
|
-
const remainingWidth = Math.max(0, inputWidth - usedWidth);
|
|
340919
|
-
const ghostTextLinesRaw = ghostSuffix.split("\n");
|
|
340920
|
-
const firstLineRaw = ghostTextLinesRaw.shift() || "";
|
|
340921
|
-
let inlineGhost2 = "";
|
|
340922
|
-
let remainingFirstLine = "";
|
|
340923
|
-
if (stringWidth4(firstLineRaw) <= remainingWidth) {
|
|
340924
|
-
inlineGhost2 = firstLineRaw;
|
|
340925
|
-
} else {
|
|
340926
|
-
const words = firstLineRaw.split(" ");
|
|
340927
|
-
let currentLine = "";
|
|
340928
|
-
let wordIdx = 0;
|
|
340929
|
-
for (const word of words) {
|
|
340930
|
-
const prospectiveLine = currentLine ? `${currentLine} ${word}` : word;
|
|
340931
|
-
if (stringWidth4(prospectiveLine) > remainingWidth) {
|
|
340932
|
-
break;
|
|
340933
|
-
}
|
|
340934
|
-
currentLine = prospectiveLine;
|
|
340935
|
-
wordIdx++;
|
|
340936
|
-
}
|
|
340937
|
-
inlineGhost2 = currentLine;
|
|
340938
|
-
if (words.length > wordIdx) {
|
|
340939
|
-
remainingFirstLine = words.slice(wordIdx).join(" ");
|
|
340940
|
-
}
|
|
340941
|
-
}
|
|
340942
|
-
const linesToWrap = [];
|
|
340943
|
-
if (remainingFirstLine) {
|
|
340944
|
-
linesToWrap.push(remainingFirstLine);
|
|
340945
|
-
}
|
|
340946
|
-
linesToWrap.push(...ghostTextLinesRaw);
|
|
340947
|
-
const remainingGhostText = linesToWrap.join("\n");
|
|
340948
|
-
const additionalLines2 = [];
|
|
340949
|
-
if (remainingGhostText) {
|
|
340950
|
-
const textLines = remainingGhostText.split("\n");
|
|
340951
|
-
for (const textLine of textLines) {
|
|
340952
|
-
const words = textLine.split(" ");
|
|
340953
|
-
let currentLine = "";
|
|
340954
|
-
for (const word of words) {
|
|
340955
|
-
const prospectiveLine = currentLine ? `${currentLine} ${word}` : word;
|
|
340956
|
-
const prospectiveWidth = stringWidth4(prospectiveLine);
|
|
340957
|
-
if (prospectiveWidth > inputWidth) {
|
|
340958
|
-
if (currentLine) {
|
|
340959
|
-
additionalLines2.push(currentLine);
|
|
340960
|
-
}
|
|
340961
|
-
let wordToProcess = word;
|
|
340962
|
-
while (stringWidth4(wordToProcess) > inputWidth) {
|
|
340963
|
-
let part = "";
|
|
340964
|
-
const wordCP = toCodePoints(wordToProcess);
|
|
340965
|
-
let partWidth = 0;
|
|
340966
|
-
let splitIndex = 0;
|
|
340967
|
-
for (let i = 0; i < wordCP.length; i++) {
|
|
340968
|
-
const char = wordCP[i];
|
|
340969
|
-
const charWidth = stringWidth4(char);
|
|
340970
|
-
if (partWidth + charWidth > inputWidth) {
|
|
340971
|
-
break;
|
|
340972
|
-
}
|
|
340973
|
-
part += char;
|
|
340974
|
-
partWidth += charWidth;
|
|
340975
|
-
splitIndex = i + 1;
|
|
340976
|
-
}
|
|
340977
|
-
additionalLines2.push(part);
|
|
340978
|
-
wordToProcess = cpSlice(wordToProcess, splitIndex);
|
|
340979
|
-
}
|
|
340980
|
-
currentLine = wordToProcess;
|
|
340981
|
-
} else {
|
|
340982
|
-
currentLine = prospectiveLine;
|
|
340983
|
-
}
|
|
340984
|
-
}
|
|
340985
|
-
if (currentLine) {
|
|
340986
|
-
additionalLines2.push(currentLine);
|
|
340987
|
-
}
|
|
340988
|
-
}
|
|
340989
|
-
}
|
|
340990
|
-
return { inlineGhost: inlineGhost2, additionalLines: additionalLines2 };
|
|
340991
|
-
}, [
|
|
340992
|
-
completion3.promptCompletion.text,
|
|
340993
|
-
buffer.text,
|
|
340994
|
-
buffer.lines,
|
|
340995
|
-
buffer.cursor,
|
|
340996
|
-
inputWidth
|
|
340997
|
-
]);
|
|
340998
|
-
const { inlineGhost, additionalLines } = getGhostTextLines();
|
|
340999
340797
|
const getActiveCompletion = /* @__PURE__ */ __name(() => {
|
|
341000
340798
|
if (commandSearchActive) return commandSearchCompletion;
|
|
341001
340799
|
if (reverseSearchActive) return reverseSearchCompletion;
|
|
@@ -341099,39 +340897,13 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
341099
340897
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { color, children: display }, `token-${segIdx}`)
|
|
341100
340898
|
);
|
|
341101
340899
|
});
|
|
341102
|
-
const currentLineGhost = isOnCursorLine ? inlineGhost : "";
|
|
341103
340900
|
if (isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText)) {
|
|
341104
|
-
|
|
341105
|
-
|
|
341106
|
-
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
|
|
341107
|
-
);
|
|
341108
|
-
}
|
|
341109
|
-
}
|
|
341110
|
-
const showCursorBeforeGhost = focus && isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText) && currentLineGhost;
|
|
341111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Text, { children: [
|
|
341112
|
-
renderedLine,
|
|
341113
|
-
showCursorBeforeGhost && (showCursor ? import_chalk7.default.inverse(" ") : " "),
|
|
341114
|
-
currentLineGhost && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { color: theme.text.secondary, children: currentLineGhost })
|
|
341115
|
-
] }) }, `line-${visualIdxInRenderedSet}`);
|
|
341116
|
-
}).concat(
|
|
341117
|
-
additionalLines.map((ghostLine, index) => {
|
|
341118
|
-
const padding = Math.max(
|
|
341119
|
-
0,
|
|
341120
|
-
inputWidth - stringWidth4(ghostLine)
|
|
341121
|
-
);
|
|
341122
|
-
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
341123
|
-
Text,
|
|
341124
|
-
{
|
|
341125
|
-
color: theme.text.secondary,
|
|
341126
|
-
children: [
|
|
341127
|
-
ghostLine,
|
|
341128
|
-
" ".repeat(padding)
|
|
341129
|
-
]
|
|
341130
|
-
},
|
|
341131
|
-
`ghost-line-${index}`
|
|
340901
|
+
renderedLine.push(
|
|
340902
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
|
|
341132
340903
|
);
|
|
341133
|
-
}
|
|
341134
|
-
|
|
340904
|
+
}
|
|
340905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { children: renderedLine }) }, `line-${visualIdxInRenderedSet}`);
|
|
340906
|
+
}) })
|
|
341135
340907
|
]
|
|
341136
340908
|
}
|
|
341137
340909
|
),
|
|
@@ -341181,15 +340953,15 @@ import process31 from "node:process";
|
|
|
341181
340953
|
|
|
341182
340954
|
// packages/cli/src/ui/components/MemoryUsageDisplay.tsx
|
|
341183
340955
|
init_esbuild_shims();
|
|
341184
|
-
var
|
|
340956
|
+
var import_react94 = __toESM(require_react(), 1);
|
|
341185
340957
|
import process30 from "node:process";
|
|
341186
340958
|
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
341187
340959
|
var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
341188
|
-
const [memoryUsage, setMemoryUsage] = (0,
|
|
341189
|
-
const [memoryUsageColor, setMemoryUsageColor] = (0,
|
|
340960
|
+
const [memoryUsage, setMemoryUsage] = (0, import_react94.useState)("");
|
|
340961
|
+
const [memoryUsageColor, setMemoryUsageColor] = (0, import_react94.useState)(
|
|
341190
340962
|
theme.text.secondary
|
|
341191
340963
|
);
|
|
341192
|
-
(0,
|
|
340964
|
+
(0, import_react94.useEffect)(() => {
|
|
341193
340965
|
const updateMemory = /* @__PURE__ */ __name(() => {
|
|
341194
340966
|
const usage2 = process30.memoryUsage().rss;
|
|
341195
340967
|
setMemoryUsage(formatMemoryUsage2(usage2));
|
|
@@ -341229,12 +341001,12 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
341229
341001
|
|
|
341230
341002
|
// packages/cli/src/ui/components/DebugProfiler.tsx
|
|
341231
341003
|
init_esbuild_shims();
|
|
341232
|
-
var
|
|
341004
|
+
var import_react95 = __toESM(require_react(), 1);
|
|
341233
341005
|
var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
|
|
341234
341006
|
var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
341235
|
-
const numRenders = (0,
|
|
341236
|
-
const [showNumRenders, setShowNumRenders] = (0,
|
|
341237
|
-
(0,
|
|
341007
|
+
const numRenders = (0, import_react95.useRef)(0);
|
|
341008
|
+
const [showNumRenders, setShowNumRenders] = (0, import_react95.useState)(false);
|
|
341009
|
+
(0, import_react95.useEffect)(() => {
|
|
341238
341010
|
numRenders.current++;
|
|
341239
341011
|
});
|
|
341240
341012
|
useKeypress(
|
|
@@ -341413,7 +341185,7 @@ init_core2();
|
|
|
341413
341185
|
|
|
341414
341186
|
// packages/cli/src/ui/components/ConfigInitDisplay.tsx
|
|
341415
341187
|
init_esbuild_shims();
|
|
341416
|
-
var
|
|
341188
|
+
var import_react96 = __toESM(require_react(), 1);
|
|
341417
341189
|
|
|
341418
341190
|
// packages/cli/src/utils/events.ts
|
|
341419
341191
|
init_esbuild_shims();
|
|
@@ -341425,8 +341197,8 @@ init_core2();
|
|
|
341425
341197
|
var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
|
|
341426
341198
|
var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
341427
341199
|
const config = useConfig();
|
|
341428
|
-
const [message, setMessage] = (0,
|
|
341429
|
-
(0,
|
|
341200
|
+
const [message, setMessage] = (0, import_react96.useState)("Initializing...");
|
|
341201
|
+
(0, import_react96.useEffect)(() => {
|
|
341430
341202
|
const onChange = /* @__PURE__ */ __name((clients) => {
|
|
341431
341203
|
if (!clients || clients.size === 0) {
|
|
341432
341204
|
setMessage(`Initializing...`);
|
|
@@ -341465,7 +341237,7 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
341465
341237
|
const isNarrow = isNarrowWidth(terminalWidth);
|
|
341466
341238
|
const debugConsoleMaxHeight = Math.floor(Math.max(terminalWidth * 0.2, 5));
|
|
341467
341239
|
const { contextFileNames, showAutoAcceptIndicator } = uiState;
|
|
341468
|
-
const { containerWidth } = (0,
|
|
341240
|
+
const { containerWidth } = (0, import_react97.useMemo)(
|
|
341469
341241
|
() => calculatePromptWidths(uiState.terminalWidth),
|
|
341470
341242
|
[uiState.terminalWidth]
|
|
341471
341243
|
);
|
|
@@ -347578,7 +347350,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
347578
347350
|
// packages/cli/src/utils/version.ts
|
|
347579
347351
|
async function getCliVersion() {
|
|
347580
347352
|
const pkgJson = await getPackageJson();
|
|
347581
|
-
return "0.0.28-alpha.
|
|
347353
|
+
return "0.0.28-alpha.4";
|
|
347582
347354
|
}
|
|
347583
347355
|
__name(getCliVersion, "getCliVersion");
|
|
347584
347356
|
|
|
@@ -348562,7 +348334,6 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, s
|
|
|
348562
348334
|
useBuiltinRipgrep: settings.tools?.useBuiltinRipgrep,
|
|
348563
348335
|
shouldUseNodePtyShell: settings.tools?.shell?.enableInteractiveShell,
|
|
348564
348336
|
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
|
348565
|
-
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
|
348566
348337
|
skipLoopDetection: settings.model?.skipLoopDetection ?? false,
|
|
348567
348338
|
skipStartupContext: settings.model?.skipStartupContext ?? false,
|
|
348568
348339
|
vlmSwitchMode,
|
|
@@ -348644,12 +348415,12 @@ import process50 from "node:process";
|
|
|
348644
348415
|
|
|
348645
348416
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
348646
348417
|
init_esbuild_shims();
|
|
348647
|
-
var
|
|
348418
|
+
var import_react98 = __toESM(require_react(), 1);
|
|
348648
348419
|
import process33 from "node:process";
|
|
348649
348420
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
348650
348421
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
348651
348422
|
var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
348652
|
-
(0,
|
|
348423
|
+
(0, import_react98.useEffect)(() => {
|
|
348653
348424
|
const intervalId = setInterval(() => {
|
|
348654
348425
|
const usage2 = process33.memoryUsage().rss;
|
|
348655
348426
|
if (usage2 > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -348669,11 +348440,11 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
|
348669
348440
|
|
|
348670
348441
|
// packages/cli/src/ui/hooks/useThemeCommand.ts
|
|
348671
348442
|
init_esbuild_shims();
|
|
348672
|
-
var
|
|
348443
|
+
var import_react99 = __toESM(require_react(), 1);
|
|
348673
348444
|
import process34 from "node:process";
|
|
348674
348445
|
var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
348675
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0,
|
|
348676
|
-
const openThemeDialog = (0,
|
|
348446
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react99.useState)(!!initialThemeError);
|
|
348447
|
+
const openThemeDialog = (0, import_react99.useCallback)(() => {
|
|
348677
348448
|
if (process34.env["NO_COLOR"]) {
|
|
348678
348449
|
addItem(
|
|
348679
348450
|
{
|
|
@@ -348686,7 +348457,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
348686
348457
|
}
|
|
348687
348458
|
setIsThemeDialogOpen(true);
|
|
348688
348459
|
}, [addItem]);
|
|
348689
|
-
const applyTheme = (0,
|
|
348460
|
+
const applyTheme = (0, import_react99.useCallback)(
|
|
348690
348461
|
(themeName) => {
|
|
348691
348462
|
if (!themeManager.setActiveTheme(themeName)) {
|
|
348692
348463
|
setIsThemeDialogOpen(true);
|
|
@@ -348697,13 +348468,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
348697
348468
|
},
|
|
348698
348469
|
[setThemeError]
|
|
348699
348470
|
);
|
|
348700
|
-
const handleThemeHighlight = (0,
|
|
348471
|
+
const handleThemeHighlight = (0, import_react99.useCallback)(
|
|
348701
348472
|
(themeName) => {
|
|
348702
348473
|
applyTheme(themeName);
|
|
348703
348474
|
},
|
|
348704
348475
|
[applyTheme]
|
|
348705
348476
|
);
|
|
348706
|
-
const handleThemeSelect = (0,
|
|
348477
|
+
const handleThemeSelect = (0, import_react99.useCallback)(
|
|
348707
348478
|
(themeName, scope) => {
|
|
348708
348479
|
try {
|
|
348709
348480
|
const mergedCustomThemes = {
|
|
@@ -348739,75 +348510,8 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
348739
348510
|
|
|
348740
348511
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
348741
348512
|
init_esbuild_shims();
|
|
348742
|
-
var import_react102 = __toESM(require_react(), 1);
|
|
348743
348513
|
init_core2();
|
|
348744
|
-
|
|
348745
|
-
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
348746
|
-
init_esbuild_shims();
|
|
348747
348514
|
var import_react101 = __toESM(require_react(), 1);
|
|
348748
|
-
init_core2();
|
|
348749
|
-
var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
348750
|
-
const [qwenAuthState, setQwenAuthState] = (0, import_react101.useState)({
|
|
348751
|
-
deviceAuth: null,
|
|
348752
|
-
authStatus: "idle",
|
|
348753
|
-
authMessage: null
|
|
348754
|
-
});
|
|
348755
|
-
const isQwenAuth = pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */;
|
|
348756
|
-
(0, import_react101.useEffect)(() => {
|
|
348757
|
-
if (!isQwenAuth || !isAuthenticating) {
|
|
348758
|
-
setQwenAuthState({
|
|
348759
|
-
deviceAuth: null,
|
|
348760
|
-
authStatus: "idle",
|
|
348761
|
-
authMessage: null
|
|
348762
|
-
});
|
|
348763
|
-
return;
|
|
348764
|
-
}
|
|
348765
|
-
setQwenAuthState((prev) => ({
|
|
348766
|
-
...prev,
|
|
348767
|
-
authStatus: "idle"
|
|
348768
|
-
}));
|
|
348769
|
-
const handleDeviceAuth = /* @__PURE__ */ __name((deviceAuth) => {
|
|
348770
|
-
setQwenAuthState((prev) => ({
|
|
348771
|
-
...prev,
|
|
348772
|
-
deviceAuth: {
|
|
348773
|
-
verification_uri: deviceAuth.verification_uri,
|
|
348774
|
-
verification_uri_complete: deviceAuth.verification_uri_complete,
|
|
348775
|
-
user_code: deviceAuth.user_code,
|
|
348776
|
-
expires_in: deviceAuth.expires_in,
|
|
348777
|
-
device_code: deviceAuth.device_code
|
|
348778
|
-
},
|
|
348779
|
-
authStatus: "polling"
|
|
348780
|
-
}));
|
|
348781
|
-
}, "handleDeviceAuth");
|
|
348782
|
-
const handleAuthProgress = /* @__PURE__ */ __name((status, message) => {
|
|
348783
|
-
setQwenAuthState((prev) => ({
|
|
348784
|
-
...prev,
|
|
348785
|
-
authStatus: status,
|
|
348786
|
-
authMessage: message || null
|
|
348787
|
-
}));
|
|
348788
|
-
}, "handleAuthProgress");
|
|
348789
|
-
qwenOAuth2Events.on("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
348790
|
-
qwenOAuth2Events.on("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
348791
|
-
return () => {
|
|
348792
|
-
qwenOAuth2Events.off("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
348793
|
-
qwenOAuth2Events.off("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
348794
|
-
};
|
|
348795
|
-
}, [isQwenAuth, isAuthenticating]);
|
|
348796
|
-
const cancelQwenAuth = (0, import_react101.useCallback)(() => {
|
|
348797
|
-
qwenOAuth2Events.emit("auth-cancel" /* AuthCancel */);
|
|
348798
|
-
setQwenAuthState({
|
|
348799
|
-
deviceAuth: null,
|
|
348800
|
-
authStatus: "idle",
|
|
348801
|
-
authMessage: null
|
|
348802
|
-
});
|
|
348803
|
-
}, []);
|
|
348804
|
-
return {
|
|
348805
|
-
qwenAuthState,
|
|
348806
|
-
cancelQwenAuth
|
|
348807
|
-
};
|
|
348808
|
-
}, "useQwenAuth");
|
|
348809
|
-
|
|
348810
|
-
// packages/cli/src/ui/auth/useAuth.ts
|
|
348811
348515
|
init_xhsSsoConfig();
|
|
348812
348516
|
|
|
348813
348517
|
// packages/cli/src/ui/auth/performSsoAuthFlow.ts
|
|
@@ -348940,26 +348644,91 @@ async function performSsoAuthFlow(options2) {
|
|
|
348940
348644
|
}
|
|
348941
348645
|
__name(performSsoAuthFlow, "performSsoAuthFlow");
|
|
348942
348646
|
|
|
348647
|
+
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
348648
|
+
init_esbuild_shims();
|
|
348649
|
+
var import_react100 = __toESM(require_react(), 1);
|
|
348650
|
+
init_core2();
|
|
348651
|
+
var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
348652
|
+
const [qwenAuthState, setQwenAuthState] = (0, import_react100.useState)({
|
|
348653
|
+
deviceAuth: null,
|
|
348654
|
+
authStatus: "idle",
|
|
348655
|
+
authMessage: null
|
|
348656
|
+
});
|
|
348657
|
+
const isQwenAuth = pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */;
|
|
348658
|
+
(0, import_react100.useEffect)(() => {
|
|
348659
|
+
if (!isQwenAuth || !isAuthenticating) {
|
|
348660
|
+
setQwenAuthState({
|
|
348661
|
+
deviceAuth: null,
|
|
348662
|
+
authStatus: "idle",
|
|
348663
|
+
authMessage: null
|
|
348664
|
+
});
|
|
348665
|
+
return;
|
|
348666
|
+
}
|
|
348667
|
+
setQwenAuthState((prev) => ({
|
|
348668
|
+
...prev,
|
|
348669
|
+
authStatus: "idle"
|
|
348670
|
+
}));
|
|
348671
|
+
const handleDeviceAuth = /* @__PURE__ */ __name((deviceAuth) => {
|
|
348672
|
+
setQwenAuthState((prev) => ({
|
|
348673
|
+
...prev,
|
|
348674
|
+
deviceAuth: {
|
|
348675
|
+
verification_uri: deviceAuth.verification_uri,
|
|
348676
|
+
verification_uri_complete: deviceAuth.verification_uri_complete,
|
|
348677
|
+
user_code: deviceAuth.user_code,
|
|
348678
|
+
expires_in: deviceAuth.expires_in,
|
|
348679
|
+
device_code: deviceAuth.device_code
|
|
348680
|
+
},
|
|
348681
|
+
authStatus: "polling"
|
|
348682
|
+
}));
|
|
348683
|
+
}, "handleDeviceAuth");
|
|
348684
|
+
const handleAuthProgress = /* @__PURE__ */ __name((status, message) => {
|
|
348685
|
+
setQwenAuthState((prev) => ({
|
|
348686
|
+
...prev,
|
|
348687
|
+
authStatus: status,
|
|
348688
|
+
authMessage: message || null
|
|
348689
|
+
}));
|
|
348690
|
+
}, "handleAuthProgress");
|
|
348691
|
+
qwenOAuth2Events.on("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
348692
|
+
qwenOAuth2Events.on("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
348693
|
+
return () => {
|
|
348694
|
+
qwenOAuth2Events.off("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
348695
|
+
qwenOAuth2Events.off("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
348696
|
+
};
|
|
348697
|
+
}, [isQwenAuth, isAuthenticating]);
|
|
348698
|
+
const cancelQwenAuth = (0, import_react100.useCallback)(() => {
|
|
348699
|
+
qwenOAuth2Events.emit("auth-cancel" /* AuthCancel */);
|
|
348700
|
+
setQwenAuthState({
|
|
348701
|
+
deviceAuth: null,
|
|
348702
|
+
authStatus: "idle",
|
|
348703
|
+
authMessage: null
|
|
348704
|
+
});
|
|
348705
|
+
}, []);
|
|
348706
|
+
return {
|
|
348707
|
+
qwenAuthState,
|
|
348708
|
+
cancelQwenAuth
|
|
348709
|
+
};
|
|
348710
|
+
}, "useQwenAuth");
|
|
348711
|
+
|
|
348943
348712
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
348944
|
-
var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
348713
|
+
var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
348945
348714
|
const unAuthenticated = settings.merged.security?.auth?.selectedType === void 0;
|
|
348946
348715
|
const isSSOAutoAuthInProgress = shouldTriggerAutoSSOAuth(settings);
|
|
348947
|
-
const [authState, setAuthState] = (0,
|
|
348716
|
+
const [authState, setAuthState] = (0, import_react101.useState)(
|
|
348948
348717
|
unAuthenticated ? "updating" /* Updating */ : "unauthenticated" /* Unauthenticated */
|
|
348949
348718
|
);
|
|
348950
|
-
const [authError, setAuthError] = (0,
|
|
348951
|
-
const [isAuthenticating, setIsAuthenticating] = (0,
|
|
348952
|
-
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0,
|
|
348719
|
+
const [authError, setAuthError] = (0, import_react101.useState)(null);
|
|
348720
|
+
const [isAuthenticating, setIsAuthenticating] = (0, import_react101.useState)(false);
|
|
348721
|
+
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react101.useState)(
|
|
348953
348722
|
unAuthenticated && !isSSOAutoAuthInProgress
|
|
348954
348723
|
);
|
|
348955
|
-
const [pendingAuthType, setPendingAuthType] = (0,
|
|
348724
|
+
const [pendingAuthType, setPendingAuthType] = (0, import_react101.useState)(
|
|
348956
348725
|
void 0
|
|
348957
348726
|
);
|
|
348958
348727
|
const { qwenAuthState, cancelQwenAuth } = useQwenAuth(
|
|
348959
348728
|
pendingAuthType,
|
|
348960
348729
|
isAuthenticating
|
|
348961
348730
|
);
|
|
348962
|
-
const onAuthError = (0,
|
|
348731
|
+
const onAuthError = (0, import_react101.useCallback)(
|
|
348963
348732
|
(error) => {
|
|
348964
348733
|
setAuthError(error);
|
|
348965
348734
|
if (error) {
|
|
@@ -348969,7 +348738,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
348969
348738
|
},
|
|
348970
348739
|
[setAuthError, setAuthState]
|
|
348971
348740
|
);
|
|
348972
|
-
const handleAuthFailure = (0,
|
|
348741
|
+
const handleAuthFailure = (0, import_react101.useCallback)(
|
|
348973
348742
|
(error) => {
|
|
348974
348743
|
setIsAuthenticating(false);
|
|
348975
348744
|
setPendingAuthType(void 0);
|
|
@@ -348987,7 +348756,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
348987
348756
|
},
|
|
348988
348757
|
[onAuthError, pendingAuthType, config]
|
|
348989
348758
|
);
|
|
348990
|
-
const handleAuthSuccess = (0,
|
|
348759
|
+
const handleAuthSuccess = (0, import_react101.useCallback)(
|
|
348991
348760
|
async (authType, scope, credentials) => {
|
|
348992
348761
|
try {
|
|
348993
348762
|
settings.setValue(scope, "security.auth.selectedType", authType);
|
|
@@ -349022,10 +348791,17 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
349022
348791
|
setIsAuthenticating(false);
|
|
349023
348792
|
const authEvent = new AuthEvent(authType, "manual", "success");
|
|
349024
348793
|
logAuth(config, authEvent);
|
|
348794
|
+
addItem(
|
|
348795
|
+
{
|
|
348796
|
+
type: "info" /* INFO */,
|
|
348797
|
+
text: `Authenticated successfully with ${authType} credentials.`
|
|
348798
|
+
},
|
|
348799
|
+
Date.now()
|
|
348800
|
+
);
|
|
349025
348801
|
},
|
|
349026
|
-
[settings, handleAuthFailure, config]
|
|
348802
|
+
[settings, handleAuthFailure, config, addItem]
|
|
349027
348803
|
);
|
|
349028
|
-
const performAuth = (0,
|
|
348804
|
+
const performAuth = (0, import_react101.useCallback)(
|
|
349029
348805
|
async (authType, scope, credentials) => {
|
|
349030
348806
|
try {
|
|
349031
348807
|
await config.refreshAuth(authType);
|
|
@@ -349036,7 +348812,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
349036
348812
|
},
|
|
349037
348813
|
[config, handleAuthSuccess, handleAuthFailure]
|
|
349038
348814
|
);
|
|
349039
|
-
const handleAuthSelect = (0,
|
|
348815
|
+
const handleAuthSelect = (0, import_react101.useCallback)(
|
|
349040
348816
|
async (authType, scope, credentials) => {
|
|
349041
348817
|
if (!authType) {
|
|
349042
348818
|
setIsAuthDialogOpen(false);
|
|
@@ -349143,10 +348919,10 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
349143
348919
|
handleAuthFailure
|
|
349144
348920
|
]
|
|
349145
348921
|
);
|
|
349146
|
-
const openAuthDialog = (0,
|
|
348922
|
+
const openAuthDialog = (0, import_react101.useCallback)(() => {
|
|
349147
348923
|
setIsAuthDialogOpen(true);
|
|
349148
348924
|
}, []);
|
|
349149
|
-
const cancelAuthentication = (0,
|
|
348925
|
+
const cancelAuthentication = (0, import_react101.useCallback)(() => {
|
|
349150
348926
|
if (isAuthenticating && pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
349151
348927
|
cancelQwenAuth();
|
|
349152
348928
|
}
|
|
@@ -349158,7 +348934,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
349158
348934
|
setIsAuthDialogOpen(true);
|
|
349159
348935
|
setAuthError(null);
|
|
349160
348936
|
}, [isAuthenticating, pendingAuthType, cancelQwenAuth, config]);
|
|
349161
|
-
(0,
|
|
348937
|
+
(0, import_react101.useEffect)(() => {
|
|
349162
348938
|
const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
|
|
349163
348939
|
if (defaultAuthType && !["qwen-oauth" /* QWEN_OAUTH */, "openai" /* USE_OPENAI */, "xhs-sso" /* XHS_SSO */].includes(
|
|
349164
348940
|
defaultAuthType
|
|
@@ -349186,7 +348962,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
349186
348962
|
// packages/cli/src/ui/hooks/useQuotaAndFallback.ts
|
|
349187
348963
|
init_esbuild_shims();
|
|
349188
348964
|
init_core2();
|
|
349189
|
-
var
|
|
348965
|
+
var import_react102 = __toESM(require_react(), 1);
|
|
349190
348966
|
function useQuotaAndFallback({
|
|
349191
348967
|
config,
|
|
349192
348968
|
historyManager,
|
|
@@ -349194,9 +348970,9 @@ function useQuotaAndFallback({
|
|
|
349194
348970
|
setAuthState,
|
|
349195
348971
|
setModelSwitchedFromQuotaError
|
|
349196
348972
|
}) {
|
|
349197
|
-
const [proQuotaRequest, setProQuotaRequest] = (0,
|
|
349198
|
-
const isDialogPending = (0,
|
|
349199
|
-
(0,
|
|
348973
|
+
const [proQuotaRequest, setProQuotaRequest] = (0, import_react102.useState)(null);
|
|
348974
|
+
const isDialogPending = (0, import_react102.useRef)(false);
|
|
348975
|
+
(0, import_react102.useEffect)(() => {
|
|
349200
348976
|
const fallbackHandler = /* @__PURE__ */ __name(async (failedModel, fallbackModel, error) => {
|
|
349201
348977
|
if (config.isInFallbackMode()) {
|
|
349202
348978
|
return null;
|
|
@@ -349274,7 +349050,7 @@ function useQuotaAndFallback({
|
|
|
349274
349050
|
}, "fallbackHandler");
|
|
349275
349051
|
config.setFallbackModelHandler(fallbackHandler);
|
|
349276
349052
|
}, [config, historyManager, userTier, setModelSwitchedFromQuotaError]);
|
|
349277
|
-
const handleProQuotaChoice = (0,
|
|
349053
|
+
const handleProQuotaChoice = (0, import_react102.useCallback)(
|
|
349278
349054
|
(choice2) => {
|
|
349279
349055
|
if (!proQuotaRequest) return;
|
|
349280
349056
|
const intent = choice2 === "auth" ? "auth" : "retry";
|
|
@@ -349304,14 +349080,14 @@ __name(useQuotaAndFallback, "useQuotaAndFallback");
|
|
|
349304
349080
|
|
|
349305
349081
|
// packages/cli/src/ui/hooks/useEditorSettings.ts
|
|
349306
349082
|
init_esbuild_shims();
|
|
349307
|
-
var
|
|
349083
|
+
var import_react103 = __toESM(require_react(), 1);
|
|
349308
349084
|
init_core2();
|
|
349309
349085
|
var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
|
|
349310
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0,
|
|
349311
|
-
const openEditorDialog = (0,
|
|
349086
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react103.useState)(false);
|
|
349087
|
+
const openEditorDialog = (0, import_react103.useCallback)(() => {
|
|
349312
349088
|
setIsEditorDialogOpen(true);
|
|
349313
349089
|
}, []);
|
|
349314
|
-
const handleEditorSelect = (0,
|
|
349090
|
+
const handleEditorSelect = (0, import_react103.useCallback)(
|
|
349315
349091
|
(editorType, scope) => {
|
|
349316
349092
|
if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
|
|
349317
349093
|
return;
|
|
@@ -349333,7 +349109,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
349333
349109
|
},
|
|
349334
349110
|
[loadedSettings, setEditorError, addItem]
|
|
349335
349111
|
);
|
|
349336
|
-
const exitEditorDialog = (0,
|
|
349112
|
+
const exitEditorDialog = (0, import_react103.useCallback)(() => {
|
|
349337
349113
|
setIsEditorDialogOpen(false);
|
|
349338
349114
|
}, []);
|
|
349339
349115
|
return {
|
|
@@ -349346,13 +349122,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
349346
349122
|
|
|
349347
349123
|
// packages/cli/src/ui/hooks/useSettingsCommand.ts
|
|
349348
349124
|
init_esbuild_shims();
|
|
349349
|
-
var
|
|
349125
|
+
var import_react104 = __toESM(require_react(), 1);
|
|
349350
349126
|
function useSettingsCommand() {
|
|
349351
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0,
|
|
349352
|
-
const openSettingsDialog = (0,
|
|
349127
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react104.useState)(false);
|
|
349128
|
+
const openSettingsDialog = (0, import_react104.useCallback)(() => {
|
|
349353
349129
|
setIsSettingsDialogOpen(true);
|
|
349354
349130
|
}, []);
|
|
349355
|
-
const closeSettingsDialog = (0,
|
|
349131
|
+
const closeSettingsDialog = (0, import_react104.useCallback)(() => {
|
|
349356
349132
|
setIsSettingsDialogOpen(false);
|
|
349357
349133
|
}, []);
|
|
349358
349134
|
return {
|
|
@@ -349365,13 +349141,13 @@ __name(useSettingsCommand, "useSettingsCommand");
|
|
|
349365
349141
|
|
|
349366
349142
|
// packages/cli/src/ui/hooks/useModelCommand.ts
|
|
349367
349143
|
init_esbuild_shims();
|
|
349368
|
-
var
|
|
349144
|
+
var import_react105 = __toESM(require_react(), 1);
|
|
349369
349145
|
var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
349370
|
-
const [isModelDialogOpen, setIsModelDialogOpen] = (0,
|
|
349371
|
-
const openModelDialog = (0,
|
|
349146
|
+
const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react105.useState)(false);
|
|
349147
|
+
const openModelDialog = (0, import_react105.useCallback)(() => {
|
|
349372
349148
|
setIsModelDialogOpen(true);
|
|
349373
349149
|
}, []);
|
|
349374
|
-
const closeModelDialog = (0,
|
|
349150
|
+
const closeModelDialog = (0, import_react105.useCallback)(() => {
|
|
349375
349151
|
setIsModelDialogOpen(false);
|
|
349376
349152
|
}, []);
|
|
349377
349153
|
return {
|
|
@@ -349383,13 +349159,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
|
349383
349159
|
|
|
349384
349160
|
// packages/cli/src/ui/hooks/useApprovalModeCommand.ts
|
|
349385
349161
|
init_esbuild_shims();
|
|
349386
|
-
var
|
|
349162
|
+
var import_react106 = __toESM(require_react(), 1);
|
|
349387
349163
|
var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
|
|
349388
|
-
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0,
|
|
349389
|
-
const openApprovalModeDialog = (0,
|
|
349164
|
+
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react106.useState)(false);
|
|
349165
|
+
const openApprovalModeDialog = (0, import_react106.useCallback)(() => {
|
|
349390
349166
|
setIsApprovalModeDialogOpen(true);
|
|
349391
349167
|
}, []);
|
|
349392
|
-
const handleApprovalModeSelect = (0,
|
|
349168
|
+
const handleApprovalModeSelect = (0, import_react106.useCallback)(
|
|
349393
349169
|
(mode, scope) => {
|
|
349394
349170
|
try {
|
|
349395
349171
|
if (!mode) {
|
|
@@ -349415,7 +349191,7 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
|
|
|
349415
349191
|
|
|
349416
349192
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
349417
349193
|
init_esbuild_shims();
|
|
349418
|
-
var
|
|
349194
|
+
var import_react109 = __toESM(require_react(), 1);
|
|
349419
349195
|
|
|
349420
349196
|
// packages/cli/node_modules/@google/genai/dist/node/index.mjs
|
|
349421
349197
|
init_esbuild_shims();
|
|
@@ -349891,7 +349667,7 @@ init_core2();
|
|
|
349891
349667
|
|
|
349892
349668
|
// packages/cli/src/generated/git-commit.ts
|
|
349893
349669
|
init_esbuild_shims();
|
|
349894
|
-
var GIT_COMMIT_INFO2 = "
|
|
349670
|
+
var GIT_COMMIT_INFO2 = "a0e0781";
|
|
349895
349671
|
|
|
349896
349672
|
// packages/cli/src/utils/systemInfo.ts
|
|
349897
349673
|
async function getNpmVersion() {
|
|
@@ -350249,7 +350025,7 @@ ${formatUsageMessage()}`
|
|
|
350249
350025
|
|
|
350250
350026
|
// packages/cli/src/ui/commands/chatCommand.ts
|
|
350251
350027
|
init_esbuild_shims();
|
|
350252
|
-
var
|
|
350028
|
+
var import_react107 = __toESM(require_react(), 1);
|
|
350253
350029
|
import * as fsPromises5 from "node:fs/promises";
|
|
350254
350030
|
init_core2();
|
|
350255
350031
|
import path86 from "node:path";
|
|
@@ -350337,11 +350113,11 @@ var saveCommand = {
|
|
|
350337
350113
|
if (exists2) {
|
|
350338
350114
|
return {
|
|
350339
350115
|
type: "confirm_action",
|
|
350340
|
-
prompt:
|
|
350116
|
+
prompt: import_react107.default.createElement(
|
|
350341
350117
|
Text,
|
|
350342
350118
|
null,
|
|
350343
350119
|
"A checkpoint with the tag ",
|
|
350344
|
-
|
|
350120
|
+
import_react107.default.createElement(Text, { color: theme.text.accent }, tag2),
|
|
350345
350121
|
" already exists. Do you want to overwrite it?"
|
|
350346
350122
|
),
|
|
350347
350123
|
originalInvocation: {
|
|
@@ -352820,7 +352596,7 @@ init_esbuild_shims();
|
|
|
352820
352596
|
init_core2();
|
|
352821
352597
|
import * as fs81 from "node:fs";
|
|
352822
352598
|
import * as path90 from "node:path";
|
|
352823
|
-
var
|
|
352599
|
+
var import_react108 = __toESM(require_react(), 1);
|
|
352824
352600
|
var initCommand = {
|
|
352825
352601
|
name: "init",
|
|
352826
352602
|
description: "\u5206\u6790\u9879\u76EE\u5E76\u521B\u5EFA RDMind.md ",
|
|
@@ -352846,7 +352622,7 @@ var initCommand = {
|
|
|
352846
352622
|
type: "confirm_action",
|
|
352847
352623
|
// TODO: Move to .tsx file to use JSX syntax instead of React.createElement
|
|
352848
352624
|
// For now, using React.createElement to maintain .ts compatibility for PR review
|
|
352849
|
-
prompt:
|
|
352625
|
+
prompt: import_react108.default.createElement(
|
|
352850
352626
|
Text,
|
|
352851
352627
|
null,
|
|
352852
352628
|
`A ${contextFileName} file already exists in this directory. Do you want to regenerate it?`
|
|
@@ -356468,41 +356244,41 @@ var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
|
356468
356244
|
init_extensions();
|
|
356469
356245
|
var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized) => {
|
|
356470
356246
|
const session = useSessionStats();
|
|
356471
|
-
const [commands, setCommands] = (0,
|
|
356472
|
-
const [reloadTrigger, setReloadTrigger] = (0,
|
|
356473
|
-
const reloadCommands = (0,
|
|
356247
|
+
const [commands, setCommands] = (0, import_react109.useState)([]);
|
|
356248
|
+
const [reloadTrigger, setReloadTrigger] = (0, import_react109.useState)(0);
|
|
356249
|
+
const reloadCommands = (0, import_react109.useCallback)(() => {
|
|
356474
356250
|
setReloadTrigger((v) => v + 1);
|
|
356475
356251
|
}, []);
|
|
356476
|
-
const [shellConfirmationRequest, setShellConfirmationRequest] = (0,
|
|
356477
|
-
const [confirmationRequest, setConfirmationRequest] = (0,
|
|
356478
|
-
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0,
|
|
356479
|
-
const [sessionShellAllowlist, setSessionShellAllowlist] = (0,
|
|
356252
|
+
const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react109.useState)(null);
|
|
356253
|
+
const [confirmationRequest, setConfirmationRequest] = (0, import_react109.useState)(null);
|
|
356254
|
+
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0, import_react109.useState)(null);
|
|
356255
|
+
const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react109.useState)(
|
|
356480
356256
|
/* @__PURE__ */ new Set()
|
|
356481
356257
|
);
|
|
356482
|
-
const gitService = (0,
|
|
356258
|
+
const gitService = (0, import_react109.useMemo)(() => {
|
|
356483
356259
|
if (!config?.getProjectRoot()) {
|
|
356484
356260
|
return;
|
|
356485
356261
|
}
|
|
356486
356262
|
return new GitService(config.getProjectRoot(), config.storage);
|
|
356487
356263
|
}, [config]);
|
|
356488
|
-
const logger6 = (0,
|
|
356264
|
+
const logger6 = (0, import_react109.useMemo)(() => {
|
|
356489
356265
|
const l2 = new Logger(
|
|
356490
356266
|
config?.getSessionId() || "",
|
|
356491
356267
|
config?.storage ?? new Storage(process37.cwd())
|
|
356492
356268
|
);
|
|
356493
356269
|
return l2;
|
|
356494
356270
|
}, [config]);
|
|
356495
|
-
const [pendingItem, setPendingItem] = (0,
|
|
356271
|
+
const [pendingItem, setPendingItem] = (0, import_react109.useState)(
|
|
356496
356272
|
null
|
|
356497
356273
|
);
|
|
356498
|
-
const pendingHistoryItems = (0,
|
|
356274
|
+
const pendingHistoryItems = (0, import_react109.useMemo)(() => {
|
|
356499
356275
|
const items = [];
|
|
356500
356276
|
if (pendingItem != null) {
|
|
356501
356277
|
items.push(pendingItem);
|
|
356502
356278
|
}
|
|
356503
356279
|
return items;
|
|
356504
356280
|
}, [pendingItem]);
|
|
356505
|
-
const addMessage = (0,
|
|
356281
|
+
const addMessage = (0, import_react109.useCallback)(
|
|
356506
356282
|
(message) => {
|
|
356507
356283
|
let historyItemContent;
|
|
356508
356284
|
if (message.type === "about" /* ABOUT */) {
|
|
@@ -356558,7 +356334,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
356558
356334
|
},
|
|
356559
356335
|
[addItem]
|
|
356560
356336
|
);
|
|
356561
|
-
const commandContext = (0,
|
|
356337
|
+
const commandContext = (0, import_react109.useMemo)(
|
|
356562
356338
|
() => ({
|
|
356563
356339
|
services: {
|
|
356564
356340
|
config,
|
|
@@ -356610,7 +356386,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
356610
356386
|
extensionsUpdateState
|
|
356611
356387
|
]
|
|
356612
356388
|
);
|
|
356613
|
-
(0,
|
|
356389
|
+
(0, import_react109.useEffect)(() => {
|
|
356614
356390
|
if (!config) {
|
|
356615
356391
|
return;
|
|
356616
356392
|
}
|
|
@@ -356628,7 +356404,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
356628
356404
|
})();
|
|
356629
356405
|
};
|
|
356630
356406
|
}, [config, reloadCommands]);
|
|
356631
|
-
(0,
|
|
356407
|
+
(0, import_react109.useEffect)(() => {
|
|
356632
356408
|
const controller = new AbortController();
|
|
356633
356409
|
const load = /* @__PURE__ */ __name(async () => {
|
|
356634
356410
|
const loaders = [
|
|
@@ -356647,7 +356423,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
356647
356423
|
controller.abort();
|
|
356648
356424
|
};
|
|
356649
356425
|
}, [config, reloadTrigger, isConfigInitialized]);
|
|
356650
|
-
const handleSlashCommand2 = (0,
|
|
356426
|
+
const handleSlashCommand2 = (0, import_react109.useCallback)(
|
|
356651
356427
|
async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed) => {
|
|
356652
356428
|
if (typeof rawQuery !== "string") {
|
|
356653
356429
|
return false;
|
|
@@ -356970,7 +356746,7 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
356970
356746
|
|
|
356971
356747
|
// packages/cli/src/ui/hooks/useConsoleMessages.ts
|
|
356972
356748
|
init_esbuild_shims();
|
|
356973
|
-
var
|
|
356749
|
+
var import_react110 = __toESM(require_react(), 1);
|
|
356974
356750
|
function consoleMessagesReducer(state, action) {
|
|
356975
356751
|
switch (action.type) {
|
|
356976
356752
|
case "ADD_MESSAGES": {
|
|
@@ -356996,11 +356772,11 @@ function consoleMessagesReducer(state, action) {
|
|
|
356996
356772
|
}
|
|
356997
356773
|
__name(consoleMessagesReducer, "consoleMessagesReducer");
|
|
356998
356774
|
function useConsoleMessages() {
|
|
356999
|
-
const [consoleMessages, dispatch] = (0,
|
|
357000
|
-
const messageQueueRef = (0,
|
|
357001
|
-
const timeoutRef = (0,
|
|
357002
|
-
const [, startTransition] = (0,
|
|
357003
|
-
const processQueue = (0,
|
|
356775
|
+
const [consoleMessages, dispatch] = (0, import_react110.useReducer)(consoleMessagesReducer, []);
|
|
356776
|
+
const messageQueueRef = (0, import_react110.useRef)([]);
|
|
356777
|
+
const timeoutRef = (0, import_react110.useRef)(null);
|
|
356778
|
+
const [, startTransition] = (0, import_react110.useTransition)();
|
|
356779
|
+
const processQueue = (0, import_react110.useCallback)(() => {
|
|
357004
356780
|
if (messageQueueRef.current.length > 0) {
|
|
357005
356781
|
const messagesToProcess = messageQueueRef.current;
|
|
357006
356782
|
messageQueueRef.current = [];
|
|
@@ -357010,7 +356786,7 @@ function useConsoleMessages() {
|
|
|
357010
356786
|
}
|
|
357011
356787
|
timeoutRef.current = null;
|
|
357012
356788
|
}, []);
|
|
357013
|
-
const handleNewMessage = (0,
|
|
356789
|
+
const handleNewMessage = (0, import_react110.useCallback)(
|
|
357014
356790
|
(message) => {
|
|
357015
356791
|
messageQueueRef.current.push(message);
|
|
357016
356792
|
if (!timeoutRef.current) {
|
|
@@ -357019,7 +356795,7 @@ function useConsoleMessages() {
|
|
|
357019
356795
|
},
|
|
357020
356796
|
[processQueue]
|
|
357021
356797
|
);
|
|
357022
|
-
const clearConsoleMessages = (0,
|
|
356798
|
+
const clearConsoleMessages = (0, import_react110.useCallback)(() => {
|
|
357023
356799
|
if (timeoutRef.current) {
|
|
357024
356800
|
clearTimeout(timeoutRef.current);
|
|
357025
356801
|
timeoutRef.current = null;
|
|
@@ -357029,7 +356805,7 @@ function useConsoleMessages() {
|
|
|
357029
356805
|
dispatch({ type: "CLEAR" });
|
|
357030
356806
|
});
|
|
357031
356807
|
}, []);
|
|
357032
|
-
(0,
|
|
356808
|
+
(0, import_react110.useEffect)(
|
|
357033
356809
|
() => () => {
|
|
357034
356810
|
if (timeoutRef.current) {
|
|
357035
356811
|
clearTimeout(timeoutRef.current);
|
|
@@ -357059,11 +356835,11 @@ __name(computeWindowTitle, "computeWindowTitle");
|
|
|
357059
356835
|
|
|
357060
356836
|
// packages/cli/src/ui/hooks/useLogger.ts
|
|
357061
356837
|
init_esbuild_shims();
|
|
357062
|
-
var
|
|
356838
|
+
var import_react111 = __toESM(require_react(), 1);
|
|
357063
356839
|
init_core2();
|
|
357064
356840
|
var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
357065
|
-
const [logger6, setLogger] = (0,
|
|
357066
|
-
(0,
|
|
356841
|
+
const [logger6, setLogger] = (0, import_react111.useState)(null);
|
|
356842
|
+
(0, import_react111.useEffect)(() => {
|
|
357067
356843
|
const newLogger = new Logger(sessionId, storage);
|
|
357068
356844
|
newLogger.initialize().then(() => {
|
|
357069
356845
|
setLogger(newLogger);
|
|
@@ -357075,12 +356851,12 @@ var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
|
357075
356851
|
|
|
357076
356852
|
// packages/cli/src/ui/hooks/useGeminiStream.ts
|
|
357077
356853
|
init_esbuild_shims();
|
|
357078
|
-
var
|
|
356854
|
+
var import_react116 = __toESM(require_react(), 1);
|
|
357079
356855
|
init_core2();
|
|
357080
356856
|
|
|
357081
356857
|
// packages/cli/src/ui/hooks/shellCommandProcessor.ts
|
|
357082
356858
|
init_esbuild_shims();
|
|
357083
|
-
var
|
|
356859
|
+
var import_react112 = __toESM(require_react(), 1);
|
|
357084
356860
|
init_core2();
|
|
357085
356861
|
import crypto18 from "node:crypto";
|
|
357086
356862
|
import path98 from "node:path";
|
|
@@ -357109,8 +356885,8 @@ ${modelContent}
|
|
|
357109
356885
|
}
|
|
357110
356886
|
__name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
|
|
357111
356887
|
var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
|
|
357112
|
-
const [activeShellPtyId, setActiveShellPtyId] = (0,
|
|
357113
|
-
const handleShellCommand = (0,
|
|
356888
|
+
const [activeShellPtyId, setActiveShellPtyId] = (0, import_react112.useState)(null);
|
|
356889
|
+
const handleShellCommand = (0, import_react112.useCallback)(
|
|
357114
356890
|
(rawQuery, abortSignal) => {
|
|
357115
356891
|
if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
|
|
357116
356892
|
return false;
|
|
@@ -357359,7 +357135,7 @@ ${finalOutput}`;
|
|
|
357359
357135
|
// packages/cli/src/ui/hooks/useVisionAutoSwitch.ts
|
|
357360
357136
|
init_esbuild_shims();
|
|
357361
357137
|
init_core2();
|
|
357362
|
-
var
|
|
357138
|
+
var import_react113 = __toESM(require_react(), 1);
|
|
357363
357139
|
init_core2();
|
|
357364
357140
|
function hasImageParts(parts) {
|
|
357365
357141
|
if (typeof parts === "string") {
|
|
@@ -357449,8 +357225,8 @@ function processVisionSwitchOutcome(outcome) {
|
|
|
357449
357225
|
}
|
|
357450
357226
|
__name(processVisionSwitchOutcome, "processVisionSwitchOutcome");
|
|
357451
357227
|
function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true, onVisionSwitchRequired) {
|
|
357452
|
-
const originalModelRef = (0,
|
|
357453
|
-
const handleVisionSwitch = (0,
|
|
357228
|
+
const originalModelRef = (0, import_react113.useRef)(null);
|
|
357229
|
+
const handleVisionSwitch = (0, import_react113.useCallback)(
|
|
357454
357230
|
async (query, userMessageTimestamp, isContinuation) => {
|
|
357455
357231
|
if (isContinuation || !onVisionSwitchRequired) {
|
|
357456
357232
|
return { shouldProceed: true };
|
|
@@ -357551,7 +357327,7 @@ function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true,
|
|
|
357551
357327
|
},
|
|
357552
357328
|
[config, addItem, visionModelPreviewEnabled, onVisionSwitchRequired]
|
|
357553
357329
|
);
|
|
357554
|
-
const restoreOriginalModel = (0,
|
|
357330
|
+
const restoreOriginalModel = (0, import_react113.useCallback)(async () => {
|
|
357555
357331
|
if (originalModelRef.current) {
|
|
357556
357332
|
await config.setModel(originalModelRef.current, {
|
|
357557
357333
|
reason: "vision_auto_switch",
|
|
@@ -357967,11 +357743,11 @@ var findLastSafeSplitPoint = /* @__PURE__ */ __name((content) => {
|
|
|
357967
357743
|
|
|
357968
357744
|
// packages/cli/src/ui/hooks/useStateAndRef.ts
|
|
357969
357745
|
init_esbuild_shims();
|
|
357970
|
-
var
|
|
357746
|
+
var import_react114 = __toESM(require_react(), 1);
|
|
357971
357747
|
var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
357972
|
-
const [state, setState] =
|
|
357973
|
-
const ref =
|
|
357974
|
-
const setStateInternal =
|
|
357748
|
+
const [state, setState] = import_react114.default.useState(initialValue);
|
|
357749
|
+
const ref = import_react114.default.useRef(initialValue);
|
|
357750
|
+
const setStateInternal = import_react114.default.useCallback(
|
|
357975
357751
|
(newStateOrCallback) => {
|
|
357976
357752
|
let newValue;
|
|
357977
357753
|
if (typeof newStateOrCallback === "function") {
|
|
@@ -357990,10 +357766,10 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
|
357990
357766
|
// packages/cli/src/ui/hooks/useReactToolScheduler.ts
|
|
357991
357767
|
init_esbuild_shims();
|
|
357992
357768
|
init_core2();
|
|
357993
|
-
var
|
|
357769
|
+
var import_react115 = __toESM(require_react(), 1);
|
|
357994
357770
|
function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
|
|
357995
|
-
const [toolCallsForDisplay, setToolCallsForDisplay] = (0,
|
|
357996
|
-
const outputUpdateHandler = (0,
|
|
357771
|
+
const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react115.useState)([]);
|
|
357772
|
+
const outputUpdateHandler = (0, import_react115.useCallback)(
|
|
357997
357773
|
(toolCallId, outputChunk) => {
|
|
357998
357774
|
setToolCallsForDisplay(
|
|
357999
357775
|
(prevCalls) => prevCalls.map((tc) => {
|
|
@@ -358007,13 +357783,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
358007
357783
|
},
|
|
358008
357784
|
[]
|
|
358009
357785
|
);
|
|
358010
|
-
const allToolCallsCompleteHandler = (0,
|
|
357786
|
+
const allToolCallsCompleteHandler = (0, import_react115.useCallback)(
|
|
358011
357787
|
async (completedToolCalls) => {
|
|
358012
357788
|
await onComplete(completedToolCalls);
|
|
358013
357789
|
},
|
|
358014
357790
|
[onComplete]
|
|
358015
357791
|
);
|
|
358016
|
-
const toolCallsUpdateHandler = (0,
|
|
357792
|
+
const toolCallsUpdateHandler = (0, import_react115.useCallback)(
|
|
358017
357793
|
(updatedCoreToolCalls) => {
|
|
358018
357794
|
setToolCallsForDisplay(
|
|
358019
357795
|
(prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
|
|
@@ -358040,7 +357816,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
358040
357816
|
},
|
|
358041
357817
|
[setToolCallsForDisplay]
|
|
358042
357818
|
);
|
|
358043
|
-
const scheduler = (0,
|
|
357819
|
+
const scheduler = (0, import_react115.useMemo)(
|
|
358044
357820
|
() => new CoreToolScheduler({
|
|
358045
357821
|
outputUpdateHandler,
|
|
358046
357822
|
onAllToolCallsComplete: allToolCallsCompleteHandler,
|
|
@@ -358059,13 +357835,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
358059
357835
|
onEditorClose
|
|
358060
357836
|
]
|
|
358061
357837
|
);
|
|
358062
|
-
const schedule = (0,
|
|
357838
|
+
const schedule = (0, import_react115.useCallback)(
|
|
358063
357839
|
(request4, signal) => {
|
|
358064
357840
|
void scheduler.schedule(request4, signal);
|
|
358065
357841
|
},
|
|
358066
357842
|
[scheduler]
|
|
358067
357843
|
);
|
|
358068
|
-
const markToolsAsSubmitted = (0,
|
|
357844
|
+
const markToolsAsSubmitted = (0, import_react115.useCallback)(
|
|
358069
357845
|
(callIdsToMark) => {
|
|
358070
357846
|
setToolCallsForDisplay(
|
|
358071
357847
|
(prevCalls) => prevCalls.map(
|
|
@@ -358214,18 +357990,18 @@ function showCitations(settings) {
|
|
|
358214
357990
|
}
|
|
358215
357991
|
__name(showCitations, "showCitations");
|
|
358216
357992
|
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) => {
|
|
358217
|
-
const [initError, setInitError] = (0,
|
|
358218
|
-
const abortControllerRef = (0,
|
|
358219
|
-
const turnCancelledRef = (0,
|
|
358220
|
-
const isSubmittingQueryRef = (0,
|
|
358221
|
-
const [isResponding, setIsResponding] = (0,
|
|
358222
|
-
const [thought, setThought] = (0,
|
|
357993
|
+
const [initError, setInitError] = (0, import_react116.useState)(null);
|
|
357994
|
+
const abortControllerRef = (0, import_react116.useRef)(null);
|
|
357995
|
+
const turnCancelledRef = (0, import_react116.useRef)(false);
|
|
357996
|
+
const isSubmittingQueryRef = (0, import_react116.useRef)(false);
|
|
357997
|
+
const [isResponding, setIsResponding] = (0, import_react116.useState)(false);
|
|
357998
|
+
const [thought, setThought] = (0, import_react116.useState)(null);
|
|
358223
357999
|
const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
|
|
358224
|
-
const processedMemoryToolsRef = (0,
|
|
358000
|
+
const processedMemoryToolsRef = (0, import_react116.useRef)(/* @__PURE__ */ new Set());
|
|
358225
358001
|
const { startNewPrompt, getPromptCount } = useSessionStats();
|
|
358226
358002
|
const storage = config.storage;
|
|
358227
358003
|
const logger6 = useLogger(storage);
|
|
358228
|
-
const gitService = (0,
|
|
358004
|
+
const gitService = (0, import_react116.useMemo)(() => {
|
|
358229
358005
|
if (!config.getProjectRoot()) {
|
|
358230
358006
|
return;
|
|
358231
358007
|
}
|
|
@@ -358249,11 +358025,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358249
358025
|
getPreferredEditor,
|
|
358250
358026
|
onEditorClose
|
|
358251
358027
|
);
|
|
358252
|
-
const pendingToolCallGroupDisplay = (0,
|
|
358028
|
+
const pendingToolCallGroupDisplay = (0, import_react116.useMemo)(
|
|
358253
358029
|
() => toolCalls.length ? mapToDisplay(toolCalls) : void 0,
|
|
358254
358030
|
[toolCalls]
|
|
358255
358031
|
);
|
|
358256
|
-
const activeToolPtyId = (0,
|
|
358032
|
+
const activeToolPtyId = (0, import_react116.useMemo)(() => {
|
|
358257
358033
|
const executingShellTool = toolCalls?.find(
|
|
358258
358034
|
(tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
|
|
358259
358035
|
);
|
|
@@ -358262,12 +358038,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358262
358038
|
}
|
|
358263
358039
|
return void 0;
|
|
358264
358040
|
}, [toolCalls]);
|
|
358265
|
-
const loopDetectedRef = (0,
|
|
358041
|
+
const loopDetectedRef = (0, import_react116.useRef)(false);
|
|
358266
358042
|
const [
|
|
358267
358043
|
loopDetectionConfirmationRequest,
|
|
358268
358044
|
setLoopDetectionConfirmationRequest
|
|
358269
|
-
] = (0,
|
|
358270
|
-
const onExec = (0,
|
|
358045
|
+
] = (0, import_react116.useState)(null);
|
|
358046
|
+
const onExec = (0, import_react116.useCallback)(async (done) => {
|
|
358271
358047
|
setIsResponding(true);
|
|
358272
358048
|
await done;
|
|
358273
358049
|
setIsResponding(false);
|
|
@@ -358290,12 +358066,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358290
358066
|
onVisionSwitchRequired
|
|
358291
358067
|
);
|
|
358292
358068
|
const activePtyId = activeShellPtyId || activeToolPtyId;
|
|
358293
|
-
(0,
|
|
358069
|
+
(0, import_react116.useEffect)(() => {
|
|
358294
358070
|
if (!activePtyId) {
|
|
358295
358071
|
setShellInputFocused(false);
|
|
358296
358072
|
}
|
|
358297
358073
|
}, [activePtyId, setShellInputFocused]);
|
|
358298
|
-
const streamingState = (0,
|
|
358074
|
+
const streamingState = (0, import_react116.useMemo)(() => {
|
|
358299
358075
|
if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
|
|
358300
358076
|
return "waiting_for_confirmation" /* WaitingForConfirmation */;
|
|
358301
358077
|
}
|
|
@@ -358306,7 +358082,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358306
358082
|
}
|
|
358307
358083
|
return "idle" /* Idle */;
|
|
358308
358084
|
}, [isResponding, toolCalls]);
|
|
358309
|
-
(0,
|
|
358085
|
+
(0, import_react116.useEffect)(() => {
|
|
358310
358086
|
if (config.getApprovalMode() === "yolo" /* YOLO */ && streamingState === "idle" /* Idle */) {
|
|
358311
358087
|
const lastUserMessageIndex = history.findLastIndex(
|
|
358312
358088
|
(item) => item.type === "user" /* USER */
|
|
@@ -358320,7 +358096,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358320
358096
|
}
|
|
358321
358097
|
}
|
|
358322
358098
|
}, [streamingState, config, history]);
|
|
358323
|
-
const cancelOngoingRequest = (0,
|
|
358099
|
+
const cancelOngoingRequest = (0, import_react116.useCallback)(() => {
|
|
358324
358100
|
if (streamingState !== "responding" /* Responding */) {
|
|
358325
358101
|
return;
|
|
358326
358102
|
}
|
|
@@ -358369,7 +358145,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358369
358145
|
},
|
|
358370
358146
|
{ isActive: streamingState === "responding" /* Responding */ }
|
|
358371
358147
|
);
|
|
358372
|
-
const prepareQueryForGemini = (0,
|
|
358148
|
+
const prepareQueryForGemini = (0, import_react116.useCallback)(
|
|
358373
358149
|
async (query, userMessageTimestamp, abortSignal, prompt_id) => {
|
|
358374
358150
|
if (turnCancelledRef.current) {
|
|
358375
358151
|
return { queryToSend: null, shouldProceed: false };
|
|
@@ -358464,7 +358240,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358464
358240
|
scheduleToolCalls
|
|
358465
358241
|
]
|
|
358466
358242
|
);
|
|
358467
|
-
const handleContentEvent = (0,
|
|
358243
|
+
const handleContentEvent = (0, import_react116.useCallback)(
|
|
358468
358244
|
(eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
|
|
358469
358245
|
if (turnCancelledRef.current) {
|
|
358470
358246
|
return "";
|
|
@@ -358500,7 +358276,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358500
358276
|
},
|
|
358501
358277
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem]
|
|
358502
358278
|
);
|
|
358503
|
-
const handleUserCancelledEvent = (0,
|
|
358279
|
+
const handleUserCancelledEvent = (0, import_react116.useCallback)(
|
|
358504
358280
|
(userMessageTimestamp) => {
|
|
358505
358281
|
if (turnCancelledRef.current) {
|
|
358506
358282
|
return;
|
|
@@ -358529,7 +358305,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358529
358305
|
},
|
|
358530
358306
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought]
|
|
358531
358307
|
);
|
|
358532
|
-
const handleErrorEvent = (0,
|
|
358308
|
+
const handleErrorEvent = (0, import_react116.useCallback)(
|
|
358533
358309
|
(eventValue, userMessageTimestamp) => {
|
|
358534
358310
|
if (pendingHistoryItemRef.current) {
|
|
358535
358311
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -358552,7 +358328,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358552
358328
|
},
|
|
358553
358329
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought]
|
|
358554
358330
|
);
|
|
358555
|
-
const handleCitationEvent = (0,
|
|
358331
|
+
const handleCitationEvent = (0, import_react116.useCallback)(
|
|
358556
358332
|
(text, userMessageTimestamp) => {
|
|
358557
358333
|
if (!showCitations(settings)) {
|
|
358558
358334
|
return;
|
|
@@ -358565,7 +358341,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358565
358341
|
},
|
|
358566
358342
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, settings]
|
|
358567
358343
|
);
|
|
358568
|
-
const handleFinishedEvent = (0,
|
|
358344
|
+
const handleFinishedEvent = (0, import_react116.useCallback)(
|
|
358569
358345
|
(event, userMessageTimestamp) => {
|
|
358570
358346
|
const finishReason = event.value.reason;
|
|
358571
358347
|
if (!finishReason) {
|
|
@@ -358599,7 +358375,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358599
358375
|
},
|
|
358600
358376
|
[addItem]
|
|
358601
358377
|
);
|
|
358602
|
-
const handleChatCompressionEvent = (0,
|
|
358378
|
+
const handleChatCompressionEvent = (0, import_react116.useCallback)(
|
|
358603
358379
|
(eventValue, userMessageTimestamp) => {
|
|
358604
358380
|
if (pendingHistoryItemRef.current) {
|
|
358605
358381
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -358615,7 +358391,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358615
358391
|
},
|
|
358616
358392
|
[addItem, config, pendingHistoryItemRef, setPendingHistoryItem]
|
|
358617
358393
|
);
|
|
358618
|
-
const handleMaxSessionTurnsEvent = (0,
|
|
358394
|
+
const handleMaxSessionTurnsEvent = (0, import_react116.useCallback)(
|
|
358619
358395
|
() => addItem(
|
|
358620
358396
|
{
|
|
358621
358397
|
type: "info",
|
|
@@ -358625,7 +358401,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358625
358401
|
),
|
|
358626
358402
|
[addItem, config]
|
|
358627
358403
|
);
|
|
358628
|
-
const handleSessionTokenLimitExceededEvent = (0,
|
|
358404
|
+
const handleSessionTokenLimitExceededEvent = (0, import_react116.useCallback)(
|
|
358629
358405
|
(value) => addItem(
|
|
358630
358406
|
{
|
|
358631
358407
|
type: "error",
|
|
@@ -358640,7 +358416,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358640
358416
|
),
|
|
358641
358417
|
[addItem]
|
|
358642
358418
|
);
|
|
358643
|
-
const handleLoopDetectionConfirmation = (0,
|
|
358419
|
+
const handleLoopDetectionConfirmation = (0, import_react116.useCallback)(
|
|
358644
358420
|
(result) => {
|
|
358645
358421
|
setLoopDetectionConfirmationRequest(null);
|
|
358646
358422
|
if (result.userSelection === "disable") {
|
|
@@ -358664,12 +358440,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358664
358440
|
},
|
|
358665
358441
|
[config, addItem]
|
|
358666
358442
|
);
|
|
358667
|
-
const handleLoopDetectedEvent = (0,
|
|
358443
|
+
const handleLoopDetectedEvent = (0, import_react116.useCallback)(() => {
|
|
358668
358444
|
setLoopDetectionConfirmationRequest({
|
|
358669
358445
|
onComplete: handleLoopDetectionConfirmation
|
|
358670
358446
|
});
|
|
358671
358447
|
}, [handleLoopDetectionConfirmation]);
|
|
358672
|
-
const processGeminiStreamEvents = (0,
|
|
358448
|
+
const processGeminiStreamEvents = (0, import_react116.useCallback)(
|
|
358673
358449
|
async (stream2, userMessageTimestamp, signal) => {
|
|
358674
358450
|
let geminiMessageBuffer = "";
|
|
358675
358451
|
const toolCallRequests = [];
|
|
@@ -358743,7 +358519,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358743
358519
|
handleCitationEvent
|
|
358744
358520
|
]
|
|
358745
358521
|
);
|
|
358746
|
-
const submitQuery = (0,
|
|
358522
|
+
const submitQuery = (0, import_react116.useCallback)(
|
|
358747
358523
|
async (query, options2, prompt_id) => {
|
|
358748
358524
|
if (isSubmittingQueryRef.current && !options2?.isContinuation) {
|
|
358749
358525
|
return;
|
|
@@ -358876,7 +358652,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358876
358652
|
restoreOriginalModel
|
|
358877
358653
|
]
|
|
358878
358654
|
);
|
|
358879
|
-
const handleApprovalModeChange = (0,
|
|
358655
|
+
const handleApprovalModeChange = (0, import_react116.useCallback)(
|
|
358880
358656
|
async (newApprovalMode) => {
|
|
358881
358657
|
if (newApprovalMode === "yolo" /* YOLO */ || newApprovalMode === "auto-edit" /* AUTO_EDIT */) {
|
|
358882
358658
|
let awaitingApprovalCalls = toolCalls.filter(
|
|
@@ -358905,7 +358681,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358905
358681
|
},
|
|
358906
358682
|
[toolCalls]
|
|
358907
358683
|
);
|
|
358908
|
-
const handleCompletedTools = (0,
|
|
358684
|
+
const handleCompletedTools = (0, import_react116.useCallback)(
|
|
358909
358685
|
async (completedToolCallsFromScheduler) => {
|
|
358910
358686
|
if (isResponding) {
|
|
358911
358687
|
return;
|
|
@@ -358990,13 +358766,13 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
358990
358766
|
modelSwitchedFromQuotaError
|
|
358991
358767
|
]
|
|
358992
358768
|
);
|
|
358993
|
-
const pendingHistoryItems = (0,
|
|
358769
|
+
const pendingHistoryItems = (0, import_react116.useMemo)(
|
|
358994
358770
|
() => [pendingHistoryItem, pendingToolCallGroupDisplay].filter(
|
|
358995
358771
|
(i) => i !== void 0 && i !== null
|
|
358996
358772
|
),
|
|
358997
358773
|
[pendingHistoryItem, pendingToolCallGroupDisplay]
|
|
358998
358774
|
);
|
|
358999
|
-
(0,
|
|
358775
|
+
(0, import_react116.useEffect)(() => {
|
|
359000
358776
|
const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
|
|
359001
358777
|
if (!config.getCheckpointingEnabled()) {
|
|
359002
358778
|
return;
|
|
@@ -359115,7 +358891,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
359115
358891
|
|
|
359116
358892
|
// packages/cli/src/ui/hooks/vim.ts
|
|
359117
358893
|
init_esbuild_shims();
|
|
359118
|
-
var
|
|
358894
|
+
var import_react117 = __toESM(require_react(), 1);
|
|
359119
358895
|
var DIGIT_MULTIPLIER = 10;
|
|
359120
358896
|
var DEFAULT_COUNT = 1;
|
|
359121
358897
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -359178,22 +358954,22 @@ var vimReducer = /* @__PURE__ */ __name((state, action) => {
|
|
|
359178
358954
|
}, "vimReducer");
|
|
359179
358955
|
function useVim(buffer, onSubmit) {
|
|
359180
358956
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
359181
|
-
const [state, dispatch] = (0,
|
|
359182
|
-
(0,
|
|
358957
|
+
const [state, dispatch] = (0, import_react117.useReducer)(vimReducer, initialVimState);
|
|
358958
|
+
(0, import_react117.useEffect)(() => {
|
|
359183
358959
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
359184
358960
|
}, [vimMode]);
|
|
359185
|
-
const updateMode = (0,
|
|
358961
|
+
const updateMode = (0, import_react117.useCallback)(
|
|
359186
358962
|
(mode) => {
|
|
359187
358963
|
setVimMode(mode);
|
|
359188
358964
|
dispatch({ type: "SET_MODE", mode });
|
|
359189
358965
|
},
|
|
359190
358966
|
[setVimMode]
|
|
359191
358967
|
);
|
|
359192
|
-
const getCurrentCount = (0,
|
|
358968
|
+
const getCurrentCount = (0, import_react117.useCallback)(
|
|
359193
358969
|
() => state.count || DEFAULT_COUNT,
|
|
359194
358970
|
[state.count]
|
|
359195
358971
|
);
|
|
359196
|
-
const executeCommand = (0,
|
|
358972
|
+
const executeCommand = (0, import_react117.useCallback)(
|
|
359197
358973
|
(cmdType, count) => {
|
|
359198
358974
|
switch (cmdType) {
|
|
359199
358975
|
case CMD_TYPES.DELETE_WORD_FORWARD: {
|
|
@@ -359269,7 +359045,7 @@ function useVim(buffer, onSubmit) {
|
|
|
359269
359045
|
},
|
|
359270
359046
|
[buffer, updateMode]
|
|
359271
359047
|
);
|
|
359272
|
-
const handleInsertModeInput = (0,
|
|
359048
|
+
const handleInsertModeInput = (0, import_react117.useCallback)(
|
|
359273
359049
|
(normalizedKey) => {
|
|
359274
359050
|
if (normalizedKey.name === "escape") {
|
|
359275
359051
|
buffer.vimEscapeInsertMode();
|
|
@@ -359300,7 +359076,7 @@ function useVim(buffer, onSubmit) {
|
|
|
359300
359076
|
},
|
|
359301
359077
|
[buffer, dispatch, updateMode, onSubmit]
|
|
359302
359078
|
);
|
|
359303
|
-
const normalizeKey = (0,
|
|
359079
|
+
const normalizeKey = (0, import_react117.useCallback)(
|
|
359304
359080
|
(key) => ({
|
|
359305
359081
|
name: key.name || "",
|
|
359306
359082
|
sequence: key.sequence || "",
|
|
@@ -359311,7 +359087,7 @@ function useVim(buffer, onSubmit) {
|
|
|
359311
359087
|
}),
|
|
359312
359088
|
[]
|
|
359313
359089
|
);
|
|
359314
|
-
const handleChangeMovement = (0,
|
|
359090
|
+
const handleChangeMovement = (0, import_react117.useCallback)(
|
|
359315
359091
|
(movement) => {
|
|
359316
359092
|
const count = getCurrentCount();
|
|
359317
359093
|
dispatch({ type: "CLEAR_COUNT" });
|
|
@@ -359332,7 +359108,7 @@ function useVim(buffer, onSubmit) {
|
|
|
359332
359108
|
},
|
|
359333
359109
|
[getCurrentCount, dispatch, buffer, updateMode]
|
|
359334
359110
|
);
|
|
359335
|
-
const handleOperatorMotion = (0,
|
|
359111
|
+
const handleOperatorMotion = (0, import_react117.useCallback)(
|
|
359336
359112
|
(operator2, motion) => {
|
|
359337
359113
|
const count = getCurrentCount();
|
|
359338
359114
|
const commandMap = {
|
|
@@ -359359,7 +359135,7 @@ function useVim(buffer, onSubmit) {
|
|
|
359359
359135
|
},
|
|
359360
359136
|
[getCurrentCount, executeCommand, dispatch]
|
|
359361
359137
|
);
|
|
359362
|
-
const handleInput = (0,
|
|
359138
|
+
const handleInput = (0, import_react117.useCallback)(
|
|
359363
359139
|
(key) => {
|
|
359364
359140
|
if (!vimEnabled) {
|
|
359365
359141
|
return false;
|
|
@@ -359727,14 +359503,14 @@ __name(initializeApp, "initializeApp");
|
|
|
359727
359503
|
|
|
359728
359504
|
// packages/cli/src/ui/hooks/useBracketedPaste.ts
|
|
359729
359505
|
init_esbuild_shims();
|
|
359730
|
-
var
|
|
359506
|
+
var import_react118 = __toESM(require_react(), 1);
|
|
359731
359507
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
359732
359508
|
var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
359733
359509
|
var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
359734
359510
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
359735
359511
|
process.stdout.write(DISABLE_BRACKETED_PASTE);
|
|
359736
359512
|
}, "cleanup");
|
|
359737
|
-
(0,
|
|
359513
|
+
(0, import_react118.useEffect)(() => {
|
|
359738
359514
|
process.stdout.write(ENABLE_BRACKETED_PASTE);
|
|
359739
359515
|
process.on("exit", cleanup);
|
|
359740
359516
|
process.on("SIGINT", cleanup);
|
|
@@ -359753,13 +359529,13 @@ init_esbuild_shims();
|
|
|
359753
359529
|
|
|
359754
359530
|
// packages/cli/src/ui/hooks/useTimer.ts
|
|
359755
359531
|
init_esbuild_shims();
|
|
359756
|
-
var
|
|
359532
|
+
var import_react119 = __toESM(require_react(), 1);
|
|
359757
359533
|
var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
359758
|
-
const [elapsedTime, setElapsedTime] = (0,
|
|
359759
|
-
const timerRef = (0,
|
|
359760
|
-
const prevResetKeyRef = (0,
|
|
359761
|
-
const prevIsActiveRef = (0,
|
|
359762
|
-
(0,
|
|
359534
|
+
const [elapsedTime, setElapsedTime] = (0, import_react119.useState)(0);
|
|
359535
|
+
const timerRef = (0, import_react119.useRef)(null);
|
|
359536
|
+
const prevResetKeyRef = (0, import_react119.useRef)(resetKey);
|
|
359537
|
+
const prevIsActiveRef = (0, import_react119.useRef)(isActive);
|
|
359538
|
+
(0, import_react119.useEffect)(() => {
|
|
359763
359539
|
let shouldResetTime = false;
|
|
359764
359540
|
if (prevResetKeyRef.current !== resetKey) {
|
|
359765
359541
|
shouldResetTime = true;
|
|
@@ -359797,7 +359573,7 @@ var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
|
359797
359573
|
|
|
359798
359574
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
359799
359575
|
init_esbuild_shims();
|
|
359800
|
-
var
|
|
359576
|
+
var import_react120 = __toESM(require_react(), 1);
|
|
359801
359577
|
var WITTY_LOADING_PHRASES = [
|
|
359802
359578
|
"\u51AC\u74DC\u3001\u9EC4\u74DC\u3001\u897F\u74DC\u3001\u5357\u74DC\u90FD\u80FD\u5403\uFF0C\u4EC0\u4E48\u74DC\u4E0D\u80FD\u5403\uFF1F",
|
|
359803
359579
|
"\u76C6\u91CC\u67096\u53EA\u9992\u5934\uFF0C6\u4E2A\u5C0F\u670B\u53CB\u6BCF\u4EBA\u5206\u52301\u53EA\uFF0C\u4F46\u76C6\u91CC\u8FD8\u7559\u77401\u53EA\uFF0C\u4E3A\u4EC0\u4E48\uFF1F",
|
|
@@ -359902,11 +359678,11 @@ var WITTY_LOADING_PHRASES = [
|
|
|
359902
359678
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
359903
359679
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
359904
359680
|
const loadingPhrases = customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES;
|
|
359905
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
359681
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react120.useState)(
|
|
359906
359682
|
loadingPhrases[0]
|
|
359907
359683
|
);
|
|
359908
|
-
const phraseIntervalRef = (0,
|
|
359909
|
-
(0,
|
|
359684
|
+
const phraseIntervalRef = (0, import_react120.useRef)(null);
|
|
359685
|
+
(0, import_react120.useEffect)(() => {
|
|
359910
359686
|
if (isWaiting) {
|
|
359911
359687
|
setCurrentLoadingPhrase("Waiting for user confirmation...");
|
|
359912
359688
|
if (phraseIntervalRef.current) {
|
|
@@ -359943,9 +359719,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
359943
359719
|
}, "usePhraseCycler");
|
|
359944
359720
|
|
|
359945
359721
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
359946
|
-
var
|
|
359722
|
+
var import_react121 = __toESM(require_react(), 1);
|
|
359947
359723
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases) => {
|
|
359948
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
359724
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react121.useState)(0);
|
|
359949
359725
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
359950
359726
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
359951
359727
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -359955,9 +359731,9 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
359955
359731
|
isWaiting,
|
|
359956
359732
|
customWittyPhrases
|
|
359957
359733
|
);
|
|
359958
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
359959
|
-
const prevStreamingStateRef = (0,
|
|
359960
|
-
(0,
|
|
359734
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react121.useState)(0);
|
|
359735
|
+
const prevStreamingStateRef = (0, import_react121.useRef)(null);
|
|
359736
|
+
(0, import_react121.useEffect)(() => {
|
|
359961
359737
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
359962
359738
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
359963
359739
|
setRetainedElapsedTime(0);
|
|
@@ -359977,21 +359753,21 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
359977
359753
|
|
|
359978
359754
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
359979
359755
|
init_esbuild_shims();
|
|
359980
|
-
var
|
|
359756
|
+
var import_react122 = __toESM(require_react(), 1);
|
|
359981
359757
|
init_trustedFolders();
|
|
359982
359758
|
import * as process38 from "node:process";
|
|
359983
359759
|
var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
359984
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
359985
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
359986
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
359760
|
+
const [isTrusted, setIsTrusted] = (0, import_react122.useState)(void 0);
|
|
359761
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react122.useState)(false);
|
|
359762
|
+
const [isRestarting, setIsRestarting] = (0, import_react122.useState)(false);
|
|
359987
359763
|
const folderTrust = settings.merged.security?.folderTrust?.enabled;
|
|
359988
|
-
(0,
|
|
359764
|
+
(0, import_react122.useEffect)(() => {
|
|
359989
359765
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
|
|
359990
359766
|
setIsTrusted(trusted);
|
|
359991
359767
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
359992
359768
|
onTrustChange(trusted);
|
|
359993
359769
|
}, [folderTrust, onTrustChange, settings.merged]);
|
|
359994
|
-
const handleFolderTrustSelect = (0,
|
|
359770
|
+
const handleFolderTrustSelect = (0, import_react122.useCallback)(
|
|
359995
359771
|
(choice2) => {
|
|
359996
359772
|
const trustedFolders = loadTrustedFolders();
|
|
359997
359773
|
const cwd7 = process38.cwd();
|
|
@@ -360041,7 +359817,7 @@ init_esbuild_shims();
|
|
|
360041
359817
|
// node_modules/update-notifier/update-notifier.js
|
|
360042
359818
|
init_esbuild_shims();
|
|
360043
359819
|
import process47 from "node:process";
|
|
360044
|
-
import { spawn as
|
|
359820
|
+
import { spawn as spawn7 } from "node:child_process";
|
|
360045
359821
|
import { fileURLToPath as fileURLToPath16 } from "node:url";
|
|
360046
359822
|
import path108 from "node:path";
|
|
360047
359823
|
import { format as format3 } from "node:util";
|
|
@@ -362755,7 +362531,7 @@ var UpdateNotifier = class {
|
|
|
362755
362531
|
if (Date.now() - this.config.get("lastUpdateCheck") < this.#updateCheckInterval) {
|
|
362756
362532
|
return;
|
|
362757
362533
|
}
|
|
362758
|
-
|
|
362534
|
+
spawn7(process47.execPath, [path108.join(__dirname12, "check.js"), JSON.stringify(this.#options)], {
|
|
362759
362535
|
detached: true,
|
|
362760
362536
|
stdio: "ignore"
|
|
362761
362537
|
}).unref();
|
|
@@ -363007,8 +362783,8 @@ var updateEventEmitter = new EventEmitter10();
|
|
|
363007
362783
|
|
|
363008
362784
|
// packages/cli/src/utils/spawnWrapper.ts
|
|
363009
362785
|
init_esbuild_shims();
|
|
363010
|
-
import { spawn as
|
|
363011
|
-
var spawnWrapper =
|
|
362786
|
+
import { spawn as spawn8 } from "node:child_process";
|
|
362787
|
+
var spawnWrapper = spawn8;
|
|
363012
362788
|
|
|
363013
362789
|
// packages/cli/src/utils/handleAutoUpdate.ts
|
|
363014
362790
|
function handleAutoUpdate(info, settings, projectRoot, spawnFn = spawnWrapper) {
|
|
@@ -363176,27 +362952,27 @@ var ConsolePatcher = class {
|
|
|
363176
362952
|
|
|
363177
362953
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
363178
362954
|
init_esbuild_shims();
|
|
363179
|
-
var
|
|
362955
|
+
var import_react123 = __toESM(require_react(), 1);
|
|
363180
362956
|
function useMessageQueue({
|
|
363181
362957
|
isConfigInitialized,
|
|
363182
362958
|
streamingState,
|
|
363183
362959
|
submitQuery
|
|
363184
362960
|
}) {
|
|
363185
|
-
const [messageQueue, setMessageQueue] = (0,
|
|
363186
|
-
const addMessage = (0,
|
|
362961
|
+
const [messageQueue, setMessageQueue] = (0, import_react123.useState)([]);
|
|
362962
|
+
const addMessage = (0, import_react123.useCallback)((message) => {
|
|
363187
362963
|
const trimmedMessage = message.trim();
|
|
363188
362964
|
if (trimmedMessage.length > 0) {
|
|
363189
362965
|
setMessageQueue((prev) => [...prev, trimmedMessage]);
|
|
363190
362966
|
}
|
|
363191
362967
|
}, []);
|
|
363192
|
-
const clearQueue = (0,
|
|
362968
|
+
const clearQueue = (0, import_react123.useCallback)(() => {
|
|
363193
362969
|
setMessageQueue([]);
|
|
363194
362970
|
}, []);
|
|
363195
|
-
const getQueuedMessagesText = (0,
|
|
362971
|
+
const getQueuedMessagesText = (0, import_react123.useCallback)(() => {
|
|
363196
362972
|
if (messageQueue.length === 0) return "";
|
|
363197
362973
|
return messageQueue.join("\n\n");
|
|
363198
362974
|
}, [messageQueue]);
|
|
363199
|
-
(0,
|
|
362975
|
+
(0, import_react123.useEffect)(() => {
|
|
363200
362976
|
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
363201
362977
|
const combinedMessage = messageQueue.join("\n\n");
|
|
363202
362978
|
setMessageQueue([]);
|
|
@@ -363215,15 +362991,15 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
363215
362991
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
363216
362992
|
init_esbuild_shims();
|
|
363217
362993
|
init_core2();
|
|
363218
|
-
var
|
|
362994
|
+
var import_react124 = __toESM(require_react(), 1);
|
|
363219
362995
|
function useAutoAcceptIndicator({
|
|
363220
362996
|
config,
|
|
363221
362997
|
addItem,
|
|
363222
362998
|
onApprovalModeChange
|
|
363223
362999
|
}) {
|
|
363224
363000
|
const currentConfigValue = config.getApprovalMode();
|
|
363225
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
363226
|
-
(0,
|
|
363001
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react124.useState)(currentConfigValue);
|
|
363002
|
+
(0, import_react124.useEffect)(() => {
|
|
363227
363003
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
363228
363004
|
}, [currentConfigValue]);
|
|
363229
363005
|
useKeypress(
|
|
@@ -363256,16 +363032,16 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
363256
363032
|
|
|
363257
363033
|
// packages/cli/src/ui/hooks/useWorkspaceMigration.ts
|
|
363258
363034
|
init_esbuild_shims();
|
|
363259
|
-
var
|
|
363035
|
+
var import_react125 = __toESM(require_react(), 1);
|
|
363260
363036
|
init_extension();
|
|
363261
363037
|
init_settings();
|
|
363262
363038
|
import process48 from "node:process";
|
|
363263
363039
|
function useWorkspaceMigration(settings) {
|
|
363264
|
-
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0,
|
|
363265
|
-
const [workspaceExtensions, setWorkspaceExtensions] = (0,
|
|
363040
|
+
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0, import_react125.useState)(false);
|
|
363041
|
+
const [workspaceExtensions, setWorkspaceExtensions] = (0, import_react125.useState)(
|
|
363266
363042
|
[]
|
|
363267
363043
|
);
|
|
363268
|
-
(0,
|
|
363044
|
+
(0, import_react125.useEffect)(() => {
|
|
363269
363045
|
if (!(settings.merged.experimental?.extensionManagement ?? true)) {
|
|
363270
363046
|
return;
|
|
363271
363047
|
}
|
|
@@ -363307,16 +363083,19 @@ __name(useWorkspaceMigration, "useWorkspaceMigration");
|
|
|
363307
363083
|
|
|
363308
363084
|
// packages/cli/src/ui/hooks/useGitBranchName.ts
|
|
363309
363085
|
init_esbuild_shims();
|
|
363310
|
-
var
|
|
363086
|
+
var import_react126 = __toESM(require_react(), 1);
|
|
363311
363087
|
init_core2();
|
|
363312
363088
|
import fs96 from "node:fs";
|
|
363313
363089
|
import fsPromises7 from "node:fs/promises";
|
|
363314
363090
|
import path110 from "node:path";
|
|
363315
363091
|
function useGitBranchName(cwd7) {
|
|
363316
|
-
const [branchName, setBranchName] = (0,
|
|
363317
|
-
const fetchBranchName = (0,
|
|
363092
|
+
const [branchName, setBranchName] = (0, import_react126.useState)(void 0);
|
|
363093
|
+
const fetchBranchName = (0, import_react126.useCallback)(async () => {
|
|
363318
363094
|
try {
|
|
363319
|
-
|
|
363095
|
+
if (!isCommandAvailable("git").available) {
|
|
363096
|
+
return;
|
|
363097
|
+
}
|
|
363098
|
+
const { stdout } = await execCommand(
|
|
363320
363099
|
"git",
|
|
363321
363100
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
363322
363101
|
{ cwd: cwd7 }
|
|
@@ -363325,7 +363104,7 @@ function useGitBranchName(cwd7) {
|
|
|
363325
363104
|
if (branch && branch !== "HEAD") {
|
|
363326
363105
|
setBranchName(branch);
|
|
363327
363106
|
} else {
|
|
363328
|
-
const { stdout: hashStdout } = await
|
|
363107
|
+
const { stdout: hashStdout } = await execCommand(
|
|
363329
363108
|
"git",
|
|
363330
363109
|
["rev-parse", "--short", "HEAD"],
|
|
363331
363110
|
{ cwd: cwd7 }
|
|
@@ -363336,7 +363115,7 @@ function useGitBranchName(cwd7) {
|
|
|
363336
363115
|
setBranchName(void 0);
|
|
363337
363116
|
}
|
|
363338
363117
|
}, [cwd7, setBranchName]);
|
|
363339
|
-
(0,
|
|
363118
|
+
(0, import_react126.useEffect)(() => {
|
|
363340
363119
|
fetchBranchName();
|
|
363341
363120
|
const gitLogsHeadPath = path110.join(cwd7, ".git", "logs", "HEAD");
|
|
363342
363121
|
let watcher;
|
|
@@ -363364,7 +363143,7 @@ __name(useGitBranchName, "useGitBranchName");
|
|
|
363364
363143
|
init_esbuild_shims();
|
|
363365
363144
|
init_errors4();
|
|
363366
363145
|
init_extensions();
|
|
363367
|
-
var
|
|
363146
|
+
var import_react127 = __toESM(require_react(), 1);
|
|
363368
363147
|
init_extension();
|
|
363369
363148
|
init_checks();
|
|
363370
363149
|
function confirmationRequestsReducer(state, action) {
|
|
@@ -363380,15 +363159,15 @@ function confirmationRequestsReducer(state, action) {
|
|
|
363380
363159
|
}
|
|
363381
363160
|
__name(confirmationRequestsReducer, "confirmationRequestsReducer");
|
|
363382
363161
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) => {
|
|
363383
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
363162
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react127.useReducer)(
|
|
363384
363163
|
extensionUpdatesReducer,
|
|
363385
363164
|
initialExtensionUpdatesState
|
|
363386
363165
|
);
|
|
363387
363166
|
const [
|
|
363388
363167
|
confirmUpdateExtensionRequests,
|
|
363389
363168
|
dispatchConfirmUpdateExtensionRequests
|
|
363390
|
-
] = (0,
|
|
363391
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
363169
|
+
] = (0, import_react127.useReducer)(confirmationRequestsReducer, []);
|
|
363170
|
+
const addConfirmUpdateExtensionRequest = (0, import_react127.useCallback)(
|
|
363392
363171
|
(original) => {
|
|
363393
363172
|
const wrappedRequest = {
|
|
363394
363173
|
prompt: original.prompt,
|
|
@@ -363407,7 +363186,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
363407
363186
|
},
|
|
363408
363187
|
[dispatchConfirmUpdateExtensionRequests]
|
|
363409
363188
|
);
|
|
363410
|
-
(0,
|
|
363189
|
+
(0, import_react127.useEffect)(() => {
|
|
363411
363190
|
(async () => {
|
|
363412
363191
|
await checkForAllExtensionUpdates(
|
|
363413
363192
|
extensions,
|
|
@@ -363415,7 +363194,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
363415
363194
|
);
|
|
363416
363195
|
})();
|
|
363417
363196
|
}, [extensions, extensions.length, dispatchExtensionStateUpdate]);
|
|
363418
|
-
(0,
|
|
363197
|
+
(0, import_react127.useEffect)(() => {
|
|
363419
363198
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
363420
363199
|
return;
|
|
363421
363200
|
}
|
|
@@ -363480,7 +363259,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
363480
363259
|
addItem,
|
|
363481
363260
|
cwd7
|
|
363482
363261
|
]);
|
|
363483
|
-
const extensionsUpdateStateComputed = (0,
|
|
363262
|
+
const extensionsUpdateStateComputed = (0, import_react127.useMemo)(() => {
|
|
363484
363263
|
const result = /* @__PURE__ */ new Map();
|
|
363485
363264
|
for (const [
|
|
363486
363265
|
key,
|
|
@@ -363501,13 +363280,13 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
363501
363280
|
|
|
363502
363281
|
// packages/cli/src/ui/hooks/useQuitConfirmation.ts
|
|
363503
363282
|
init_esbuild_shims();
|
|
363504
|
-
var
|
|
363283
|
+
var import_react128 = __toESM(require_react(), 1);
|
|
363505
363284
|
var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
363506
|
-
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0,
|
|
363507
|
-
const showQuitConfirmation = (0,
|
|
363285
|
+
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0, import_react128.useState)(false);
|
|
363286
|
+
const showQuitConfirmation = (0, import_react128.useCallback)(() => {
|
|
363508
363287
|
setIsQuitConfirmationOpen(true);
|
|
363509
363288
|
}, []);
|
|
363510
|
-
const handleQuitConfirmationSelect = (0,
|
|
363289
|
+
const handleQuitConfirmationSelect = (0, import_react128.useCallback)((choice2) => {
|
|
363511
363290
|
setIsQuitConfirmationOpen(false);
|
|
363512
363291
|
if (choice2 === "cancel" /* CANCEL */) {
|
|
363513
363292
|
return { shouldQuit: false, action: "cancel" };
|
|
@@ -363529,16 +363308,16 @@ var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
|
363529
363308
|
|
|
363530
363309
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
363531
363310
|
init_esbuild_shims();
|
|
363532
|
-
var
|
|
363311
|
+
var import_react129 = __toESM(require_react(), 1);
|
|
363533
363312
|
init_core2();
|
|
363534
363313
|
init_settingsSchema();
|
|
363535
363314
|
function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
363536
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
363537
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
363538
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
363539
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
363540
|
-
const [inputFillText, setInputFillText] = (0,
|
|
363541
|
-
const checkWelcomeBack = (0,
|
|
363315
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react129.useState)(null);
|
|
363316
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react129.useState)(false);
|
|
363317
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react129.useState)(null);
|
|
363318
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react129.useState)(false);
|
|
363319
|
+
const [inputFillText, setInputFillText] = (0, import_react129.useState)(null);
|
|
363320
|
+
const checkWelcomeBack = (0, import_react129.useCallback)(async () => {
|
|
363542
363321
|
if (settings.ui?.enableWelcomeBack === false) {
|
|
363543
363322
|
return;
|
|
363544
363323
|
}
|
|
@@ -363552,7 +363331,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
363552
363331
|
console.debug("Welcome back check failed:", error);
|
|
363553
363332
|
}
|
|
363554
363333
|
}, [settings.ui?.enableWelcomeBack]);
|
|
363555
|
-
const handleWelcomeBackSelection = (0,
|
|
363334
|
+
const handleWelcomeBackSelection = (0, import_react129.useCallback)(
|
|
363556
363335
|
(choice2) => {
|
|
363557
363336
|
setWelcomeBackChoice(choice2);
|
|
363558
363337
|
setShowWelcomeBackDialog(false);
|
|
@@ -363564,21 +363343,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
363564
363343
|
},
|
|
363565
363344
|
[welcomeBackInfo]
|
|
363566
363345
|
);
|
|
363567
|
-
const handleWelcomeBackClose = (0,
|
|
363346
|
+
const handleWelcomeBackClose = (0, import_react129.useCallback)(() => {
|
|
363568
363347
|
setWelcomeBackChoice("restart");
|
|
363569
363348
|
setShowWelcomeBackDialog(false);
|
|
363570
363349
|
}, []);
|
|
363571
|
-
const clearInputFill = (0,
|
|
363350
|
+
const clearInputFill = (0, import_react129.useCallback)(() => {
|
|
363572
363351
|
setShouldFillInput(false);
|
|
363573
363352
|
setInputFillText(null);
|
|
363574
363353
|
}, []);
|
|
363575
|
-
(0,
|
|
363354
|
+
(0, import_react129.useEffect)(() => {
|
|
363576
363355
|
if (shouldFillInput && inputFillText) {
|
|
363577
363356
|
buffer.setText(inputFillText);
|
|
363578
363357
|
clearInputFill();
|
|
363579
363358
|
}
|
|
363580
363359
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
363581
|
-
(0,
|
|
363360
|
+
(0, import_react129.useEffect)(() => {
|
|
363582
363361
|
checkWelcomeBack();
|
|
363583
363362
|
}, [checkWelcomeBack]);
|
|
363584
363363
|
return {
|
|
@@ -363599,10 +363378,10 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
363599
363378
|
|
|
363600
363379
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
363601
363380
|
init_esbuild_shims();
|
|
363602
|
-
var
|
|
363381
|
+
var import_react130 = __toESM(require_react(), 1);
|
|
363603
363382
|
init_settings();
|
|
363604
363383
|
function useDialogClose(options2) {
|
|
363605
|
-
const closeAnyOpenDialog = (0,
|
|
363384
|
+
const closeAnyOpenDialog = (0, import_react130.useCallback)(() => {
|
|
363606
363385
|
if (options2.isThemeDialogOpen) {
|
|
363607
363386
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
363608
363387
|
return true;
|
|
@@ -363634,13 +363413,13 @@ __name(useDialogClose, "useDialogClose");
|
|
|
363634
363413
|
|
|
363635
363414
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
363636
363415
|
init_esbuild_shims();
|
|
363637
|
-
var
|
|
363416
|
+
var import_react131 = __toESM(require_react(), 1);
|
|
363638
363417
|
function useSubagentCreateDialog() {
|
|
363639
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
363640
|
-
const openSubagentCreateDialog = (0,
|
|
363418
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react131.useState)(false);
|
|
363419
|
+
const openSubagentCreateDialog = (0, import_react131.useCallback)(() => {
|
|
363641
363420
|
setIsSubagentCreateDialogOpen(true);
|
|
363642
363421
|
}, []);
|
|
363643
|
-
const closeSubagentCreateDialog = (0,
|
|
363422
|
+
const closeSubagentCreateDialog = (0, import_react131.useCallback)(() => {
|
|
363644
363423
|
setIsSubagentCreateDialogOpen(false);
|
|
363645
363424
|
}, []);
|
|
363646
363425
|
return {
|
|
@@ -363653,13 +363432,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
363653
363432
|
|
|
363654
363433
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
363655
363434
|
init_esbuild_shims();
|
|
363656
|
-
var
|
|
363435
|
+
var import_react132 = __toESM(require_react(), 1);
|
|
363657
363436
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
363658
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
363659
|
-
const openAgentsManagerDialog = (0,
|
|
363437
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react132.useState)(false);
|
|
363438
|
+
const openAgentsManagerDialog = (0, import_react132.useCallback)(() => {
|
|
363660
363439
|
setIsAgentsManagerDialogOpen(true);
|
|
363661
363440
|
}, []);
|
|
363662
|
-
const closeAgentsManagerDialog = (0,
|
|
363441
|
+
const closeAgentsManagerDialog = (0, import_react132.useCallback)(() => {
|
|
363663
363442
|
setIsAgentsManagerDialogOpen(false);
|
|
363664
363443
|
}, []);
|
|
363665
363444
|
return {
|
|
@@ -363671,7 +363450,7 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
363671
363450
|
|
|
363672
363451
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
363673
363452
|
init_esbuild_shims();
|
|
363674
|
-
var
|
|
363453
|
+
var import_react133 = __toESM(require_react(), 1);
|
|
363675
363454
|
|
|
363676
363455
|
// packages/cli/src/utils/attentionNotification.ts
|
|
363677
363456
|
init_esbuild_shims();
|
|
@@ -363699,9 +363478,9 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
363699
363478
|
streamingState,
|
|
363700
363479
|
elapsedTime
|
|
363701
363480
|
}) => {
|
|
363702
|
-
const awaitingNotificationSentRef = (0,
|
|
363703
|
-
const respondingElapsedRef = (0,
|
|
363704
|
-
(0,
|
|
363481
|
+
const awaitingNotificationSentRef = (0, import_react133.useRef)(false);
|
|
363482
|
+
const respondingElapsedRef = (0, import_react133.useRef)(0);
|
|
363483
|
+
(0, import_react133.useEffect)(() => {
|
|
363705
363484
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
363706
363485
|
notifyTerminalAttention("tool_approval" /* ToolApproval */);
|
|
363707
363486
|
awaitingNotificationSentRef.current = true;
|
|
@@ -363710,7 +363489,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
363710
363489
|
awaitingNotificationSentRef.current = false;
|
|
363711
363490
|
}
|
|
363712
363491
|
}, [isFocused, streamingState]);
|
|
363713
|
-
(0,
|
|
363492
|
+
(0, import_react133.useEffect)(() => {
|
|
363714
363493
|
if (streamingState === "responding" /* Responding */) {
|
|
363715
363494
|
respondingElapsedRef.current = elapsedTime;
|
|
363716
363495
|
return;
|
|
@@ -363728,7 +363507,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
363728
363507
|
|
|
363729
363508
|
// packages/cli/src/ui/hooks/useWebSocket.ts
|
|
363730
363509
|
init_esbuild_shims();
|
|
363731
|
-
var
|
|
363510
|
+
var import_react134 = __toESM(require_react(), 1);
|
|
363732
363511
|
|
|
363733
363512
|
// packages/cli/src/config/websocket.ts
|
|
363734
363513
|
init_esbuild_shims();
|
|
@@ -364134,8 +363913,8 @@ function getRdmindSsoId3() {
|
|
|
364134
363913
|
}
|
|
364135
363914
|
__name(getRdmindSsoId3, "getRdmindSsoId");
|
|
364136
363915
|
function useWebSocket({ onReloadCommands, debug: debug2 }) {
|
|
364137
|
-
const wsClientRef = (0,
|
|
364138
|
-
(0,
|
|
363916
|
+
const wsClientRef = (0, import_react134.useRef)(null);
|
|
363917
|
+
(0, import_react134.useEffect)(() => {
|
|
364139
363918
|
const wsRuntimeConfig = loadWebSocketRuntimeConfig(debug2);
|
|
364140
363919
|
if (!wsRuntimeConfig.enabled) {
|
|
364141
363920
|
if (debug2) {
|
|
@@ -364197,22 +363976,22 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364197
363976
|
const { settings, config, initializationResult } = props;
|
|
364198
363977
|
const historyManager = useHistory();
|
|
364199
363978
|
useMemoryMonitor(historyManager);
|
|
364200
|
-
const [corgiMode, setCorgiMode] = (0,
|
|
364201
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
364202
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
364203
|
-
const [themeError, setThemeError] = (0,
|
|
363979
|
+
const [corgiMode, setCorgiMode] = (0, import_react135.useState)(false);
|
|
363980
|
+
const [debugMessage, setDebugMessage] = (0, import_react135.useState)("");
|
|
363981
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react135.useState)(null);
|
|
363982
|
+
const [themeError, setThemeError] = (0, import_react135.useState)(
|
|
364204
363983
|
initializationResult.themeError
|
|
364205
363984
|
);
|
|
364206
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
364207
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
364208
|
-
const [geminiMdFileCount, setGeminiMdFileCount] = (0,
|
|
363985
|
+
const [isProcessing, setIsProcessing] = (0, import_react135.useState)(false);
|
|
363986
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react135.useState)(false);
|
|
363987
|
+
const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react135.useState)(
|
|
364209
363988
|
initializationResult.geminiMdFileCount
|
|
364210
363989
|
);
|
|
364211
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
364212
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
364213
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
364214
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
364215
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
363990
|
+
const [shellModeActive, setShellModeActive] = (0, import_react135.useState)(false);
|
|
363991
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react135.useState)(false);
|
|
363992
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react135.useState)(0);
|
|
363993
|
+
const [updateInfo, setUpdateInfo] = (0, import_react135.useState)(null);
|
|
363994
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react135.useState)(
|
|
364216
363995
|
config.isTrustedFolder()
|
|
364217
363996
|
);
|
|
364218
363997
|
const extensions = config.getExtensions();
|
|
@@ -364227,38 +364006,38 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364227
364006
|
historyManager.addItem,
|
|
364228
364007
|
config.getWorkingDir()
|
|
364229
364008
|
);
|
|
364230
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
364231
|
-
const openPermissionsDialog = (0,
|
|
364009
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react135.useState)(false);
|
|
364010
|
+
const openPermissionsDialog = (0, import_react135.useCallback)(
|
|
364232
364011
|
() => setPermissionsDialogOpen(true),
|
|
364233
364012
|
[]
|
|
364234
364013
|
);
|
|
364235
|
-
const closePermissionsDialog = (0,
|
|
364014
|
+
const closePermissionsDialog = (0, import_react135.useCallback)(
|
|
364236
364015
|
() => setPermissionsDialogOpen(false),
|
|
364237
364016
|
[]
|
|
364238
364017
|
);
|
|
364239
|
-
const getEffectiveModel2 = (0,
|
|
364018
|
+
const getEffectiveModel2 = (0, import_react135.useCallback)(() => {
|
|
364240
364019
|
if (config.isInFallbackMode()) {
|
|
364241
364020
|
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
364242
364021
|
}
|
|
364243
364022
|
return config.getModel();
|
|
364244
364023
|
}, [config]);
|
|
364245
|
-
const [currentModel, setCurrentModel] = (0,
|
|
364246
|
-
const [userTier] = (0,
|
|
364247
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
364024
|
+
const [currentModel, setCurrentModel] = (0, import_react135.useState)(getEffectiveModel2());
|
|
364025
|
+
const [userTier] = (0, import_react135.useState)(void 0);
|
|
364026
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react135.useState)(false);
|
|
364248
364027
|
const logger6 = useLogger(config.storage);
|
|
364249
|
-
const [userMessages, setUserMessages] = (0,
|
|
364028
|
+
const [userMessages, setUserMessages] = (0, import_react135.useState)([]);
|
|
364250
364029
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
364251
364030
|
const { stdin, setRawMode } = use_stdin_default();
|
|
364252
364031
|
const { stdout } = use_stdout_default();
|
|
364253
364032
|
const { stats: sessionStats } = useSessionStats();
|
|
364254
364033
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
364255
|
-
const mainControlsRef = (0,
|
|
364256
|
-
const originalTitleRef = (0,
|
|
364034
|
+
const mainControlsRef = (0, import_react135.useRef)(null);
|
|
364035
|
+
const originalTitleRef = (0, import_react135.useRef)(
|
|
364257
364036
|
computeWindowTitle(basename15(config.getTargetDir()))
|
|
364258
364037
|
);
|
|
364259
|
-
const lastTitleRef = (0,
|
|
364038
|
+
const lastTitleRef = (0, import_react135.useRef)(null);
|
|
364260
364039
|
const staticExtraHeight = 3;
|
|
364261
|
-
(0,
|
|
364040
|
+
(0, import_react135.useEffect)(() => {
|
|
364262
364041
|
(async () => {
|
|
364263
364042
|
await config.initialize();
|
|
364264
364043
|
setConfigInitialized(true);
|
|
@@ -364268,11 +364047,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364268
364047
|
await ideClient.disconnect();
|
|
364269
364048
|
});
|
|
364270
364049
|
}, [config]);
|
|
364271
|
-
(0,
|
|
364050
|
+
(0, import_react135.useEffect)(
|
|
364272
364051
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
364273
364052
|
[historyManager.addItem]
|
|
364274
364053
|
);
|
|
364275
|
-
(0,
|
|
364054
|
+
(0, import_react135.useEffect)(() => {
|
|
364276
364055
|
const checkModelChange = /* @__PURE__ */ __name(() => {
|
|
364277
364056
|
const effectiveModel = getEffectiveModel2();
|
|
364278
364057
|
if (effectiveModel !== currentModel) {
|
|
@@ -364288,7 +364067,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364288
364067
|
handleNewMessage,
|
|
364289
364068
|
clearConsoleMessages: clearConsoleMessagesState
|
|
364290
364069
|
} = useConsoleMessages();
|
|
364291
|
-
(0,
|
|
364070
|
+
(0, import_react135.useEffect)(() => {
|
|
364292
364071
|
const consolePatcher = new ConsolePatcher({
|
|
364293
364072
|
onNewMessage: handleNewMessage,
|
|
364294
364073
|
debugMode: config.getDebugMode()
|
|
@@ -364296,13 +364075,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364296
364075
|
consolePatcher.patch();
|
|
364297
364076
|
registerCleanup(consolePatcher.cleanup);
|
|
364298
364077
|
}, [handleNewMessage, config]);
|
|
364299
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
364078
|
+
const { inputWidth, suggestionsWidth } = (0, import_react135.useMemo)(() => {
|
|
364300
364079
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
364301
364080
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
364302
364081
|
}, [terminalWidth]);
|
|
364303
364082
|
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
|
|
364304
364083
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
364305
|
-
const isValidPath = (0,
|
|
364084
|
+
const isValidPath = (0, import_react135.useCallback)((filePath) => {
|
|
364306
364085
|
try {
|
|
364307
364086
|
return fs98.existsSync(filePath) && fs98.statSync(filePath).isFile();
|
|
364308
364087
|
} catch (_e) {
|
|
@@ -364317,7 +364096,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364317
364096
|
isValidPath,
|
|
364318
364097
|
shellModeActive
|
|
364319
364098
|
});
|
|
364320
|
-
(0,
|
|
364099
|
+
(0, import_react135.useEffect)(() => {
|
|
364321
364100
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
364322
364101
|
const pastMessagesRaw = await logger6?.getPreviousUserMessages() || [];
|
|
364323
364102
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -364340,7 +364119,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364340
364119
|
}, "fetchUserMessages");
|
|
364341
364120
|
fetchUserMessages();
|
|
364342
364121
|
}, [historyManager.history, logger6]);
|
|
364343
|
-
const refreshStatic = (0,
|
|
364122
|
+
const refreshStatic = (0, import_react135.useCallback)(() => {
|
|
364344
364123
|
stdout.write(base_exports.clearTerminal);
|
|
364345
364124
|
setHistoryRemountKey((prev) => prev + 1);
|
|
364346
364125
|
}, [setHistoryRemountKey, stdout]);
|
|
@@ -364371,8 +364150,8 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364371
364150
|
handleAuthSelect,
|
|
364372
364151
|
openAuthDialog,
|
|
364373
364152
|
cancelAuthentication
|
|
364374
|
-
} = useAuthCommand(settings, config);
|
|
364375
|
-
(0,
|
|
364153
|
+
} = useAuthCommand(settings, config, historyManager.addItem);
|
|
364154
|
+
(0, import_react135.useEffect)(() => {
|
|
364376
364155
|
if (!shouldTriggerAutoSSOAuth(settings)) {
|
|
364377
364156
|
return;
|
|
364378
364157
|
}
|
|
@@ -364547,17 +364326,17 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364547
364326
|
setAuthState,
|
|
364548
364327
|
setModelSwitchedFromQuotaError
|
|
364549
364328
|
});
|
|
364550
|
-
const handleQwenAuthTimeout = (0,
|
|
364329
|
+
const handleQwenAuthTimeout = (0, import_react135.useCallback)(() => {
|
|
364551
364330
|
onAuthError("Qwen OAuth authentication timed out. Please try again.");
|
|
364552
364331
|
cancelAuthentication();
|
|
364553
364332
|
setAuthState("updating" /* Updating */);
|
|
364554
364333
|
}, [onAuthError, cancelAuthentication, setAuthState]);
|
|
364555
|
-
const handleQwenAuthCancel = (0,
|
|
364334
|
+
const handleQwenAuthCancel = (0, import_react135.useCallback)(() => {
|
|
364556
364335
|
onAuthError("Qwen OAuth authentication cancelled.");
|
|
364557
364336
|
cancelAuthentication();
|
|
364558
364337
|
setAuthState("updating" /* Updating */);
|
|
364559
364338
|
}, [onAuthError, cancelAuthentication, setAuthState]);
|
|
364560
|
-
(0,
|
|
364339
|
+
(0, import_react135.useEffect)(() => {
|
|
364561
364340
|
if (settings.merged.security?.auth?.enforcedType && settings.merged.security?.auth.selectedType && settings.merged.security?.auth.enforcedType !== settings.merged.security?.auth.selectedType) {
|
|
364562
364341
|
onAuthError(
|
|
364563
364342
|
`Authentication is enforced to be ${settings.merged.security?.auth.enforcedType}, but you are currently using ${settings.merged.security?.auth.selectedType}.`
|
|
@@ -364576,7 +364355,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364576
364355
|
settings.merged.security?.auth?.useExternal,
|
|
364577
364356
|
onAuthError
|
|
364578
364357
|
]);
|
|
364579
|
-
const [editorError, setEditorError] = (0,
|
|
364358
|
+
const [editorError, setEditorError] = (0, import_react135.useState)(null);
|
|
364580
364359
|
const {
|
|
364581
364360
|
isEditorDialogOpen,
|
|
364582
364361
|
openEditorDialog,
|
|
@@ -364603,9 +364382,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364603
364382
|
openAgentsManagerDialog,
|
|
364604
364383
|
closeAgentsManagerDialog
|
|
364605
364384
|
} = useAgentsManagerDialog();
|
|
364606
|
-
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0,
|
|
364607
|
-
const [visionSwitchResolver, setVisionSwitchResolver] = (0,
|
|
364608
|
-
const slashCommandActions = (0,
|
|
364385
|
+
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0, import_react135.useState)(false);
|
|
364386
|
+
const [visionSwitchResolver, setVisionSwitchResolver] = (0, import_react135.useState)(null);
|
|
364387
|
+
const slashCommandActions = (0, import_react135.useMemo)(
|
|
364609
364388
|
() => ({
|
|
364610
364389
|
openAuthDialog,
|
|
364611
364390
|
openThemeDialog,
|
|
@@ -364673,14 +364452,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364673
364452
|
onReloadCommands: reloadCommands,
|
|
364674
364453
|
debug: config.getDebugMode()
|
|
364675
364454
|
});
|
|
364676
|
-
const handleVisionSwitchRequired = (0,
|
|
364455
|
+
const handleVisionSwitchRequired = (0, import_react135.useCallback)(
|
|
364677
364456
|
async (_query) => new Promise((resolve26, reject) => {
|
|
364678
364457
|
setVisionSwitchResolver({ resolve: resolve26, reject });
|
|
364679
364458
|
setIsVisionSwitchDialogOpen(true);
|
|
364680
364459
|
}),
|
|
364681
364460
|
[]
|
|
364682
364461
|
);
|
|
364683
|
-
const handleVisionSwitchSelect = (0,
|
|
364462
|
+
const handleVisionSwitchSelect = (0, import_react135.useCallback)(
|
|
364684
364463
|
(outcome) => {
|
|
364685
364464
|
setIsVisionSwitchDialogOpen(false);
|
|
364686
364465
|
if (visionSwitchResolver) {
|
|
@@ -364691,10 +364470,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364691
364470
|
},
|
|
364692
364471
|
[visionSwitchResolver]
|
|
364693
364472
|
);
|
|
364694
|
-
const onDebugMessage = (0,
|
|
364473
|
+
const onDebugMessage = (0, import_react135.useCallback)((message) => {
|
|
364695
364474
|
console.debug(message);
|
|
364696
364475
|
}, []);
|
|
364697
|
-
const performMemoryRefresh = (0,
|
|
364476
|
+
const performMemoryRefresh = (0, import_react135.useCallback)(async () => {
|
|
364698
364477
|
historyManager.addItem(
|
|
364699
364478
|
{
|
|
364700
364479
|
type: "info" /* INFO */,
|
|
@@ -364745,7 +364524,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364745
364524
|
console.error("Error refreshing memory:", error);
|
|
364746
364525
|
}
|
|
364747
364526
|
}, [config, historyManager, settings.merged]);
|
|
364748
|
-
const cancelHandlerRef = (0,
|
|
364527
|
+
const cancelHandlerRef = (0, import_react135.useRef)(() => {
|
|
364749
364528
|
});
|
|
364750
364529
|
const {
|
|
364751
364530
|
streamingState,
|
|
@@ -364792,7 +364571,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364792
364571
|
streamingState,
|
|
364793
364572
|
submitQuery
|
|
364794
364573
|
});
|
|
364795
|
-
const handleFinalSubmit = (0,
|
|
364574
|
+
const handleFinalSubmit = (0, import_react135.useCallback)(
|
|
364796
364575
|
(submittedValue) => {
|
|
364797
364576
|
addMessage(submittedValue);
|
|
364798
364577
|
},
|
|
@@ -364805,7 +364584,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
364805
364584
|
handleWelcomeBackSelection,
|
|
364806
364585
|
handleWelcomeBackClose
|
|
364807
364586
|
} = useWelcomeBack(config, handleFinalSubmit, buffer, settings.merged);
|
|
364808
|
-
cancelHandlerRef.current = (0,
|
|
364587
|
+
cancelHandlerRef.current = (0, import_react135.useCallback)(() => {
|
|
364809
364588
|
const pendingHistoryItems2 = [
|
|
364810
364589
|
...pendingSlashCommandHistoryItems,
|
|
364811
364590
|
...pendingGeminiHistoryItems
|
|
@@ -364834,7 +364613,7 @@ ${queuedText}` : queuedText;
|
|
|
364834
364613
|
pendingSlashCommandHistoryItems,
|
|
364835
364614
|
pendingGeminiHistoryItems
|
|
364836
364615
|
]);
|
|
364837
|
-
const handleClearScreen = (0,
|
|
364616
|
+
const handleClearScreen = (0, import_react135.useCallback)(() => {
|
|
364838
364617
|
historyManager.clearItems();
|
|
364839
364618
|
clearConsoleMessagesState();
|
|
364840
364619
|
console.clear();
|
|
@@ -364842,8 +364621,8 @@ ${queuedText}` : queuedText;
|
|
|
364842
364621
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
364843
364622
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
364844
364623
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */) && !proQuotaRequest;
|
|
364845
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
364846
|
-
(0,
|
|
364624
|
+
const [controlsHeight, setControlsHeight] = (0, import_react135.useState)(0);
|
|
364625
|
+
(0, import_react135.useLayoutEffect)(() => {
|
|
364847
364626
|
if (mainControlsRef.current) {
|
|
364848
364627
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
364849
364628
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -364866,14 +364645,14 @@ ${queuedText}` : queuedText;
|
|
|
364866
364645
|
});
|
|
364867
364646
|
const isFocused = useFocus();
|
|
364868
364647
|
useBracketedPaste();
|
|
364869
|
-
const contextFileNames = (0,
|
|
364648
|
+
const contextFileNames = (0, import_react135.useMemo)(() => {
|
|
364870
364649
|
const fromSettings = settings.merged.context?.fileName;
|
|
364871
364650
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
|
|
364872
364651
|
}, [settings.merged.context?.fileName]);
|
|
364873
|
-
const initialPrompt = (0,
|
|
364874
|
-
const initialPromptSubmitted = (0,
|
|
364652
|
+
const initialPrompt = (0, import_react135.useMemo)(() => config.getQuestion(), [config]);
|
|
364653
|
+
const initialPromptSubmitted = (0, import_react135.useRef)(false);
|
|
364875
364654
|
const geminiClient = config.getGeminiClient();
|
|
364876
|
-
(0,
|
|
364655
|
+
(0, import_react135.useEffect)(() => {
|
|
364877
364656
|
if (activePtyId) {
|
|
364878
364657
|
ShellExecutionService.resizePty(
|
|
364879
364658
|
activePtyId,
|
|
@@ -364882,7 +364661,7 @@ ${queuedText}` : queuedText;
|
|
|
364882
364661
|
);
|
|
364883
364662
|
}
|
|
364884
364663
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
364885
|
-
(0,
|
|
364664
|
+
(0, import_react135.useEffect)(() => {
|
|
364886
364665
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && !isVisionSwitchDialogOpen && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
|
|
364887
364666
|
handleFinalSubmit(initialPrompt);
|
|
364888
364667
|
initialPromptSubmitted.current = true;
|
|
@@ -364900,9 +364679,9 @@ ${queuedText}` : queuedText;
|
|
|
364900
364679
|
welcomeBackChoice,
|
|
364901
364680
|
geminiClient
|
|
364902
364681
|
]);
|
|
364903
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0,
|
|
364904
|
-
const [currentIDE, setCurrentIDE] = (0,
|
|
364905
|
-
(0,
|
|
364682
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react135.useState)(false);
|
|
364683
|
+
const [currentIDE, setCurrentIDE] = (0, import_react135.useState)(null);
|
|
364684
|
+
(0, import_react135.useEffect)(() => {
|
|
364906
364685
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
364907
364686
|
const ideClient = await IdeClient.getInstance();
|
|
364908
364687
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -364913,28 +364692,28 @@ ${queuedText}` : queuedText;
|
|
|
364913
364692
|
const shouldShowIdePrompt = Boolean(
|
|
364914
364693
|
currentIDE && !config.getIdeMode() && !settings.merged.ide?.hasSeenNudge && !idePromptAnswered
|
|
364915
364694
|
);
|
|
364916
|
-
const [showErrorDetails, setShowErrorDetails] = (0,
|
|
364917
|
-
const [showToolDescriptions, setShowToolDescriptions] = (0,
|
|
364918
|
-
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0,
|
|
364919
|
-
const ctrlCTimerRef = (0,
|
|
364920
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0,
|
|
364921
|
-
const ctrlDTimerRef = (0,
|
|
364922
|
-
const [constrainHeight, setConstrainHeight] = (0,
|
|
364923
|
-
const [ideContextState, setIdeContextState] = (0,
|
|
364924
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
364925
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0,
|
|
364695
|
+
const [showErrorDetails, setShowErrorDetails] = (0, import_react135.useState)(false);
|
|
364696
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react135.useState)(false);
|
|
364697
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react135.useState)(false);
|
|
364698
|
+
const ctrlCTimerRef = (0, import_react135.useRef)(null);
|
|
364699
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react135.useState)(false);
|
|
364700
|
+
const ctrlDTimerRef = (0, import_react135.useRef)(null);
|
|
364701
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react135.useState)(true);
|
|
364702
|
+
const [ideContextState, setIdeContextState] = (0, import_react135.useState)();
|
|
364703
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react135.useState)(false);
|
|
364704
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react135.useState)(false);
|
|
364926
364705
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
|
|
364927
364706
|
const {
|
|
364928
364707
|
needsRestart: ideNeedsRestart,
|
|
364929
364708
|
restartReason: ideTrustRestartReason
|
|
364930
364709
|
} = useIdeTrustListener();
|
|
364931
|
-
const isInitialMount = (0,
|
|
364932
|
-
(0,
|
|
364710
|
+
const isInitialMount = (0, import_react135.useRef)(true);
|
|
364711
|
+
(0, import_react135.useEffect)(() => {
|
|
364933
364712
|
if (ideNeedsRestart) {
|
|
364934
364713
|
setShowIdeRestartPrompt(true);
|
|
364935
364714
|
}
|
|
364936
364715
|
}, [ideNeedsRestart]);
|
|
364937
|
-
(0,
|
|
364716
|
+
(0, import_react135.useEffect)(() => {
|
|
364938
364717
|
if (isInitialMount.current) {
|
|
364939
364718
|
isInitialMount.current = false;
|
|
364940
364719
|
return;
|
|
@@ -364946,12 +364725,12 @@ ${queuedText}` : queuedText;
|
|
|
364946
364725
|
clearTimeout(handler);
|
|
364947
364726
|
};
|
|
364948
364727
|
}, [terminalWidth, refreshStatic]);
|
|
364949
|
-
(0,
|
|
364728
|
+
(0, import_react135.useEffect)(() => {
|
|
364950
364729
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
364951
364730
|
setIdeContextState(ideContextStore.get());
|
|
364952
364731
|
return unsubscribe;
|
|
364953
364732
|
}, []);
|
|
364954
|
-
(0,
|
|
364733
|
+
(0, import_react135.useEffect)(() => {
|
|
364955
364734
|
const openDebugConsole = /* @__PURE__ */ __name(() => {
|
|
364956
364735
|
setShowErrorDetails(true);
|
|
364957
364736
|
setConstrainHeight(false);
|
|
@@ -364970,10 +364749,10 @@ ${queuedText}` : queuedText;
|
|
|
364970
364749
|
appEvents.off("log-error" /* LogError */, logErrorHandler);
|
|
364971
364750
|
};
|
|
364972
364751
|
}, [handleNewMessage]);
|
|
364973
|
-
const handleEscapePromptChange = (0,
|
|
364752
|
+
const handleEscapePromptChange = (0, import_react135.useCallback)((showPrompt) => {
|
|
364974
364753
|
setShowEscapePrompt(showPrompt);
|
|
364975
364754
|
}, []);
|
|
364976
|
-
const handleIdePromptComplete = (0,
|
|
364755
|
+
const handleIdePromptComplete = (0, import_react135.useCallback)(
|
|
364977
364756
|
(result) => {
|
|
364978
364757
|
if (result.userSelection === "yes") {
|
|
364979
364758
|
handleSlashCommand2("/ide install");
|
|
@@ -365011,7 +364790,7 @@ ${queuedText}` : queuedText;
|
|
|
365011
364790
|
handleWelcomeBackClose,
|
|
365012
364791
|
quitConfirmationRequest
|
|
365013
364792
|
});
|
|
365014
|
-
const handleExit = (0,
|
|
364793
|
+
const handleExit = (0, import_react135.useCallback)(
|
|
365015
364794
|
(pressedOnce, setPressedOnce, timerRef) => {
|
|
365016
364795
|
if (pressedOnce) {
|
|
365017
364796
|
if (timerRef.current) {
|
|
@@ -365054,7 +364833,7 @@ ${queuedText}` : queuedText;
|
|
|
365054
364833
|
buffer
|
|
365055
364834
|
]
|
|
365056
364835
|
);
|
|
365057
|
-
const handleGlobalKeypress = (0,
|
|
364836
|
+
const handleGlobalKeypress = (0, import_react135.useCallback)(
|
|
365058
364837
|
(key) => {
|
|
365059
364838
|
if (settings.merged.general?.debugKeystrokeLogging) {
|
|
365060
364839
|
console.log("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
@@ -365127,7 +364906,7 @@ ${queuedText}` : queuedText;
|
|
|
365127
364906
|
]
|
|
365128
364907
|
);
|
|
365129
364908
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
365130
|
-
(0,
|
|
364909
|
+
(0, import_react135.useEffect)(() => {
|
|
365131
364910
|
if (!settings.merged.ui?.showStatusInTitle || settings.merged.ui?.hideWindowTitle)
|
|
365132
364911
|
return;
|
|
365133
364912
|
let title;
|
|
@@ -365149,23 +364928,23 @@ ${queuedText}` : queuedText;
|
|
|
365149
364928
|
settings.merged.ui?.hideWindowTitle,
|
|
365150
364929
|
stdout
|
|
365151
364930
|
]);
|
|
365152
|
-
const filteredConsoleMessages = (0,
|
|
364931
|
+
const filteredConsoleMessages = (0, import_react135.useMemo)(() => {
|
|
365153
364932
|
if (config.getDebugMode()) {
|
|
365154
364933
|
return consoleMessages;
|
|
365155
364934
|
}
|
|
365156
364935
|
return consoleMessages.filter((msg) => msg.type !== "debug");
|
|
365157
364936
|
}, [consoleMessages, config]);
|
|
365158
|
-
const errorCount = (0,
|
|
364937
|
+
const errorCount = (0, import_react135.useMemo)(
|
|
365159
364938
|
() => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
|
|
365160
364939
|
[filteredConsoleMessages]
|
|
365161
364940
|
);
|
|
365162
364941
|
const nightly = props.version.includes("nightly");
|
|
365163
364942
|
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest || !!quitConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isVisionSwitchDialogOpen || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating && isQwenAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || !!proQuotaRequest || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isApprovalModeDialogOpen;
|
|
365164
|
-
const pendingHistoryItems = (0,
|
|
364943
|
+
const pendingHistoryItems = (0, import_react135.useMemo)(
|
|
365165
364944
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
365166
364945
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
365167
364946
|
);
|
|
365168
|
-
const uiState = (0,
|
|
364947
|
+
const uiState = (0, import_react135.useMemo)(
|
|
365169
364948
|
() => ({
|
|
365170
364949
|
history: historyManager.history,
|
|
365171
364950
|
historyManager,
|
|
@@ -365364,7 +365143,7 @@ ${queuedText}` : queuedText;
|
|
|
365364
365143
|
isAgentsManagerDialogOpen
|
|
365365
365144
|
]
|
|
365366
365145
|
);
|
|
365367
|
-
const uiActions = (0,
|
|
365146
|
+
const uiActions = (0, import_react135.useMemo)(
|
|
365368
365147
|
() => ({
|
|
365369
365148
|
handleThemeSelect,
|
|
365370
365149
|
handleThemeHighlight,
|
|
@@ -365527,7 +365306,7 @@ init_esbuild_shims();
|
|
|
365527
365306
|
var import_shell_quote5 = __toESM(require_shell_quote(), 1);
|
|
365528
365307
|
init_settings();
|
|
365529
365308
|
init_core2();
|
|
365530
|
-
import { exec as exec4, execSync as execSync7, spawn as
|
|
365309
|
+
import { exec as exec4, execSync as execSync7, spawn as spawn9 } from "node:child_process";
|
|
365531
365310
|
import os44 from "node:os";
|
|
365532
365311
|
import path112 from "node:path";
|
|
365533
365312
|
import fs99 from "node:fs";
|
|
@@ -365735,7 +365514,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
365735
365514
|
sandboxEnv["NO_PROXY"] = noProxy;
|
|
365736
365515
|
sandboxEnv["no_proxy"] = noProxy;
|
|
365737
365516
|
}
|
|
365738
|
-
proxyProcess2 =
|
|
365517
|
+
proxyProcess2 = spawn9(proxyCommand2, {
|
|
365739
365518
|
stdio: ["ignore", "pipe", "pipe"],
|
|
365740
365519
|
shell: true,
|
|
365741
365520
|
detached: true
|
|
@@ -365766,7 +365545,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
365766
365545
|
);
|
|
365767
365546
|
}
|
|
365768
365547
|
process.stdin.pause();
|
|
365769
|
-
sandboxProcess2 =
|
|
365548
|
+
sandboxProcess2 = spawn9(config.command, args2, {
|
|
365770
365549
|
stdio: "inherit"
|
|
365771
365550
|
});
|
|
365772
365551
|
return new Promise((resolve26, reject) => {
|
|
@@ -366085,7 +365864,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
366085
365864
|
let sandboxProcess = void 0;
|
|
366086
365865
|
if (proxyCommand) {
|
|
366087
365866
|
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}`;
|
|
366088
|
-
proxyProcess =
|
|
365867
|
+
proxyProcess = spawn9(proxyContainerCommand, {
|
|
366089
365868
|
stdio: ["ignore", "pipe", "pipe"],
|
|
366090
365869
|
shell: true,
|
|
366091
365870
|
detached: true
|
|
@@ -366117,7 +365896,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
366117
365896
|
);
|
|
366118
365897
|
}
|
|
366119
365898
|
process.stdin.pause();
|
|
366120
|
-
sandboxProcess =
|
|
365899
|
+
sandboxProcess = spawn9(config.command, args, {
|
|
366121
365900
|
stdio: "inherit"
|
|
366122
365901
|
});
|
|
366123
365902
|
return new Promise((resolve26, reject) => {
|
|
@@ -366143,7 +365922,7 @@ __name(start_sandbox, "start_sandbox");
|
|
|
366143
365922
|
async function imageExists(sandbox, image2) {
|
|
366144
365923
|
return new Promise((resolve26) => {
|
|
366145
365924
|
const args = ["images", "-q", image2];
|
|
366146
|
-
const checkProcess =
|
|
365925
|
+
const checkProcess = spawn9(sandbox, args);
|
|
366147
365926
|
let stdoutData = "";
|
|
366148
365927
|
if (checkProcess.stdout) {
|
|
366149
365928
|
checkProcess.stdout.on("data", (data) => {
|
|
@@ -366168,7 +365947,7 @@ async function pullImage(sandbox, image2) {
|
|
|
366168
365947
|
console.info(`Attempting to pull image ${image2} using ${sandbox}...`);
|
|
366169
365948
|
return new Promise((resolve26) => {
|
|
366170
365949
|
const args = ["pull", image2];
|
|
366171
|
-
const pullProcess =
|
|
365950
|
+
const pullProcess = spawn9(sandbox, args, { stdio: "pipe" });
|
|
366172
365951
|
let stderrData = "";
|
|
366173
365952
|
const onStdoutData = /* @__PURE__ */ __name((data) => {
|
|
366174
365953
|
console.info(data.toString().trim());
|
|
@@ -366326,11 +366105,15 @@ var ripgrepAvailabilityCheck = {
|
|
|
366326
366105
|
if (!options2.useRipgrep) {
|
|
366327
366106
|
return null;
|
|
366328
366107
|
}
|
|
366329
|
-
|
|
366330
|
-
|
|
366331
|
-
|
|
366108
|
+
try {
|
|
366109
|
+
const isAvailable = await canUseRipgrep(options2.useBuiltinRipgrep);
|
|
366110
|
+
if (!isAvailable) {
|
|
366111
|
+
return "Ripgrep not available: Please install ripgrep globally to enable faster file content search. Falling back to built-in grep.";
|
|
366112
|
+
}
|
|
366113
|
+
return null;
|
|
366114
|
+
} catch (error) {
|
|
366115
|
+
return `Ripgrep not available: ${error instanceof Error ? error.message : "Unknown error"}. Falling back to built-in grep.`;
|
|
366332
366116
|
}
|
|
366333
|
-
return null;
|
|
366334
366117
|
}, "check")
|
|
366335
366118
|
};
|
|
366336
366119
|
var l4RepositoryCheck = {
|
|
@@ -366630,9 +366413,9 @@ init_core2();
|
|
|
366630
366413
|
|
|
366631
366414
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
366632
366415
|
init_esbuild_shims();
|
|
366633
|
-
var
|
|
366416
|
+
var import_react136 = __toESM(require_react(), 1);
|
|
366634
366417
|
function useKittyKeyboardProtocol() {
|
|
366635
|
-
const [status] = (0,
|
|
366418
|
+
const [status] = (0, import_react136.useState)({
|
|
366636
366419
|
supported: isKittyProtocolSupported(),
|
|
366637
366420
|
enabled: isKittyProtocolEnabled(),
|
|
366638
366421
|
checking: false
|
|
@@ -366643,7 +366426,7 @@ __name(useKittyKeyboardProtocol, "useKittyKeyboardProtocol");
|
|
|
366643
366426
|
|
|
366644
366427
|
// packages/cli/src/utils/relaunch.ts
|
|
366645
366428
|
init_esbuild_shims();
|
|
366646
|
-
import { spawn as
|
|
366429
|
+
import { spawn as spawn10 } from "node:child_process";
|
|
366647
366430
|
async function relaunchOnExitCode(runner) {
|
|
366648
366431
|
while (true) {
|
|
366649
366432
|
try {
|
|
@@ -366675,7 +366458,7 @@ async function relaunchAppInChildProcess(additionalNodeArgs, additionalScriptArg
|
|
|
366675
366458
|
];
|
|
366676
366459
|
const newEnv = { ...process.env, GEMINI_CLI_NO_RELAUNCH: "true" };
|
|
366677
366460
|
process.stdin.pause();
|
|
366678
|
-
const child =
|
|
366461
|
+
const child = spawn10(process.execPath, nodeArgs, {
|
|
366679
366462
|
stdio: "inherit",
|
|
366680
366463
|
env: newEnv
|
|
366681
366464
|
});
|
|
@@ -368493,7 +368276,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
368493
368276
|
) });
|
|
368494
368277
|
}, "AppWrapper");
|
|
368495
368278
|
const instance = render_default(
|
|
368496
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
368279
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_react137.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(AppWrapper, {}),
|
|
368497
368280
|
{
|
|
368498
368281
|
exitOnCtrlC: false,
|
|
368499
368282
|
isScreenReaderEnabled: config.getScreenReader()
|