deepcode-ai 1.2.8 → 1.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +723 -511
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1652,7 +1652,7 @@ var require_cli_spinners = __commonJS({
|
|
|
1652
1652
|
|
|
1653
1653
|
// ../../packages/cli/dist/index.js
|
|
1654
1654
|
import { render as render3 } from "ink";
|
|
1655
|
-
import
|
|
1655
|
+
import React40 from "react";
|
|
1656
1656
|
import { Command as Command2 } from "commander";
|
|
1657
1657
|
|
|
1658
1658
|
// ../../packages/core/dist/index.js
|
|
@@ -8298,14 +8298,17 @@ import { useState as useState22, useEffect as useEffect22, useCallback as useCal
|
|
|
8298
8298
|
import { Box as Box2, Text as Text22, useInput as useInput2, useApp as useApp2 } from "ink";
|
|
8299
8299
|
import path42 from "path";
|
|
8300
8300
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
8301
|
+
import fs2 from "fs";
|
|
8302
|
+
import os4 from "os";
|
|
8303
|
+
import path62 from "path";
|
|
8301
8304
|
import fs8 from "fs";
|
|
8302
8305
|
import path15 from "path";
|
|
8303
|
-
import { isValidElement, useCallback as
|
|
8306
|
+
import { isValidElement, useCallback as useCallback27, useEffect as useEffect28, useMemo as useMemo19, useRef as useRef18, useState as useState30 } from "react";
|
|
8304
8307
|
import { Box as Box42, Text as Text50, useInput as useInput6, useStdin as useStdin3 } from "ink";
|
|
8305
|
-
import
|
|
8306
|
-
import
|
|
8307
|
-
import
|
|
8308
|
-
import
|
|
8308
|
+
import os22 from "os";
|
|
8309
|
+
import path92 from "path";
|
|
8310
|
+
import fs22 from "fs";
|
|
8311
|
+
import path72 from "path";
|
|
8309
8312
|
|
|
8310
8313
|
// ../../node_modules/.pnpm/fzf@0.5.2/node_modules/fzf/dist/fzf.es.js
|
|
8311
8314
|
var normalized = {
|
|
@@ -9270,9 +9273,10 @@ var AsyncFzf = class {
|
|
|
9270
9273
|
import { execFile as execFile3 } from "child_process";
|
|
9271
9274
|
import * as nodeFs from "fs";
|
|
9272
9275
|
import { access as access2, lstat as lstat4, open, readFile as readFile4, stat as stat22 } from "fs/promises";
|
|
9273
|
-
import * as
|
|
9276
|
+
import * as path82 from "path";
|
|
9274
9277
|
import { promisify } from "util";
|
|
9275
9278
|
import { useState as useState3, useRef, useCallback as useCallback3, useMemo as useMemo2 } from "react";
|
|
9279
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useMemo as useMemo6, useRef as useRef6, useState as useState12 } from "react";
|
|
9276
9280
|
import { Box as Box24, Static } from "ink";
|
|
9277
9281
|
import { Box as Box22, Text as Text25 } from "ink";
|
|
9278
9282
|
import { Box as Box8, Text as Text9 } from "ink";
|
|
@@ -9438,9 +9442,9 @@ function stringWidth(string, options = {}) {
|
|
|
9438
9442
|
// ../../packages/cli/dist/index.js
|
|
9439
9443
|
import React11 from "react";
|
|
9440
9444
|
import { Text as Text8, Box as Box7 } from "ink";
|
|
9441
|
-
import * as
|
|
9442
|
-
import * as
|
|
9443
|
-
import * as
|
|
9445
|
+
import * as fs3 from "fs";
|
|
9446
|
+
import * as path102 from "path";
|
|
9447
|
+
import * as os32 from "os";
|
|
9444
9448
|
import process3 from "process";
|
|
9445
9449
|
import { execSync } from "child_process";
|
|
9446
9450
|
import process2 from "process";
|
|
@@ -10156,8 +10160,8 @@ import {
|
|
|
10156
10160
|
} from "react";
|
|
10157
10161
|
import readline from "readline";
|
|
10158
10162
|
import { PassThrough } from "stream";
|
|
10159
|
-
import * as
|
|
10160
|
-
import * as
|
|
10163
|
+
import * as fs4 from "fs/promises";
|
|
10164
|
+
import * as path112 from "path";
|
|
10161
10165
|
import { useStdin, useStdout } from "ink";
|
|
10162
10166
|
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
10163
10167
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
@@ -10168,8 +10172,8 @@ import { Box as Box14, Text as Text16 } from "ink";
|
|
|
10168
10172
|
import { Box as Box13, Text as Text15 } from "ink";
|
|
10169
10173
|
import chalk from "chalk";
|
|
10170
10174
|
import { spawnSync } from "child_process";
|
|
10171
|
-
import
|
|
10172
|
-
import
|
|
10175
|
+
import fs5 from "fs";
|
|
10176
|
+
import os42 from "os";
|
|
10173
10177
|
import pathMod from "path";
|
|
10174
10178
|
import { useState as useState7, useCallback as useCallback6, useEffect as useEffect9, useMemo as useMemo4, useReducer as useReducer2 } from "react";
|
|
10175
10179
|
import { useCallback as useCallback7, useRef as useRef4, useEffect as useEffect10 } from "react";
|
|
@@ -10220,38 +10224,38 @@ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
|
10220
10224
|
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10221
10225
|
import { Box as Box23, Text as Text26 } from "ink";
|
|
10222
10226
|
import { jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10227
|
+
import { createContext as createContext5, useContext as useContext6 } from "react";
|
|
10223
10228
|
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
10224
10229
|
import { Box as Box32, Text as Text40, useIsScreenReaderEnabled as useIsScreenReaderEnabled3 } from "ink";
|
|
10225
|
-
import { useCallback as
|
|
10226
|
-
import { useRef as
|
|
10230
|
+
import { useCallback as useCallback19, useState as useState24 } from "react";
|
|
10231
|
+
import { useRef as useRef8 } from "react";
|
|
10227
10232
|
import { Box as Box25, Text as Text27 } from "ink";
|
|
10228
|
-
import { useEffect as
|
|
10229
|
-
import { useEffect as
|
|
10233
|
+
import { useEffect as useEffect15, useState as useState13 } from "react";
|
|
10234
|
+
import { useEffect as useEffect16, useRef as useRef7, useState as useState14 } from "react";
|
|
10230
10235
|
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10231
|
-
import { useCallback as
|
|
10236
|
+
import { useCallback as useCallback17, useEffect as useEffect23, useMemo as useMemo11, useState as useState21, useRef as useRef13 } from "react";
|
|
10232
10237
|
import { Box as Box28, Text as Text31 } from "ink";
|
|
10233
10238
|
import { Box as Box26, Text as Text29 } from "ink";
|
|
10234
|
-
import
|
|
10239
|
+
import React25 from "react";
|
|
10235
10240
|
import { Text as Text28 } from "ink";
|
|
10236
10241
|
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
10237
10242
|
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
10238
|
-
import { useState as
|
|
10243
|
+
import { useState as useState15, useCallback as useCallback9 } from "react";
|
|
10239
10244
|
import chalk3 from "chalk";
|
|
10240
|
-
import { useState as
|
|
10241
|
-
import * as
|
|
10242
|
-
import * as path112 from "path";
|
|
10243
|
-
import { useState as useState17, useEffect as useEffect17, useMemo as useMemo6, useCallback as useCallback11, useRef as useRef8 } from "react";
|
|
10244
|
-
import { useState as useState16, useCallback as useCallback10 } from "react";
|
|
10245
|
-
import { useCallback as useCallback12, useMemo as useMemo8, useEffect as useEffect20 } from "react";
|
|
10246
|
-
import { useEffect as useEffect18, useReducer as useReducer3, useRef as useRef9 } from "react";
|
|
10247
|
-
import { useState as useState18, useEffect as useEffect19, useMemo as useMemo7 } from "react";
|
|
10248
|
-
import { useCallback as useCallback13, useEffect as useEffect21, useMemo as useMemo9, useRef as useRef10 } from "react";
|
|
10249
|
-
import { useState as useState19, useCallback as useCallback14, useRef as useRef11 } from "react";
|
|
10245
|
+
import { useState as useState16, useEffect as useEffect17, useCallback as useCallback10 } from "react";
|
|
10246
|
+
import * as fs6 from "fs/promises";
|
|
10250
10247
|
import * as path122 from "path";
|
|
10251
|
-
import {
|
|
10248
|
+
import { useState as useState18, useEffect as useEffect18, useMemo as useMemo7, useCallback as useCallback12, useRef as useRef9 } from "react";
|
|
10249
|
+
import { useState as useState17, useCallback as useCallback11 } from "react";
|
|
10250
|
+
import { useCallback as useCallback13, useMemo as useMemo9, useEffect as useEffect21 } from "react";
|
|
10251
|
+
import { useEffect as useEffect19, useReducer as useReducer3, useRef as useRef10 } from "react";
|
|
10252
|
+
import { useState as useState19, useEffect as useEffect20, useMemo as useMemo8 } from "react";
|
|
10253
|
+
import { useCallback as useCallback14, useEffect as useEffect222, useMemo as useMemo10, useRef as useRef11 } from "react";
|
|
10254
|
+
import { useState as useState20, useCallback as useCallback15, useRef as useRef12 } from "react";
|
|
10255
|
+
import * as path132 from "path";
|
|
10252
10256
|
import { createContext as createContext6, useContext as useContext7 } from "react";
|
|
10253
10257
|
import { createContext as createContext7, useContext as useContext8 } from "react";
|
|
10254
|
-
import { useCallback as
|
|
10258
|
+
import { useCallback as useCallback16 } from "react";
|
|
10255
10259
|
import { Box as Box27, Text as Text30 } from "ink";
|
|
10256
10260
|
import chalk2 from "chalk";
|
|
10257
10261
|
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -10267,49 +10271,46 @@ import { Text as Text35 } from "ink";
|
|
|
10267
10271
|
import { jsxs as jsxs32 } from "react/jsx-runtime";
|
|
10268
10272
|
import { Text as Text36 } from "ink";
|
|
10269
10273
|
import { jsxs as jsxs33 } from "react/jsx-runtime";
|
|
10270
|
-
import { useState as
|
|
10274
|
+
import { useState as useState222, useEffect as useEffect24 } from "react";
|
|
10271
10275
|
import { execFile as execFile22 } from "child_process";
|
|
10272
|
-
import
|
|
10276
|
+
import os5 from "os";
|
|
10273
10277
|
import {
|
|
10274
10278
|
createContext as createContext8,
|
|
10275
|
-
useCallback as
|
|
10279
|
+
useCallback as useCallback18,
|
|
10276
10280
|
useContext as useContext9,
|
|
10277
|
-
useState as
|
|
10281
|
+
useState as useState23
|
|
10278
10282
|
} from "react";
|
|
10279
10283
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
10280
10284
|
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10281
|
-
import { useRef as
|
|
10285
|
+
import { useRef as useRef14 } from "react";
|
|
10282
10286
|
import { Box as Box30, Text as Text38 } from "ink";
|
|
10283
10287
|
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
10284
10288
|
import { Box as Box31, Text as Text39 } from "ink";
|
|
10285
10289
|
import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10286
10290
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10287
|
-
import fs6 from "fs";
|
|
10288
|
-
import os5 from "os";
|
|
10289
|
-
import path132 from "path";
|
|
10290
10291
|
import { Box as Box33, Text as Text41 } from "ink";
|
|
10291
10292
|
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
10292
|
-
import { useCallback as
|
|
10293
|
+
import { useCallback as useCallback20, useMemo as useMemo12, useRef as useRef15 } from "react";
|
|
10293
10294
|
import { Box as Box34, Text as Text42 } from "ink";
|
|
10294
10295
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
10295
|
-
import { useCallback as
|
|
10296
|
+
import { useCallback as useCallback21, useMemo as useMemo13, useState as useState25 } from "react";
|
|
10296
10297
|
import { Box as Box35, Text as Text43, useInput as useInput3 } from "ink";
|
|
10297
10298
|
import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
10298
|
-
import { useCallback as
|
|
10299
|
+
import { useCallback as useCallback22, useMemo as useMemo14, useState as useState26 } from "react";
|
|
10299
10300
|
import { Box as Box36, Text as Text44 } from "ink";
|
|
10300
10301
|
import { jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
10301
|
-
import { useCallback as
|
|
10302
|
+
import { useCallback as useCallback23, useEffect as useEffect25, useMemo as useMemo15, useRef as useRef16, useState as useState27 } from "react";
|
|
10302
10303
|
import { Box as Box37, Text as Text45 } from "ink";
|
|
10303
10304
|
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10304
|
-
import { useCallback as
|
|
10305
|
+
import { useCallback as useCallback24, useEffect as useEffect26, useMemo as useMemo16, useRef as useRef17, useState as useState28 } from "react";
|
|
10305
10306
|
import { Box as Box38, Text as Text46, useInput as useInput4 } from "ink";
|
|
10306
10307
|
import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10307
10308
|
import fs7 from "fs";
|
|
10308
10309
|
import path142 from "path";
|
|
10309
|
-
import { useCallback as
|
|
10310
|
+
import { useCallback as useCallback25, useMemo as useMemo17 } from "react";
|
|
10310
10311
|
import { Box as Box39, Text as Text47 } from "ink";
|
|
10311
10312
|
import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10312
|
-
import { useCallback as
|
|
10313
|
+
import { useCallback as useCallback26, useEffect as useEffect27, useMemo as useMemo18, useState as useState29 } from "react";
|
|
10313
10314
|
import { Box as Box40, Text as Text48, useInput as useInput5 } from "ink";
|
|
10314
10315
|
import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10315
10316
|
import { Box as Box41, Text as Text49 } from "ink";
|
|
@@ -11832,6 +11833,108 @@ async function sessionsClearCommand(options) {
|
|
|
11832
11833
|
process.stdout.write(`Deleted ${deleted} session${deleted !== 1 ? "s" : ""} (${label}).
|
|
11833
11834
|
`);
|
|
11834
11835
|
}
|
|
11836
|
+
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
11837
|
+
var PACKAGE_NAME = "deepcode-ai";
|
|
11838
|
+
function cachePath() {
|
|
11839
|
+
const cacheHome = process.env["XDG_CACHE_HOME"] ?? path62.join(os4.homedir(), ".cache");
|
|
11840
|
+
return path62.join(cacheHome, "deepcode-ai", "update.json");
|
|
11841
|
+
}
|
|
11842
|
+
function readCache() {
|
|
11843
|
+
try {
|
|
11844
|
+
const raw = fs2.readFileSync(cachePath(), "utf8");
|
|
11845
|
+
const parsed = JSON.parse(raw);
|
|
11846
|
+
if (typeof parsed.checkedAt !== "number" || typeof parsed.latest !== "string" || Date.now() - parsed.checkedAt >= CACHE_TTL_MS) {
|
|
11847
|
+
return null;
|
|
11848
|
+
}
|
|
11849
|
+
return {
|
|
11850
|
+
checkedAt: parsed.checkedAt,
|
|
11851
|
+
latest: parsed.latest,
|
|
11852
|
+
stable: typeof parsed.stable === "string" ? parsed.stable : null
|
|
11853
|
+
};
|
|
11854
|
+
} catch {
|
|
11855
|
+
return null;
|
|
11856
|
+
}
|
|
11857
|
+
}
|
|
11858
|
+
function writeCache(cache) {
|
|
11859
|
+
try {
|
|
11860
|
+
const filePath = cachePath();
|
|
11861
|
+
fs2.mkdirSync(path62.dirname(filePath), { recursive: true });
|
|
11862
|
+
fs2.writeFileSync(filePath, `${JSON.stringify(cache)}
|
|
11863
|
+
`, "utf8");
|
|
11864
|
+
} catch {
|
|
11865
|
+
}
|
|
11866
|
+
}
|
|
11867
|
+
async function checkForUpdate(_currentVersion, options = {}) {
|
|
11868
|
+
if (process.env["CI"] || process.env["NODE_ENV"] === "test" || process.env["DEEPCODE_DISABLE_UPDATE_CHECK"] === "1") {
|
|
11869
|
+
return null;
|
|
11870
|
+
}
|
|
11871
|
+
if (!options.force) {
|
|
11872
|
+
const cached = readCache();
|
|
11873
|
+
if (cached) {
|
|
11874
|
+
return { latest: cached.latest, stable: cached.stable };
|
|
11875
|
+
}
|
|
11876
|
+
}
|
|
11877
|
+
try {
|
|
11878
|
+
const response = await fetch(
|
|
11879
|
+
`https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`,
|
|
11880
|
+
{ signal: AbortSignal.timeout(3e3) }
|
|
11881
|
+
);
|
|
11882
|
+
if (!response.ok) return null;
|
|
11883
|
+
const tags = await response.json();
|
|
11884
|
+
const latest = tags["latest"];
|
|
11885
|
+
if (typeof latest !== "string" || latest.length === 0) return null;
|
|
11886
|
+
const stable = typeof tags["stable"] === "string" && tags["stable"].length > 0 ? tags["stable"] : null;
|
|
11887
|
+
const update = { latest, stable };
|
|
11888
|
+
writeCache({ ...update, checkedAt: Date.now() });
|
|
11889
|
+
return update;
|
|
11890
|
+
} catch {
|
|
11891
|
+
return null;
|
|
11892
|
+
}
|
|
11893
|
+
}
|
|
11894
|
+
function isNewer(current, candidate) {
|
|
11895
|
+
const currentParts = parseVersion(current);
|
|
11896
|
+
const candidateParts = parseVersion(candidate);
|
|
11897
|
+
if (!currentParts || !candidateParts) return false;
|
|
11898
|
+
for (let index = 0; index < 3; index += 1) {
|
|
11899
|
+
const currentPart = currentParts[index] ?? 0;
|
|
11900
|
+
const candidatePart = candidateParts[index] ?? 0;
|
|
11901
|
+
if (candidatePart !== currentPart) {
|
|
11902
|
+
return candidatePart > currentPart;
|
|
11903
|
+
}
|
|
11904
|
+
}
|
|
11905
|
+
return false;
|
|
11906
|
+
}
|
|
11907
|
+
function parseVersion(version) {
|
|
11908
|
+
const match = version.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/);
|
|
11909
|
+
if (!match) return null;
|
|
11910
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
11911
|
+
}
|
|
11912
|
+
var VERSION = "1.2.11".length > 0 ? "1.2.11" : "0.0.0-dev";
|
|
11913
|
+
async function updateCommand() {
|
|
11914
|
+
writeStdoutLine(`Current version: ${VERSION}`);
|
|
11915
|
+
const update = await checkForUpdate(VERSION, { force: true });
|
|
11916
|
+
if (!update) {
|
|
11917
|
+
writeStdoutLine("Could not reach the npm registry right now.");
|
|
11918
|
+
return;
|
|
11919
|
+
}
|
|
11920
|
+
const latestNewer = isNewer(VERSION, update.latest);
|
|
11921
|
+
writeStdoutLine(
|
|
11922
|
+
`Latest version: ${update.latest} (${latestNewer ? "update available" : "up to date"})`
|
|
11923
|
+
);
|
|
11924
|
+
if (update.stable) {
|
|
11925
|
+
const stableNewer = isNewer(VERSION, update.stable);
|
|
11926
|
+
writeStdoutLine(
|
|
11927
|
+
`Stable version: ${update.stable} (${stableNewer ? "update available" : "up to date"})`
|
|
11928
|
+
);
|
|
11929
|
+
} else {
|
|
11930
|
+
writeStdoutLine("Stable version: not published yet");
|
|
11931
|
+
}
|
|
11932
|
+
if (latestNewer || update.stable && isNewer(VERSION, update.stable)) {
|
|
11933
|
+
writeStdoutLine("");
|
|
11934
|
+
writeStdoutLine("Install latest: npm install -g deepcode-ai@latest");
|
|
11935
|
+
writeStdoutLine("Install stable: npm install -g deepcode-ai@stable");
|
|
11936
|
+
}
|
|
11937
|
+
}
|
|
11835
11938
|
var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
11836
11939
|
"node_modules",
|
|
11837
11940
|
".git",
|
|
@@ -11862,7 +11965,7 @@ var ProjectFileSearch = class {
|
|
|
11862
11965
|
if (depth > maxDepth || out.length >= MAX_FILES) return;
|
|
11863
11966
|
let entries;
|
|
11864
11967
|
try {
|
|
11865
|
-
entries =
|
|
11968
|
+
entries = fs22.readdirSync(dir, { withFileTypes: true });
|
|
11866
11969
|
} catch {
|
|
11867
11970
|
return;
|
|
11868
11971
|
}
|
|
@@ -11871,7 +11974,7 @@ var ProjectFileSearch = class {
|
|
|
11871
11974
|
const relPath = rel ? `${rel}/${entry.name}` : entry.name;
|
|
11872
11975
|
if (entry.isDirectory()) {
|
|
11873
11976
|
if (ignore.has(entry.name) || entry.name.startsWith(".")) continue;
|
|
11874
|
-
walk2(
|
|
11977
|
+
walk2(path72.join(dir, entry.name), relPath, depth + 1);
|
|
11875
11978
|
} else if (entry.isFile()) {
|
|
11876
11979
|
out.push(relPath);
|
|
11877
11980
|
}
|
|
@@ -12001,7 +12104,7 @@ async function fetchGitDiff(cwd) {
|
|
|
12001
12104
|
const lineStats = await mapWithConcurrency(
|
|
12002
12105
|
untrackedPaths,
|
|
12003
12106
|
MAX_FILES2,
|
|
12004
|
-
(relPath) => countUntrackedLines(
|
|
12107
|
+
(relPath) => countUntrackedLines(path82.join(gitRoot, relPath))
|
|
12005
12108
|
);
|
|
12006
12109
|
for (const lineStat of lineStats) {
|
|
12007
12110
|
stats.linesAdded += lineStat.added;
|
|
@@ -12139,7 +12242,7 @@ async function resolveGitRoot(cwd) {
|
|
|
12139
12242
|
return root ? root : null;
|
|
12140
12243
|
}
|
|
12141
12244
|
async function resolveGitDir(gitRoot) {
|
|
12142
|
-
const dotGit =
|
|
12245
|
+
const dotGit = path82.join(gitRoot, ".git");
|
|
12143
12246
|
try {
|
|
12144
12247
|
const fileStat = await stat22(dotGit);
|
|
12145
12248
|
if (fileStat.isDirectory()) return dotGit;
|
|
@@ -12148,7 +12251,7 @@ async function resolveGitDir(gitRoot) {
|
|
|
12148
12251
|
const match = content.match(/^gitdir:\s*(.+?)\s*$/m);
|
|
12149
12252
|
if (!match || !match[1]) return null;
|
|
12150
12253
|
const raw = match[1];
|
|
12151
|
-
return
|
|
12254
|
+
return path82.isAbsolute(raw) ? raw : path82.resolve(gitRoot, raw);
|
|
12152
12255
|
} catch {
|
|
12153
12256
|
return null;
|
|
12154
12257
|
}
|
|
@@ -12165,7 +12268,7 @@ async function isInTransientGitState(gitRoot) {
|
|
|
12165
12268
|
];
|
|
12166
12269
|
const checks = await Promise.all(
|
|
12167
12270
|
transientPaths.map(
|
|
12168
|
-
(entry) => access2(
|
|
12271
|
+
(entry) => access2(path82.join(gitDir, entry)).then(() => true).catch(() => false)
|
|
12169
12272
|
)
|
|
12170
12273
|
);
|
|
12171
12274
|
return checks.some(Boolean);
|
|
@@ -12273,12 +12376,12 @@ var UNESCAPE_REGEX = new RegExp(
|
|
|
12273
12376
|
"g"
|
|
12274
12377
|
);
|
|
12275
12378
|
function unescapePath(filePath) {
|
|
12276
|
-
if (
|
|
12379
|
+
if (os22.platform() === "win32") return filePath;
|
|
12277
12380
|
return filePath.replace(UNESCAPE_REGEX, "$1");
|
|
12278
12381
|
}
|
|
12279
12382
|
var SHELL_SPECIAL_CHARS_GLOBAL = /[ \t()[\]{};|*?$`'"#&<>!~]/g;
|
|
12280
12383
|
function escapePath(filePath) {
|
|
12281
|
-
if (
|
|
12384
|
+
if (os22.platform() === "win32") return filePath;
|
|
12282
12385
|
return filePath.replace(SHELL_SPECIAL_CHARS_GLOBAL, "\\$&");
|
|
12283
12386
|
}
|
|
12284
12387
|
var KittySequenceOverflowEvent = class {
|
|
@@ -12302,13 +12405,13 @@ var Storage = class {
|
|
|
12302
12405
|
projectRoot;
|
|
12303
12406
|
/** Global (per-user) temp directory, under the home directory. */
|
|
12304
12407
|
static getGlobalTempDir() {
|
|
12305
|
-
return
|
|
12408
|
+
return path92.join(os22.homedir(), ".deepcode", "tmp");
|
|
12306
12409
|
}
|
|
12307
12410
|
getProjectTempDir() {
|
|
12308
|
-
return
|
|
12411
|
+
return path92.join(this.projectRoot, ".deepcode", "tmp");
|
|
12309
12412
|
}
|
|
12310
12413
|
getHistoryFilePath() {
|
|
12311
|
-
return
|
|
12414
|
+
return path92.join(this.getProjectTempDir(), "shell_history");
|
|
12312
12415
|
}
|
|
12313
12416
|
};
|
|
12314
12417
|
var IdeClient = class {
|
|
@@ -15674,22 +15777,22 @@ var ThemeManager = class {
|
|
|
15674
15777
|
return this.findThemeByName(themeName);
|
|
15675
15778
|
}
|
|
15676
15779
|
isPath(themeName) {
|
|
15677
|
-
return themeName.endsWith(".json") || themeName.startsWith(".") ||
|
|
15780
|
+
return themeName.endsWith(".json") || themeName.startsWith(".") || path102.isAbsolute(themeName);
|
|
15678
15781
|
}
|
|
15679
15782
|
loadThemeFromFile(themePath) {
|
|
15680
15783
|
try {
|
|
15681
|
-
const canonicalPath =
|
|
15784
|
+
const canonicalPath = fs3.realpathSync(path102.resolve(themePath));
|
|
15682
15785
|
if (this.customThemes.has(canonicalPath)) {
|
|
15683
15786
|
return this.customThemes.get(canonicalPath);
|
|
15684
15787
|
}
|
|
15685
|
-
const homeDir =
|
|
15788
|
+
const homeDir = path102.resolve(os32.homedir());
|
|
15686
15789
|
if (!canonicalPath.startsWith(homeDir)) {
|
|
15687
15790
|
debugLogger3.warn(
|
|
15688
15791
|
`Theme file at "${themePath}" is outside your home directory. Only load themes from trusted sources.`
|
|
15689
15792
|
);
|
|
15690
15793
|
return void 0;
|
|
15691
15794
|
}
|
|
15692
|
-
const themeContent =
|
|
15795
|
+
const themeContent = fs3.readFileSync(canonicalPath, "utf-8");
|
|
15693
15796
|
const customThemeConfig = JSON.parse(themeContent);
|
|
15694
15797
|
const validation = validateCustomTheme(customThemeConfig);
|
|
15695
15798
|
if (!validation.isValid) {
|
|
@@ -16625,7 +16728,7 @@ function isSafeOscScheme(url) {
|
|
|
16625
16728
|
if (!match) return false;
|
|
16626
16729
|
return SAFE_OSC8_SCHEMES.has(match[1].toLowerCase());
|
|
16627
16730
|
}
|
|
16628
|
-
function
|
|
16731
|
+
function parseVersion2(versionString) {
|
|
16629
16732
|
if (!versionString) return { major: 0, minor: 0, patch: 0 };
|
|
16630
16733
|
if (/^\d{3,4}$/.test(versionString)) {
|
|
16631
16734
|
const m = /(\d{1,2})(\d{2})/.exec(versionString);
|
|
@@ -16667,7 +16770,7 @@ function supportsHyperlinks(stream = process.stdout) {
|
|
|
16667
16770
|
}
|
|
16668
16771
|
if (env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm") return true;
|
|
16669
16772
|
if (env["TERM_PROGRAM"]) {
|
|
16670
|
-
const version =
|
|
16773
|
+
const version = parseVersion2(env["TERM_PROGRAM_VERSION"]);
|
|
16671
16774
|
switch (env["TERM_PROGRAM"]) {
|
|
16672
16775
|
case "iTerm.app":
|
|
16673
16776
|
if (version.major === 3) return version.minor >= 1;
|
|
@@ -16693,7 +16796,7 @@ function supportsHyperlinks(stream = process.stdout) {
|
|
|
16693
16796
|
}
|
|
16694
16797
|
}
|
|
16695
16798
|
if (env["VTE_VERSION"]) {
|
|
16696
|
-
const version =
|
|
16799
|
+
const version = parseVersion2(env["VTE_VERSION"]);
|
|
16697
16800
|
if (version.major === 0 && version.minor === 50 && version.patch === 0) {
|
|
16698
16801
|
return false;
|
|
16699
16802
|
}
|
|
@@ -18681,16 +18784,16 @@ async function saveClipboardImage(targetDir) {
|
|
|
18681
18784
|
return null;
|
|
18682
18785
|
}
|
|
18683
18786
|
const baseDir = targetDir || process.cwd();
|
|
18684
|
-
const tempDir =
|
|
18685
|
-
await
|
|
18787
|
+
const tempDir = path112.join(baseDir, "clipboard");
|
|
18788
|
+
await fs4.mkdir(tempDir, { recursive: true });
|
|
18686
18789
|
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
18687
|
-
const tempFilePath =
|
|
18790
|
+
const tempFilePath = path112.join(tempDir, `clipboard-${timestamp}.png`);
|
|
18688
18791
|
const imageData = clipboard.getImageData();
|
|
18689
18792
|
const buffer = imageData.data;
|
|
18690
18793
|
if (!buffer) {
|
|
18691
18794
|
return null;
|
|
18692
18795
|
}
|
|
18693
|
-
await
|
|
18796
|
+
await fs4.writeFile(tempFilePath, buffer);
|
|
18694
18797
|
return tempFilePath;
|
|
18695
18798
|
} catch (error) {
|
|
18696
18799
|
debugLogger7.error("Error saving clipboard image:", error);
|
|
@@ -18700,15 +18803,15 @@ async function saveClipboardImage(targetDir) {
|
|
|
18700
18803
|
async function cleanupOldClipboardImages(targetDir) {
|
|
18701
18804
|
try {
|
|
18702
18805
|
const baseDir = targetDir || process.cwd();
|
|
18703
|
-
const tempDir =
|
|
18704
|
-
const files = await
|
|
18806
|
+
const tempDir = path112.join(baseDir, "clipboard");
|
|
18807
|
+
const files = await fs4.readdir(tempDir);
|
|
18705
18808
|
const MAX_IMAGES = 100;
|
|
18706
18809
|
const CLEANUP_COUNT = 50;
|
|
18707
18810
|
const imageFiles = [];
|
|
18708
18811
|
for (const file of files) {
|
|
18709
18812
|
if (file.startsWith("clipboard-") && (file.endsWith(".png") || file.endsWith(".jpg") || file.endsWith(".webp") || file.endsWith(".heic") || file.endsWith(".heif") || file.endsWith(".tiff") || file.endsWith(".gif") || file.endsWith(".bmp"))) {
|
|
18710
|
-
const filePath =
|
|
18711
|
-
const stats = await
|
|
18813
|
+
const filePath = path112.join(tempDir, file);
|
|
18814
|
+
const stats = await fs4.stat(filePath);
|
|
18712
18815
|
imageFiles.push({
|
|
18713
18816
|
name: file,
|
|
18714
18817
|
path: filePath,
|
|
@@ -18724,7 +18827,7 @@ async function cleanupOldClipboardImages(targetDir) {
|
|
|
18724
18827
|
);
|
|
18725
18828
|
const filesToRemove = imageFiles.slice(0, removeCount);
|
|
18726
18829
|
for (const file of filesToRemove) {
|
|
18727
|
-
await
|
|
18830
|
+
await fs4.unlink(file.path);
|
|
18728
18831
|
}
|
|
18729
18832
|
}
|
|
18730
18833
|
} catch {
|
|
@@ -22032,9 +22135,9 @@ function useTextBuffer({
|
|
|
22032
22135
|
const openInExternalEditor = useCallback6(
|
|
22033
22136
|
async (opts = {}) => {
|
|
22034
22137
|
const editor = opts.editor ?? process.env["VISUAL"] ?? process.env["EDITOR"] ?? (process.platform === "win32" ? "notepad" : "vi");
|
|
22035
|
-
const tmpDir =
|
|
22138
|
+
const tmpDir = fs5.mkdtempSync(pathMod.join(os42.tmpdir(), "qwen-edit-"));
|
|
22036
22139
|
const filePath = pathMod.join(tmpDir, "buffer.txt");
|
|
22037
|
-
|
|
22140
|
+
fs5.writeFileSync(filePath, text, "utf8");
|
|
22038
22141
|
dispatch({ type: "create_undo_snapshot" });
|
|
22039
22142
|
const wasRaw = stdin?.isRaw ?? false;
|
|
22040
22143
|
try {
|
|
@@ -22045,7 +22148,7 @@ function useTextBuffer({
|
|
|
22045
22148
|
if (error) throw error;
|
|
22046
22149
|
if (typeof status === "number" && status !== 0)
|
|
22047
22150
|
throw new Error(`External editor exited with status ${status}`);
|
|
22048
|
-
let newText =
|
|
22151
|
+
let newText = fs5.readFileSync(filePath, "utf8");
|
|
22049
22152
|
newText = newText.replace(/\r\n?/g, "\n");
|
|
22050
22153
|
dispatch({ type: "set_text", payload: newText, pushToUndo: false });
|
|
22051
22154
|
} catch (err) {
|
|
@@ -22053,11 +22156,11 @@ function useTextBuffer({
|
|
|
22053
22156
|
} finally {
|
|
22054
22157
|
if (wasRaw) setRawMode?.(true);
|
|
22055
22158
|
try {
|
|
22056
|
-
|
|
22159
|
+
fs5.unlinkSync(filePath);
|
|
22057
22160
|
} catch {
|
|
22058
22161
|
}
|
|
22059
22162
|
try {
|
|
22060
|
-
|
|
22163
|
+
fs5.rmdirSync(tmpDir);
|
|
22061
22164
|
} catch {
|
|
22062
22165
|
}
|
|
22063
22166
|
}
|
|
@@ -24545,8 +24648,112 @@ var TaskPlanPanel = ({ plan, taskStreams }) => {
|
|
|
24545
24648
|
}
|
|
24546
24649
|
);
|
|
24547
24650
|
};
|
|
24651
|
+
var UIActionsContext = createContext5(null);
|
|
24652
|
+
var useUIActions = () => {
|
|
24653
|
+
const context = useContext6(UIActionsContext);
|
|
24654
|
+
if (!context) {
|
|
24655
|
+
throw new Error("useUIActions must be used within a UIActionsProvider");
|
|
24656
|
+
}
|
|
24657
|
+
return context;
|
|
24658
|
+
};
|
|
24659
|
+
function isAgentWithPendingConfirmation2(rd) {
|
|
24660
|
+
return typeof rd === "object" && rd !== null && "type" in rd && rd.type === "task_execution" && rd.pendingConfirmation !== void 0;
|
|
24661
|
+
}
|
|
24662
|
+
function isTerminalSubagent(rd) {
|
|
24663
|
+
if (typeof rd !== "object" || rd === null || !("type" in rd) || rd.type !== "task_execution") {
|
|
24664
|
+
return false;
|
|
24665
|
+
}
|
|
24666
|
+
const status = rd.status;
|
|
24667
|
+
return status === "completed" || status === "failed" || status === "cancelled";
|
|
24668
|
+
}
|
|
24669
|
+
function isForceExpandGroup(item, embeddedShellFocused, activeShellPtyId) {
|
|
24670
|
+
if (item.type !== "tool_group") return false;
|
|
24671
|
+
if (item.isUserInitiated) return true;
|
|
24672
|
+
const tools = item.tools;
|
|
24673
|
+
if (tools.some(
|
|
24674
|
+
(t2) => t2.status === "Confirming"
|
|
24675
|
+
/* Confirming */
|
|
24676
|
+
)) return true;
|
|
24677
|
+
if (tools.some(
|
|
24678
|
+
(t2) => t2.status === "Error"
|
|
24679
|
+
/* Error */
|
|
24680
|
+
)) return true;
|
|
24681
|
+
if (tools.some((t2) => isAgentWithPendingConfirmation2(t2.resultDisplay))) return true;
|
|
24682
|
+
if (tools.some((t2) => isTerminalSubagent(t2.resultDisplay))) return true;
|
|
24683
|
+
if (embeddedShellFocused && activeShellPtyId !== void 0 && tools.some(
|
|
24684
|
+
(t2) => t2.ptyId === activeShellPtyId && t2.status === "Executing"
|
|
24685
|
+
/* Executing */
|
|
24686
|
+
)) {
|
|
24687
|
+
return true;
|
|
24688
|
+
}
|
|
24689
|
+
return false;
|
|
24690
|
+
}
|
|
24691
|
+
function isHiddenInCompactMode(item) {
|
|
24692
|
+
return item.type === "gemini_thought" || item.type === "gemini_thought_content" || item.type === "tool_use_summary";
|
|
24693
|
+
}
|
|
24694
|
+
function mergeCompactToolGroups(items, embeddedShellFocused = false, activeShellPtyId = void 0, absorbedCallIds = /* @__PURE__ */ new Set()) {
|
|
24695
|
+
const result = [];
|
|
24696
|
+
let i = 0;
|
|
24697
|
+
while (i < items.length) {
|
|
24698
|
+
const item = items[i];
|
|
24699
|
+
if (item.type === "tool_use_summary") {
|
|
24700
|
+
const allAbsorbed = item.precedingToolUseIds.length > 0 && item.precedingToolUseIds.every((id) => absorbedCallIds.has(id));
|
|
24701
|
+
if (allAbsorbed) {
|
|
24702
|
+
i++;
|
|
24703
|
+
continue;
|
|
24704
|
+
}
|
|
24705
|
+
result.push(item);
|
|
24706
|
+
i++;
|
|
24707
|
+
continue;
|
|
24708
|
+
}
|
|
24709
|
+
if (item.type !== "tool_group" || isForceExpandGroup(item, embeddedShellFocused, activeShellPtyId)) {
|
|
24710
|
+
result.push(item);
|
|
24711
|
+
i++;
|
|
24712
|
+
continue;
|
|
24713
|
+
}
|
|
24714
|
+
const mergeableGroups = [item];
|
|
24715
|
+
let lastMergedIdx = i;
|
|
24716
|
+
let j = i + 1;
|
|
24717
|
+
while (j < items.length) {
|
|
24718
|
+
const next = items[j];
|
|
24719
|
+
if (isHiddenInCompactMode(next)) {
|
|
24720
|
+
j++;
|
|
24721
|
+
continue;
|
|
24722
|
+
}
|
|
24723
|
+
if (next.type === "tool_group" && !isForceExpandGroup(next, embeddedShellFocused, activeShellPtyId)) {
|
|
24724
|
+
mergeableGroups.push(next);
|
|
24725
|
+
lastMergedIdx = j;
|
|
24726
|
+
j++;
|
|
24727
|
+
continue;
|
|
24728
|
+
}
|
|
24729
|
+
break;
|
|
24730
|
+
}
|
|
24731
|
+
if (mergeableGroups.length === 1) {
|
|
24732
|
+
result.push(item);
|
|
24733
|
+
i++;
|
|
24734
|
+
continue;
|
|
24735
|
+
}
|
|
24736
|
+
const mergedTools = mergeableGroups.flatMap(
|
|
24737
|
+
(g) => g.type === "tool_group" ? g.tools : []
|
|
24738
|
+
);
|
|
24739
|
+
const mergedGroup = {
|
|
24740
|
+
type: "tool_group",
|
|
24741
|
+
tools: mergedTools,
|
|
24742
|
+
id: mergeableGroups[0].id
|
|
24743
|
+
};
|
|
24744
|
+
result.push(mergedGroup);
|
|
24745
|
+
i = lastMergedIdx + 1;
|
|
24746
|
+
}
|
|
24747
|
+
return result;
|
|
24748
|
+
}
|
|
24749
|
+
var PROGRESSIVE_REPLAY_THRESHOLD = 100;
|
|
24750
|
+
var PROGRESSIVE_REPLAY_CHUNK_SIZE = 50;
|
|
24751
|
+
function initialReplayCount(length) {
|
|
24752
|
+
return length <= PROGRESSIVE_REPLAY_THRESHOLD ? length : Math.min(PROGRESSIVE_REPLAY_CHUNK_SIZE, length);
|
|
24753
|
+
}
|
|
24548
24754
|
var MainContent = ({
|
|
24549
24755
|
history,
|
|
24756
|
+
historyRemountKey,
|
|
24550
24757
|
pendingAssistantText,
|
|
24551
24758
|
liveToolCalls,
|
|
24552
24759
|
taskPlan,
|
|
@@ -24554,46 +24761,133 @@ var MainContent = ({
|
|
|
24554
24761
|
terminalWidth,
|
|
24555
24762
|
mainAreaWidth,
|
|
24556
24763
|
isFocused = true
|
|
24557
|
-
}) =>
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24565
|
-
|
|
24764
|
+
}) => {
|
|
24765
|
+
const { compactMode } = useCompactMode();
|
|
24766
|
+
const { refreshStatic } = useUIActions();
|
|
24767
|
+
const absorbedCallIds = useMemo6(() => {
|
|
24768
|
+
const absorbed = /* @__PURE__ */ new Set();
|
|
24769
|
+
if (!compactMode) return absorbed;
|
|
24770
|
+
for (const item of history) {
|
|
24771
|
+
if (item.type !== "tool_group") continue;
|
|
24772
|
+
if (isForceExpandGroup(item, false, void 0)) continue;
|
|
24773
|
+
for (const tool of item.tools) absorbed.add(tool.callId);
|
|
24774
|
+
}
|
|
24775
|
+
return absorbed;
|
|
24776
|
+
}, [compactMode, history]);
|
|
24777
|
+
const mergedHistory = useMemo6(
|
|
24778
|
+
() => compactMode ? mergeCompactToolGroups(history, false, void 0, absorbedCallIds) : history,
|
|
24779
|
+
[compactMode, history, absorbedCallIds]
|
|
24780
|
+
);
|
|
24781
|
+
const summaryByCallId = useMemo6(() => {
|
|
24782
|
+
const map = /* @__PURE__ */ new Map();
|
|
24783
|
+
for (const item of history) {
|
|
24784
|
+
if (item.type === "tool_use_summary") {
|
|
24785
|
+
for (const callId of item.precedingToolUseIds) {
|
|
24786
|
+
if (!map.has(callId)) map.set(callId, item.summary);
|
|
24787
|
+
}
|
|
24788
|
+
}
|
|
24789
|
+
}
|
|
24790
|
+
return map;
|
|
24791
|
+
}, [history]);
|
|
24792
|
+
const getCompactLabel = useCallback8(
|
|
24793
|
+
(item) => {
|
|
24794
|
+
if (item.type !== "tool_group" || item.tools.length === 0) return void 0;
|
|
24795
|
+
return summaryByCallId.get(item.tools[0].callId);
|
|
24566
24796
|
},
|
|
24567
|
-
|
|
24568
|
-
)
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
item
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24797
|
+
[summaryByCallId]
|
|
24798
|
+
);
|
|
24799
|
+
const isSummaryAbsorbed = useCallback8(
|
|
24800
|
+
(item) => {
|
|
24801
|
+
if (item.type !== "tool_use_summary") return false;
|
|
24802
|
+
return item.precedingToolUseIds.some((id) => absorbedCallIds.has(id));
|
|
24803
|
+
},
|
|
24804
|
+
[absorbedCallIds]
|
|
24805
|
+
);
|
|
24806
|
+
const prevHistoryLengthRef = useRef6(history.length);
|
|
24807
|
+
const prevMergedLengthRef = useRef6(mergedHistory.length);
|
|
24808
|
+
useEffect14(() => {
|
|
24809
|
+
if (!compactMode) {
|
|
24810
|
+
prevHistoryLengthRef.current = history.length;
|
|
24811
|
+
prevMergedLengthRef.current = mergedHistory.length;
|
|
24812
|
+
return;
|
|
24577
24813
|
}
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24814
|
+
const prevH = prevHistoryLengthRef.current;
|
|
24815
|
+
const currH = history.length;
|
|
24816
|
+
const prevM = prevMergedLengthRef.current;
|
|
24817
|
+
const currM = mergedHistory.length;
|
|
24818
|
+
if (currH > prevH && currM <= prevM) {
|
|
24819
|
+
refreshStatic();
|
|
24820
|
+
}
|
|
24821
|
+
prevHistoryLengthRef.current = currH;
|
|
24822
|
+
prevMergedLengthRef.current = currM;
|
|
24823
|
+
}, [compactMode, history, mergedHistory, refreshStatic]);
|
|
24824
|
+
const [replayCount, setReplayCount] = useState12(
|
|
24825
|
+
() => initialReplayCount(mergedHistory.length)
|
|
24826
|
+
);
|
|
24827
|
+
const mergedLengthRef = useRef6(mergedHistory.length);
|
|
24828
|
+
mergedLengthRef.current = mergedHistory.length;
|
|
24829
|
+
const [lastRemountKey, setLastRemountKey] = useState12(historyRemountKey);
|
|
24830
|
+
if (lastRemountKey !== historyRemountKey) {
|
|
24831
|
+
setLastRemountKey(historyRemountKey);
|
|
24832
|
+
setReplayCount(initialReplayCount(mergedLengthRef.current));
|
|
24833
|
+
}
|
|
24834
|
+
useEffect14(() => {
|
|
24835
|
+
if (replayCount >= mergedHistory.length) return;
|
|
24836
|
+
const remaining = mergedHistory.length - replayCount;
|
|
24837
|
+
if (remaining <= PROGRESSIVE_REPLAY_CHUNK_SIZE) {
|
|
24838
|
+
setReplayCount(mergedHistory.length);
|
|
24839
|
+
return;
|
|
24587
24840
|
}
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24841
|
+
const handle = setImmediate(() => {
|
|
24842
|
+
setReplayCount((c) => Math.min(c + PROGRESSIVE_REPLAY_CHUNK_SIZE, mergedLengthRef.current));
|
|
24843
|
+
});
|
|
24844
|
+
return () => clearImmediate(handle);
|
|
24845
|
+
}, [replayCount, mergedHistory.length]);
|
|
24846
|
+
const visibleHistory = mergedHistory.length - replayCount <= PROGRESSIVE_REPLAY_CHUNK_SIZE ? mergedHistory : mergedHistory.slice(0, replayCount);
|
|
24847
|
+
return /* @__PURE__ */ jsxs23(Box24, { flexDirection: "column", flexGrow: 1, children: [
|
|
24848
|
+
/* @__PURE__ */ jsx28(Static, { items: visibleHistory, children: (item) => /* @__PURE__ */ jsx28(
|
|
24849
|
+
HistoryItemDisplay,
|
|
24850
|
+
{
|
|
24851
|
+
item,
|
|
24852
|
+
terminalWidth,
|
|
24853
|
+
mainAreaWidth,
|
|
24854
|
+
isPending: false,
|
|
24855
|
+
isFocused,
|
|
24856
|
+
compactLabel: getCompactLabel(item),
|
|
24857
|
+
summaryAbsorbed: isSummaryAbsorbed(item)
|
|
24858
|
+
},
|
|
24859
|
+
item.id
|
|
24860
|
+
) }, historyRemountKey),
|
|
24861
|
+
pendingAssistantText.trim().length > 0 && /* @__PURE__ */ jsx28(
|
|
24862
|
+
HistoryItemDisplay,
|
|
24863
|
+
{
|
|
24864
|
+
item: { id: -1, type: "gemini", text: pendingAssistantText },
|
|
24865
|
+
terminalWidth,
|
|
24866
|
+
mainAreaWidth,
|
|
24867
|
+
isPending: true,
|
|
24868
|
+
isFocused
|
|
24869
|
+
}
|
|
24870
|
+
),
|
|
24871
|
+
liveToolCalls.length > 0 && /* @__PURE__ */ jsx28(
|
|
24872
|
+
HistoryItemDisplay,
|
|
24873
|
+
{
|
|
24874
|
+
item: { id: -2, type: "tool_group", tools: liveToolCalls },
|
|
24875
|
+
terminalWidth,
|
|
24876
|
+
mainAreaWidth,
|
|
24877
|
+
isPending: true,
|
|
24878
|
+
isFocused,
|
|
24879
|
+
compactLabel: getCompactLabel({ type: "tool_group", tools: liveToolCalls })
|
|
24880
|
+
}
|
|
24881
|
+
),
|
|
24882
|
+
taskPlan && /* @__PURE__ */ jsx28(TaskPlanPanel, { plan: taskPlan, taskStreams })
|
|
24883
|
+
] });
|
|
24884
|
+
};
|
|
24591
24885
|
function useTerminalSize() {
|
|
24592
|
-
const [size, setSize] =
|
|
24886
|
+
const [size, setSize] = useState13({
|
|
24593
24887
|
columns: process.stdout.columns || 80,
|
|
24594
24888
|
rows: process.stdout.rows || 24
|
|
24595
24889
|
});
|
|
24596
|
-
|
|
24890
|
+
useEffect15(() => {
|
|
24597
24891
|
function updateSize() {
|
|
24598
24892
|
setSize({
|
|
24599
24893
|
columns: process.stdout.columns || 80,
|
|
@@ -24608,15 +24902,15 @@ function useTerminalSize() {
|
|
|
24608
24902
|
return size;
|
|
24609
24903
|
}
|
|
24610
24904
|
function useAnimationFrame(watchRef, intervalMs = 50) {
|
|
24611
|
-
const [displayValue, setDisplayValue] =
|
|
24612
|
-
const displayRef =
|
|
24613
|
-
const targetRef =
|
|
24905
|
+
const [displayValue, setDisplayValue] = useState14(() => watchRef.current);
|
|
24906
|
+
const displayRef = useRef7(watchRef.current);
|
|
24907
|
+
const targetRef = useRef7(watchRef.current);
|
|
24614
24908
|
const currentTarget = watchRef.current;
|
|
24615
24909
|
if (currentTarget < displayRef.current) {
|
|
24616
24910
|
displayRef.current = currentTarget;
|
|
24617
24911
|
targetRef.current = currentTarget;
|
|
24618
24912
|
}
|
|
24619
|
-
|
|
24913
|
+
useEffect16(() => {
|
|
24620
24914
|
if (intervalMs === null) return;
|
|
24621
24915
|
const current = watchRef.current;
|
|
24622
24916
|
if (current !== targetRef.current) {
|
|
@@ -24668,7 +24962,7 @@ var LoadingIndicator = ({
|
|
|
24668
24962
|
const streamingState = useStreamingContext();
|
|
24669
24963
|
const { columns: terminalWidth } = useTerminalSize();
|
|
24670
24964
|
const isNarrow = isNarrowWidth(terminalWidth);
|
|
24671
|
-
const fallbackRef =
|
|
24965
|
+
const fallbackRef = useRef8(0);
|
|
24672
24966
|
const animatedChars = useAnimationFrame(
|
|
24673
24967
|
streamingCharsRef ?? fallbackRef,
|
|
24674
24968
|
streamingCharsRef && isStreaming ? 100 : null
|
|
@@ -24781,7 +25075,7 @@ var _PrepareLabel = ({
|
|
|
24781
25075
|
after
|
|
24782
25076
|
] });
|
|
24783
25077
|
};
|
|
24784
|
-
var PrepareLabel =
|
|
25078
|
+
var PrepareLabel = React25.memo(_PrepareLabel);
|
|
24785
25079
|
var MAX_SUGGESTIONS_TO_SHOW = 8;
|
|
24786
25080
|
function SuggestionsDisplay({
|
|
24787
25081
|
suggestions,
|
|
@@ -24882,13 +25176,13 @@ function useInputHistory({
|
|
|
24882
25176
|
currentQuery,
|
|
24883
25177
|
onChange
|
|
24884
25178
|
}) {
|
|
24885
|
-
const [historyIndex, setHistoryIndex] =
|
|
24886
|
-
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] =
|
|
24887
|
-
const resetHistoryNav =
|
|
25179
|
+
const [historyIndex, setHistoryIndex] = useState15(-1);
|
|
25180
|
+
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = useState15("");
|
|
25181
|
+
const resetHistoryNav = useCallback9(() => {
|
|
24888
25182
|
setHistoryIndex(-1);
|
|
24889
25183
|
setOriginalQueryBeforeNav("");
|
|
24890
25184
|
}, []);
|
|
24891
|
-
const handleSubmit =
|
|
25185
|
+
const handleSubmit = useCallback9(
|
|
24892
25186
|
(value) => {
|
|
24893
25187
|
const trimmedValue = value.trim();
|
|
24894
25188
|
if (trimmedValue) {
|
|
@@ -24898,7 +25192,7 @@ function useInputHistory({
|
|
|
24898
25192
|
},
|
|
24899
25193
|
[onSubmit, resetHistoryNav]
|
|
24900
25194
|
);
|
|
24901
|
-
const navigateUp =
|
|
25195
|
+
const navigateUp = useCallback9(() => {
|
|
24902
25196
|
if (!isActive) return false;
|
|
24903
25197
|
if (userMessages.length === 0) return false;
|
|
24904
25198
|
let nextIndex = historyIndex;
|
|
@@ -24927,7 +25221,7 @@ function useInputHistory({
|
|
|
24927
25221
|
// Use currentQuery from props
|
|
24928
25222
|
setOriginalQueryBeforeNav
|
|
24929
25223
|
]);
|
|
24930
|
-
const navigateDown =
|
|
25224
|
+
const navigateDown = useCallback9(() => {
|
|
24931
25225
|
if (!isActive) return false;
|
|
24932
25226
|
if (historyIndex === -1) return false;
|
|
24933
25227
|
const nextIndex = historyIndex - 1;
|
|
@@ -24962,7 +25256,7 @@ async function getHistoryFilePath(projectRoot, configStorage) {
|
|
|
24962
25256
|
}
|
|
24963
25257
|
async function readHistoryFile(filePath) {
|
|
24964
25258
|
try {
|
|
24965
|
-
const text = await
|
|
25259
|
+
const text = await fs6.readFile(filePath, "utf-8");
|
|
24966
25260
|
const result = [];
|
|
24967
25261
|
let cur = "";
|
|
24968
25262
|
for (const raw of text.split(/\r?\n/)) {
|
|
@@ -24986,17 +25280,17 @@ async function readHistoryFile(filePath) {
|
|
|
24986
25280
|
}
|
|
24987
25281
|
async function writeHistoryFile(filePath, history) {
|
|
24988
25282
|
try {
|
|
24989
|
-
await
|
|
24990
|
-
await
|
|
25283
|
+
await fs6.mkdir(path122.dirname(filePath), { recursive: true });
|
|
25284
|
+
await fs6.writeFile(filePath, history.join("\n"));
|
|
24991
25285
|
} catch (error) {
|
|
24992
25286
|
debugLogger11.error("Error writing shell history:", error);
|
|
24993
25287
|
}
|
|
24994
25288
|
}
|
|
24995
25289
|
function useShellHistory(projectRoot, storage) {
|
|
24996
|
-
const [history, setHistory] =
|
|
24997
|
-
const [historyIndex, setHistoryIndex] =
|
|
24998
|
-
const [historyFilePath, setHistoryFilePath] =
|
|
24999
|
-
|
|
25290
|
+
const [history, setHistory] = useState16([]);
|
|
25291
|
+
const [historyIndex, setHistoryIndex] = useState16(-1);
|
|
25292
|
+
const [historyFilePath, setHistoryFilePath] = useState16(null);
|
|
25293
|
+
useEffect17(() => {
|
|
25000
25294
|
async function loadHistory() {
|
|
25001
25295
|
const filePath = await getHistoryFilePath(projectRoot, storage);
|
|
25002
25296
|
setHistoryFilePath(filePath);
|
|
@@ -25005,7 +25299,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
25005
25299
|
}
|
|
25006
25300
|
loadHistory();
|
|
25007
25301
|
}, [projectRoot, storage]);
|
|
25008
|
-
const addCommandToHistory =
|
|
25302
|
+
const addCommandToHistory = useCallback10(
|
|
25009
25303
|
(command) => {
|
|
25010
25304
|
if (!command.trim() || !historyFilePath) {
|
|
25011
25305
|
return;
|
|
@@ -25017,7 +25311,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
25017
25311
|
},
|
|
25018
25312
|
[history, historyFilePath]
|
|
25019
25313
|
);
|
|
25020
|
-
const getPreviousCommand =
|
|
25314
|
+
const getPreviousCommand = useCallback10(() => {
|
|
25021
25315
|
if (history.length === 0) {
|
|
25022
25316
|
return null;
|
|
25023
25317
|
}
|
|
@@ -25025,7 +25319,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
25025
25319
|
setHistoryIndex(newIndex);
|
|
25026
25320
|
return history[newIndex] ?? null;
|
|
25027
25321
|
}, [history, historyIndex]);
|
|
25028
|
-
const getNextCommand =
|
|
25322
|
+
const getNextCommand = useCallback10(() => {
|
|
25029
25323
|
if (historyIndex < 0) {
|
|
25030
25324
|
return null;
|
|
25031
25325
|
}
|
|
@@ -25036,7 +25330,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
25036
25330
|
}
|
|
25037
25331
|
return history[newIndex] ?? null;
|
|
25038
25332
|
}, [history, historyIndex]);
|
|
25039
|
-
const resetHistoryPosition =
|
|
25333
|
+
const resetHistoryPosition = useCallback10(() => {
|
|
25040
25334
|
setHistoryIndex(-1);
|
|
25041
25335
|
}, []);
|
|
25042
25336
|
return {
|
|
@@ -25048,13 +25342,13 @@ function useShellHistory(projectRoot, storage) {
|
|
|
25048
25342
|
};
|
|
25049
25343
|
}
|
|
25050
25344
|
function useCompletion() {
|
|
25051
|
-
const [suggestions, setSuggestions] =
|
|
25052
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] =
|
|
25053
|
-
const [visibleStartIndex, setVisibleStartIndex] =
|
|
25054
|
-
const [showSuggestions, setShowSuggestions] =
|
|
25055
|
-
const [isLoadingSuggestions, setIsLoadingSuggestions] =
|
|
25056
|
-
const [isPerfectMatch, setIsPerfectMatch] =
|
|
25057
|
-
const resetCompletionState =
|
|
25345
|
+
const [suggestions, setSuggestions] = useState17([]);
|
|
25346
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = useState17(-1);
|
|
25347
|
+
const [visibleStartIndex, setVisibleStartIndex] = useState17(0);
|
|
25348
|
+
const [showSuggestions, setShowSuggestions] = useState17(false);
|
|
25349
|
+
const [isLoadingSuggestions, setIsLoadingSuggestions] = useState17(false);
|
|
25350
|
+
const [isPerfectMatch, setIsPerfectMatch] = useState17(false);
|
|
25351
|
+
const resetCompletionState = useCallback11(() => {
|
|
25058
25352
|
setSuggestions([]);
|
|
25059
25353
|
setActiveSuggestionIndex(-1);
|
|
25060
25354
|
setVisibleStartIndex(0);
|
|
@@ -25062,7 +25356,7 @@ function useCompletion() {
|
|
|
25062
25356
|
setIsLoadingSuggestions(false);
|
|
25063
25357
|
setIsPerfectMatch(false);
|
|
25064
25358
|
}, []);
|
|
25065
|
-
const navigateUp =
|
|
25359
|
+
const navigateUp = useCallback11(() => {
|
|
25066
25360
|
if (suggestions.length === 0) return;
|
|
25067
25361
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
25068
25362
|
const newActiveIndex = prevActiveIndex <= 0 ? suggestions.length - 1 : prevActiveIndex - 1;
|
|
@@ -25078,7 +25372,7 @@ function useCompletion() {
|
|
|
25078
25372
|
return newActiveIndex;
|
|
25079
25373
|
});
|
|
25080
25374
|
}, [suggestions.length]);
|
|
25081
|
-
const navigateDown =
|
|
25375
|
+
const navigateDown = useCallback11(() => {
|
|
25082
25376
|
if (suggestions.length === 0) return;
|
|
25083
25377
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
25084
25378
|
const newActiveIndex = prevActiveIndex >= suggestions.length - 1 ? 0 : prevActiveIndex + 1;
|
|
@@ -25114,8 +25408,8 @@ function useCompletion() {
|
|
|
25114
25408
|
};
|
|
25115
25409
|
}
|
|
25116
25410
|
function useDebouncedValue(value, delay3 = 200) {
|
|
25117
|
-
const [debounced, setDebounced] =
|
|
25118
|
-
|
|
25411
|
+
const [debounced, setDebounced] = useState18(value);
|
|
25412
|
+
useEffect18(() => {
|
|
25119
25413
|
const handle = setTimeout(() => setDebounced(value), delay3);
|
|
25120
25414
|
return () => clearTimeout(handle);
|
|
25121
25415
|
}, [value, delay3]);
|
|
@@ -25137,19 +25431,19 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
25137
25431
|
setVisibleStartIndex
|
|
25138
25432
|
} = useCompletion();
|
|
25139
25433
|
const debouncedQuery = useDebouncedValue(buffer.text, 100);
|
|
25140
|
-
const prevQueryRef =
|
|
25141
|
-
const prevMatchesRef =
|
|
25142
|
-
|
|
25434
|
+
const prevQueryRef = useRef9("");
|
|
25435
|
+
const prevMatchesRef = useRef9([]);
|
|
25436
|
+
useEffect18(() => {
|
|
25143
25437
|
if (reverseSearchActive) {
|
|
25144
25438
|
prevQueryRef.current = "";
|
|
25145
25439
|
prevMatchesRef.current = [];
|
|
25146
25440
|
}
|
|
25147
25441
|
}, [reverseSearchActive]);
|
|
25148
|
-
|
|
25442
|
+
useEffect18(() => {
|
|
25149
25443
|
prevQueryRef.current = "";
|
|
25150
25444
|
prevMatchesRef.current = [];
|
|
25151
25445
|
}, [history]);
|
|
25152
|
-
const searchHistory =
|
|
25446
|
+
const searchHistory = useCallback12(
|
|
25153
25447
|
(query, items) => {
|
|
25154
25448
|
const out = [];
|
|
25155
25449
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -25163,7 +25457,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
25163
25457
|
},
|
|
25164
25458
|
[]
|
|
25165
25459
|
);
|
|
25166
|
-
const matches =
|
|
25460
|
+
const matches = useMemo7(() => {
|
|
25167
25461
|
if (!reverseSearchActive) return [];
|
|
25168
25462
|
if (debouncedQuery.length === 0)
|
|
25169
25463
|
return history.map((cmd) => ({
|
|
@@ -25176,7 +25470,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
25176
25470
|
const source = canUseCache ? prevMatchesRef.current.map((m) => m.value) : history;
|
|
25177
25471
|
return searchHistory(query, source);
|
|
25178
25472
|
}, [debouncedQuery, history, reverseSearchActive, searchHistory]);
|
|
25179
|
-
|
|
25473
|
+
useEffect18(() => {
|
|
25180
25474
|
if (!reverseSearchActive) {
|
|
25181
25475
|
resetCompletionState();
|
|
25182
25476
|
return;
|
|
@@ -25198,7 +25492,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
25198
25492
|
setVisibleStartIndex,
|
|
25199
25493
|
resetCompletionState
|
|
25200
25494
|
]);
|
|
25201
|
-
const handleAutocomplete =
|
|
25495
|
+
const handleAutocomplete = useCallback12(
|
|
25202
25496
|
(i) => {
|
|
25203
25497
|
if (i < 0 || i >= suggestions.length) return;
|
|
25204
25498
|
buffer.setText(suggestions[i].value);
|
|
@@ -25366,19 +25660,19 @@ function useAtCompletion(props) {
|
|
|
25366
25660
|
setIsLoadingSuggestions
|
|
25367
25661
|
} = props;
|
|
25368
25662
|
const [state, dispatch] = useReducer3(atCompletionReducer, initialState);
|
|
25369
|
-
const fileSearch =
|
|
25370
|
-
const searchAbortController =
|
|
25371
|
-
const slowSearchTimer =
|
|
25372
|
-
|
|
25663
|
+
const fileSearch = useRef10(null);
|
|
25664
|
+
const searchAbortController = useRef10(null);
|
|
25665
|
+
const slowSearchTimer = useRef10(null);
|
|
25666
|
+
useEffect19(() => {
|
|
25373
25667
|
setSuggestions(state.suggestions);
|
|
25374
25668
|
}, [state.suggestions, setSuggestions]);
|
|
25375
|
-
|
|
25669
|
+
useEffect19(() => {
|
|
25376
25670
|
setIsLoadingSuggestions(state.isLoading);
|
|
25377
25671
|
}, [state.isLoading, setIsLoadingSuggestions]);
|
|
25378
|
-
|
|
25672
|
+
useEffect19(() => {
|
|
25379
25673
|
dispatch({ type: "RESET" });
|
|
25380
25674
|
}, [cwd, config]);
|
|
25381
|
-
|
|
25675
|
+
useEffect19(() => {
|
|
25382
25676
|
if (!enabled) {
|
|
25383
25677
|
if (state.status === "ready" || state.status === "error") {
|
|
25384
25678
|
dispatch({ type: "RESET" });
|
|
@@ -25395,7 +25689,7 @@ function useAtCompletion(props) {
|
|
|
25395
25689
|
dispatch({ type: "SEARCH", payload: pattern });
|
|
25396
25690
|
}
|
|
25397
25691
|
}, [enabled, pattern, state.status, state.pattern]);
|
|
25398
|
-
|
|
25692
|
+
useEffect19(() => {
|
|
25399
25693
|
const initialize = async () => {
|
|
25400
25694
|
try {
|
|
25401
25695
|
const searcher = FileSearchFactory.create({
|
|
@@ -25515,7 +25809,7 @@ function matchesCommand(cmd, query) {
|
|
|
25515
25809
|
return cmd.name.toLowerCase() === query.toLowerCase() || cmd.altNames?.some((alt) => alt.toLowerCase() === query.toLowerCase()) || false;
|
|
25516
25810
|
}
|
|
25517
25811
|
function useCommandParser(query, slashCommands) {
|
|
25518
|
-
return
|
|
25812
|
+
return useMemo8(() => {
|
|
25519
25813
|
if (!query) {
|
|
25520
25814
|
return {
|
|
25521
25815
|
hasTrailingSpace: false,
|
|
@@ -25652,9 +25946,9 @@ function toCommandSuggestion(command, matchedAlias, includeAliases = false) {
|
|
|
25652
25946
|
};
|
|
25653
25947
|
}
|
|
25654
25948
|
function useCommandSuggestions(parserResult, commandContext, getFzfForCommands, getPrefixSuggestions, recentCommands) {
|
|
25655
|
-
const [suggestions, setSuggestions] =
|
|
25656
|
-
const [isLoading, setIsLoading] =
|
|
25657
|
-
|
|
25949
|
+
const [suggestions, setSuggestions] = useState19([]);
|
|
25950
|
+
const [isLoading, setIsLoading] = useState19(false);
|
|
25951
|
+
useEffect20(() => {
|
|
25658
25952
|
const abortController = new AbortController();
|
|
25659
25953
|
const { signal } = abortController;
|
|
25660
25954
|
const {
|
|
@@ -25823,7 +26117,7 @@ function toSuggestion(item) {
|
|
|
25823
26117
|
};
|
|
25824
26118
|
}
|
|
25825
26119
|
function useCompletionPositions(query, parserResult) {
|
|
25826
|
-
return
|
|
26120
|
+
return useMemo8(() => {
|
|
25827
26121
|
if (!query) {
|
|
25828
26122
|
return { start: -1, end: -1 };
|
|
25829
26123
|
}
|
|
@@ -25844,7 +26138,7 @@ function useCompletionPositions(query, parserResult) {
|
|
|
25844
26138
|
}, [query, parserResult]);
|
|
25845
26139
|
}
|
|
25846
26140
|
function usePerfectMatch(parserResult) {
|
|
25847
|
-
return
|
|
26141
|
+
return useMemo8(() => {
|
|
25848
26142
|
const { hasTrailingSpace, partial, leafCommand, currentLevel } = parserResult;
|
|
25849
26143
|
if (hasTrailingSpace) {
|
|
25850
26144
|
return { isPerfectMatch: false };
|
|
@@ -25874,13 +26168,13 @@ function useSlashCompletion(props) {
|
|
|
25874
26168
|
setIsLoadingSuggestions,
|
|
25875
26169
|
setIsPerfectMatch
|
|
25876
26170
|
} = props;
|
|
25877
|
-
const [completionStart, setCompletionStart] =
|
|
25878
|
-
const [completionEnd, setCompletionEnd] =
|
|
25879
|
-
const fzfInstanceCache =
|
|
26171
|
+
const [completionStart, setCompletionStart] = useState19(-1);
|
|
26172
|
+
const [completionEnd, setCompletionEnd] = useState19(-1);
|
|
26173
|
+
const fzfInstanceCache = useMemo8(
|
|
25880
26174
|
() => /* @__PURE__ */ new WeakMap(),
|
|
25881
26175
|
[]
|
|
25882
26176
|
);
|
|
25883
|
-
const getFzfForCommands =
|
|
26177
|
+
const getFzfForCommands = useMemo8(
|
|
25884
26178
|
() => (commands) => {
|
|
25885
26179
|
if (!commands || commands.length === 0) {
|
|
25886
26180
|
return null;
|
|
@@ -25924,7 +26218,7 @@ function useSlashCompletion(props) {
|
|
|
25924
26218
|
},
|
|
25925
26219
|
[fzfInstanceCache]
|
|
25926
26220
|
);
|
|
25927
|
-
const getPrefixSuggestions =
|
|
26221
|
+
const getPrefixSuggestions = useMemo8(
|
|
25928
26222
|
() => (commands, partial) => {
|
|
25929
26223
|
const rankedMatches = commands.flatMap((cmd, index) => {
|
|
25930
26224
|
if (!cmd.description || cmd.hidden) {
|
|
@@ -25968,7 +26262,7 @@ function useSlashCompletion(props) {
|
|
|
25968
26262
|
parserResult
|
|
25969
26263
|
);
|
|
25970
26264
|
const { isPerfectMatch } = usePerfectMatch(parserResult);
|
|
25971
|
-
|
|
26265
|
+
useEffect20(() => {
|
|
25972
26266
|
if (!enabled) {
|
|
25973
26267
|
setSuggestions([]);
|
|
25974
26268
|
setIsLoadingSuggestions(false);
|
|
@@ -25977,7 +26271,7 @@ function useSlashCompletion(props) {
|
|
|
25977
26271
|
setCompletionEnd(-1);
|
|
25978
26272
|
}
|
|
25979
26273
|
}, [enabled, setSuggestions, setIsLoadingSuggestions, setIsPerfectMatch]);
|
|
25980
|
-
|
|
26274
|
+
useEffect20(() => {
|
|
25981
26275
|
if (!enabled || query === null) {
|
|
25982
26276
|
return;
|
|
25983
26277
|
}
|
|
@@ -26051,7 +26345,7 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
|
|
|
26051
26345
|
} = useCompletion();
|
|
26052
26346
|
const cursorRow = buffer.cursor[0];
|
|
26053
26347
|
const cursorCol = buffer.cursor[1];
|
|
26054
|
-
const { completionMode, query, completionStart, completionEnd } =
|
|
26348
|
+
const { completionMode, query, completionStart, completionEnd } = useMemo9(() => {
|
|
26055
26349
|
const currentLine = buffer.lines[cursorRow] || "";
|
|
26056
26350
|
const codePoints = toCodePoints(currentLine);
|
|
26057
26351
|
for (let i = cursorCol - 1; i >= 0; i--) {
|
|
@@ -26121,11 +26415,11 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
|
|
|
26121
26415
|
setIsLoadingSuggestions,
|
|
26122
26416
|
setIsPerfectMatch
|
|
26123
26417
|
});
|
|
26124
|
-
|
|
26418
|
+
useEffect21(() => {
|
|
26125
26419
|
setActiveSuggestionIndex(suggestions.length > 0 ? 0 : -1);
|
|
26126
26420
|
setVisibleStartIndex(0);
|
|
26127
26421
|
}, [suggestions, setActiveSuggestionIndex, setVisibleStartIndex]);
|
|
26128
|
-
|
|
26422
|
+
useEffect21(() => {
|
|
26129
26423
|
if (completionMode === "IDLE" || reverseSearchActive || !active) {
|
|
26130
26424
|
resetCompletionState();
|
|
26131
26425
|
return;
|
|
@@ -26140,7 +26434,7 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
|
|
|
26140
26434
|
resetCompletionState,
|
|
26141
26435
|
setShowSuggestions
|
|
26142
26436
|
]);
|
|
26143
|
-
const handleAutocomplete =
|
|
26437
|
+
const handleAutocomplete = useCallback13(
|
|
26144
26438
|
(indexToUse) => {
|
|
26145
26439
|
if (indexToUse < 0 || indexToUse >= suggestions.length) {
|
|
26146
26440
|
return null;
|
|
@@ -26192,7 +26486,7 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
|
|
|
26192
26486
|
slashCompletionRange
|
|
26193
26487
|
]
|
|
26194
26488
|
);
|
|
26195
|
-
const midInputGhostText =
|
|
26489
|
+
const midInputGhostText = useMemo9(() => {
|
|
26196
26490
|
if (!active || reverseSearchActive) return null;
|
|
26197
26491
|
const cursorOffset = logicalPosToOffset(buffer.lines, cursorRow, cursorCol);
|
|
26198
26492
|
const midCmd = findMidInputSlashCommand(buffer.text, cursorOffset);
|
|
@@ -26279,11 +26573,11 @@ var getNextExportCompletionIndex = (formatList, currentIndex, direction) => {
|
|
|
26279
26573
|
return currentIndex >= lastIndex ? 0 : currentIndex + 1;
|
|
26280
26574
|
};
|
|
26281
26575
|
function useExportCompletion(buffer, slashCommands) {
|
|
26282
|
-
const navigatedRef =
|
|
26283
|
-
const navigatedTextRef =
|
|
26284
|
-
const cyclingActiveRef =
|
|
26285
|
-
const nextTextChangeWasUserInputRef =
|
|
26286
|
-
const exportFormatSuggestions =
|
|
26576
|
+
const navigatedRef = useRef11(false);
|
|
26577
|
+
const navigatedTextRef = useRef11("");
|
|
26578
|
+
const cyclingActiveRef = useRef11(false);
|
|
26579
|
+
const nextTextChangeWasUserInputRef = useRef11(false);
|
|
26580
|
+
const exportFormatSuggestions = useMemo10(() => {
|
|
26287
26581
|
const exportCommand = slashCommands.find(
|
|
26288
26582
|
(command) => command.name === EXPORT_COMMAND_INPUT.slice(1)
|
|
26289
26583
|
);
|
|
@@ -26298,31 +26592,31 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
26298
26592
|
}
|
|
26299
26593
|
return [];
|
|
26300
26594
|
}, [slashCommands]);
|
|
26301
|
-
const exportCycleFormats =
|
|
26595
|
+
const exportCycleFormats = useMemo10(
|
|
26302
26596
|
() => exportFormatSuggestions.map((s) => s.value),
|
|
26303
26597
|
[exportFormatSuggestions]
|
|
26304
26598
|
);
|
|
26305
|
-
const markNextTextChangeAsUserInput =
|
|
26599
|
+
const markNextTextChangeAsUserInput = useCallback14(() => {
|
|
26306
26600
|
nextTextChangeWasUserInputRef.current = true;
|
|
26307
26601
|
}, []);
|
|
26308
|
-
|
|
26602
|
+
useEffect222(() => {
|
|
26309
26603
|
const fmt = getExportFormatFromInput(buffer.text, exportCycleFormats);
|
|
26310
26604
|
if (nextTextChangeWasUserInputRef.current && fmt !== null && !cyclingActiveRef.current) {
|
|
26311
26605
|
cyclingActiveRef.current = true;
|
|
26312
26606
|
}
|
|
26313
26607
|
nextTextChangeWasUserInputRef.current = false;
|
|
26314
26608
|
}, [buffer.text, exportCycleFormats]);
|
|
26315
|
-
|
|
26609
|
+
useEffect222(() => {
|
|
26316
26610
|
navigatedRef.current = false;
|
|
26317
26611
|
navigatedTextRef.current = "";
|
|
26318
26612
|
}, [buffer.text]);
|
|
26319
|
-
const reset =
|
|
26613
|
+
const reset = useCallback14(() => {
|
|
26320
26614
|
cyclingActiveRef.current = false;
|
|
26321
26615
|
nextTextChangeWasUserInputRef.current = false;
|
|
26322
26616
|
navigatedRef.current = false;
|
|
26323
26617
|
navigatedTextRef.current = "";
|
|
26324
26618
|
}, []);
|
|
26325
|
-
const getExportIndexForActiveSuggestion =
|
|
26619
|
+
const getExportIndexForActiveSuggestion = useCallback14(
|
|
26326
26620
|
(completion) => {
|
|
26327
26621
|
const idx = completion.activeSuggestionIndex;
|
|
26328
26622
|
if (idx < 0 || idx >= completion.suggestions.length) {
|
|
@@ -26332,7 +26626,7 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
26332
26626
|
},
|
|
26333
26627
|
[exportCycleFormats]
|
|
26334
26628
|
);
|
|
26335
|
-
const setExportCompletionInput =
|
|
26629
|
+
const setExportCompletionInput = useCallback14(
|
|
26336
26630
|
(index) => {
|
|
26337
26631
|
const format = exportCycleFormats[index];
|
|
26338
26632
|
if (!format) return false;
|
|
@@ -26343,7 +26637,7 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
26343
26637
|
},
|
|
26344
26638
|
[buffer, exportCycleFormats]
|
|
26345
26639
|
);
|
|
26346
|
-
const handleExportInput =
|
|
26640
|
+
const handleExportInput = useCallback14(
|
|
26347
26641
|
(key, completion) => {
|
|
26348
26642
|
const isCompletionUpKey = keyMatchers[
|
|
26349
26643
|
"completionUp"
|
|
@@ -26423,7 +26717,7 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
26423
26717
|
(s) => s.value === selectedExportFormat
|
|
26424
26718
|
);
|
|
26425
26719
|
const shouldShowSuggestions = !cyclingActiveRef.current || selectedExportFormatIndex === -1 ? false : true;
|
|
26426
|
-
const suggestionDisplayProps =
|
|
26720
|
+
const suggestionDisplayProps = useMemo10(
|
|
26427
26721
|
() => shouldShowSuggestions ? {
|
|
26428
26722
|
suggestions: exportFormatSuggestions,
|
|
26429
26723
|
activeIndex: selectedExportFormatIndex,
|
|
@@ -26432,7 +26726,7 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
26432
26726
|
} : null,
|
|
26433
26727
|
[exportFormatSuggestions, selectedExportFormatIndex, shouldShowSuggestions]
|
|
26434
26728
|
);
|
|
26435
|
-
return
|
|
26729
|
+
return useMemo10(
|
|
26436
26730
|
() => ({
|
|
26437
26731
|
shouldShowSuggestions,
|
|
26438
26732
|
suggestionDisplayProps,
|
|
@@ -26452,16 +26746,16 @@ function useExportCompletion(buffer, slashCommands) {
|
|
|
26452
26746
|
);
|
|
26453
26747
|
}
|
|
26454
26748
|
function useFollowupSuggestionsCLI(options) {
|
|
26455
|
-
const [state, setState] =
|
|
26456
|
-
const onAcceptRef =
|
|
26749
|
+
const [state, setState] = useState20({ isVisible: false, suggestion: null });
|
|
26750
|
+
const onAcceptRef = useRef12(options?.onAccept);
|
|
26457
26751
|
onAcceptRef.current = options?.onAccept;
|
|
26458
|
-
const setSuggestion =
|
|
26752
|
+
const setSuggestion = useCallback15((text) => {
|
|
26459
26753
|
setState({ isVisible: text !== null && text.trim().length > 0, suggestion: text });
|
|
26460
26754
|
}, []);
|
|
26461
|
-
const dismiss =
|
|
26755
|
+
const dismiss = useCallback15(() => {
|
|
26462
26756
|
setState({ isVisible: false, suggestion: null });
|
|
26463
26757
|
}, []);
|
|
26464
|
-
const accept =
|
|
26758
|
+
const accept = useCallback15(
|
|
26465
26759
|
(_method, opts) => {
|
|
26466
26760
|
setState((prev) => {
|
|
26467
26761
|
if (prev.suggestion && !opts?.skipOnAccept) {
|
|
@@ -26550,24 +26844,16 @@ function buildSegmentsForVisualSlice(tokens, sliceStart, sliceEnd) {
|
|
|
26550
26844
|
}
|
|
26551
26845
|
return segments;
|
|
26552
26846
|
}
|
|
26553
|
-
var ShellFocusContext =
|
|
26554
|
-
var useShellFocusState = () =>
|
|
26555
|
-
var UIStateContext =
|
|
26847
|
+
var ShellFocusContext = createContext6(true);
|
|
26848
|
+
var useShellFocusState = () => useContext7(ShellFocusContext);
|
|
26849
|
+
var UIStateContext = createContext7(null);
|
|
26556
26850
|
var useUIState = () => {
|
|
26557
|
-
const context =
|
|
26851
|
+
const context = useContext8(UIStateContext);
|
|
26558
26852
|
if (!context) {
|
|
26559
26853
|
throw new Error("useUIState must be used within a UIStateProvider");
|
|
26560
26854
|
}
|
|
26561
26855
|
return context;
|
|
26562
26856
|
};
|
|
26563
|
-
var UIActionsContext = createContext7(null);
|
|
26564
|
-
var useUIActions = () => {
|
|
26565
|
-
const context = useContext8(UIActionsContext);
|
|
26566
|
-
if (!context) {
|
|
26567
|
-
throw new Error("useUIActions must be used within a UIActionsProvider");
|
|
26568
|
-
}
|
|
26569
|
-
return context;
|
|
26570
|
-
};
|
|
26571
26857
|
var STATE = {
|
|
26572
26858
|
activeView: "main",
|
|
26573
26859
|
agents: /* @__PURE__ */ new Map(),
|
|
@@ -26654,7 +26940,7 @@ var BaseTextInput = ({
|
|
|
26654
26940
|
isActive = true,
|
|
26655
26941
|
renderLine = defaultRenderLine
|
|
26656
26942
|
}) => {
|
|
26657
|
-
const handleKey =
|
|
26943
|
+
const handleKey = useCallback16(
|
|
26658
26944
|
(key) => {
|
|
26659
26945
|
if (onKeypress?.(key)) {
|
|
26660
26946
|
return;
|
|
@@ -26885,20 +27171,20 @@ var InputPrompt = ({
|
|
|
26885
27171
|
const { setPillFocused: setBgPillFocused } = useBackgroundTaskViewActions();
|
|
26886
27172
|
const hasAgents = agents.size > 0;
|
|
26887
27173
|
const hasBgAgents = bgEntries.length > 0;
|
|
26888
|
-
const [justNavigatedHistory, setJustNavigatedHistory] =
|
|
26889
|
-
const [escPressCount, setEscPressCount] =
|
|
26890
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
26891
|
-
const escapeTimerRef =
|
|
26892
|
-
const [recentPasteTime, setRecentPasteTime] =
|
|
26893
|
-
const pasteTimeoutRef =
|
|
26894
|
-
const [attachments, setAttachments] =
|
|
26895
|
-
const [isAttachmentMode, setIsAttachmentMode] =
|
|
26896
|
-
const [selectedAttachmentIndex, setSelectedAttachmentIndex] =
|
|
26897
|
-
const [pendingPastes, setPendingPastes] =
|
|
27174
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = useState21(false);
|
|
27175
|
+
const [escPressCount, setEscPressCount] = useState21(0);
|
|
27176
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState21(false);
|
|
27177
|
+
const escapeTimerRef = useRef13(null);
|
|
27178
|
+
const [recentPasteTime, setRecentPasteTime] = useState21(null);
|
|
27179
|
+
const pasteTimeoutRef = useRef13(null);
|
|
27180
|
+
const [attachments, setAttachments] = useState21([]);
|
|
27181
|
+
const [isAttachmentMode, setIsAttachmentMode] = useState21(false);
|
|
27182
|
+
const [selectedAttachmentIndex, setSelectedAttachmentIndex] = useState21(-1);
|
|
27183
|
+
const [pendingPastes, setPendingPastes] = useState21(
|
|
26898
27184
|
/* @__PURE__ */ new Map()
|
|
26899
27185
|
);
|
|
26900
|
-
const activePlaceholderIds =
|
|
26901
|
-
const parsePlaceholder =
|
|
27186
|
+
const activePlaceholderIds = useRef13(/* @__PURE__ */ new Map());
|
|
27187
|
+
const parsePlaceholder = useCallback17(
|
|
26902
27188
|
(placeholder2) => {
|
|
26903
27189
|
const match = placeholder2.match(
|
|
26904
27190
|
/^\[Pasted Content (\d+) chars\](?: #(\d+))?$/
|
|
@@ -26910,7 +27196,7 @@ var InputPrompt = ({
|
|
|
26910
27196
|
},
|
|
26911
27197
|
[]
|
|
26912
27198
|
);
|
|
26913
|
-
const freePlaceholderId =
|
|
27199
|
+
const freePlaceholderId = useCallback17((charCount, id) => {
|
|
26914
27200
|
const activeIds = activePlaceholderIds.current.get(charCount);
|
|
26915
27201
|
if (activeIds) {
|
|
26916
27202
|
activeIds.delete(id);
|
|
@@ -26919,14 +27205,14 @@ var InputPrompt = ({
|
|
|
26919
27205
|
}
|
|
26920
27206
|
}
|
|
26921
27207
|
}, []);
|
|
26922
|
-
const [reverseSearchActive, setReverseSearchActive] =
|
|
26923
|
-
const [commandSearchActive, setCommandSearchActive] =
|
|
26924
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] =
|
|
26925
|
-
const [cursorPosition, setCursorPosition] =
|
|
27208
|
+
const [reverseSearchActive, setReverseSearchActive] = useState21(false);
|
|
27209
|
+
const [commandSearchActive, setCommandSearchActive] = useState21(false);
|
|
27210
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = useState21("");
|
|
27211
|
+
const [cursorPosition, setCursorPosition] = useState21([
|
|
26926
27212
|
0,
|
|
26927
27213
|
0
|
|
26928
27214
|
]);
|
|
26929
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] =
|
|
27215
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = useState21(-1);
|
|
26930
27216
|
const exportCompletion = useExportCompletion(buffer, slashCommands);
|
|
26931
27217
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
26932
27218
|
const shellHistoryData = shellHistory.history;
|
|
@@ -26941,14 +27227,14 @@ var InputPrompt = ({
|
|
|
26941
27227
|
!justNavigatedHistory,
|
|
26942
27228
|
recentSlashCommands
|
|
26943
27229
|
);
|
|
26944
|
-
const midInputGhostTextRef =
|
|
27230
|
+
const midInputGhostTextRef = useRef13(null);
|
|
26945
27231
|
midInputGhostTextRef.current = completion.midInputGhostText;
|
|
26946
27232
|
const reverseSearchCompletion = useReverseSearchCompletion(
|
|
26947
27233
|
buffer,
|
|
26948
27234
|
shellHistoryData,
|
|
26949
27235
|
reverseSearchActive
|
|
26950
27236
|
);
|
|
26951
|
-
const commandSearchHistory =
|
|
27237
|
+
const commandSearchHistory = useMemo11(
|
|
26952
27238
|
() => [...userMessages].reverse(),
|
|
26953
27239
|
[userMessages]
|
|
26954
27240
|
);
|
|
@@ -26968,7 +27254,7 @@ var InputPrompt = ({
|
|
|
26968
27254
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
26969
27255
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
26970
27256
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused && !agentTabBarFocused;
|
|
26971
|
-
const resetEscapeState =
|
|
27257
|
+
const resetEscapeState = useCallback17(() => {
|
|
26972
27258
|
if (escapeTimerRef.current) {
|
|
26973
27259
|
clearTimeout(escapeTimerRef.current);
|
|
26974
27260
|
escapeTimerRef.current = null;
|
|
@@ -26976,12 +27262,12 @@ var InputPrompt = ({
|
|
|
26976
27262
|
setEscPressCount(0);
|
|
26977
27263
|
setShowEscapePrompt(false);
|
|
26978
27264
|
}, []);
|
|
26979
|
-
|
|
27265
|
+
useEffect23(() => {
|
|
26980
27266
|
if (onEscapePromptChange) {
|
|
26981
27267
|
onEscapePromptChange(showEscapePrompt);
|
|
26982
27268
|
}
|
|
26983
27269
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
26984
|
-
const nextLargePastePlaceholder =
|
|
27270
|
+
const nextLargePastePlaceholder = useCallback17((charCount) => {
|
|
26985
27271
|
const activeIds = activePlaceholderIds.current.get(charCount) || /* @__PURE__ */ new Set();
|
|
26986
27272
|
let id = 1;
|
|
26987
27273
|
while (activeIds.has(id)) {
|
|
@@ -26992,7 +27278,7 @@ var InputPrompt = ({
|
|
|
26992
27278
|
const base = `[Pasted Content ${charCount} chars]`;
|
|
26993
27279
|
return id === 1 ? base : `${base} #${id}`;
|
|
26994
27280
|
}, []);
|
|
26995
|
-
|
|
27281
|
+
useEffect23(
|
|
26996
27282
|
() => () => {
|
|
26997
27283
|
if (escapeTimerRef.current) {
|
|
26998
27284
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -27003,9 +27289,9 @@ var InputPrompt = ({
|
|
|
27003
27289
|
},
|
|
27004
27290
|
[]
|
|
27005
27291
|
);
|
|
27006
|
-
const resetHistoryNavRef =
|
|
27292
|
+
const resetHistoryNavRef = useRef13(() => {
|
|
27007
27293
|
});
|
|
27008
|
-
const handleSubmitAndClear =
|
|
27294
|
+
const handleSubmitAndClear = useCallback17(
|
|
27009
27295
|
(submittedValue) => {
|
|
27010
27296
|
exportCompletion.reset();
|
|
27011
27297
|
let finalValue = submittedValue;
|
|
@@ -27028,7 +27314,7 @@ var InputPrompt = ({
|
|
|
27028
27314
|
shellHistory.addCommandToHistory(finalValue);
|
|
27029
27315
|
}
|
|
27030
27316
|
if (attachments.length > 0) {
|
|
27031
|
-
const attachmentRefs = attachments.map((att) => `@${
|
|
27317
|
+
const attachmentRefs = attachments.map((att) => `@${path132.relative(config.getTargetDir(), att.path)}`).join(" ");
|
|
27032
27318
|
finalValue = `${attachmentRefs}
|
|
27033
27319
|
|
|
27034
27320
|
${finalValue.trim()}`;
|
|
@@ -27057,7 +27343,7 @@ ${finalValue.trim()}`;
|
|
|
27057
27343
|
followup
|
|
27058
27344
|
]
|
|
27059
27345
|
);
|
|
27060
|
-
const customSetTextAndResetCompletionSignal =
|
|
27346
|
+
const customSetTextAndResetCompletionSignal = useCallback17(
|
|
27061
27347
|
(newText) => {
|
|
27062
27348
|
buffer.setText(newText);
|
|
27063
27349
|
setJustNavigatedHistory(true);
|
|
@@ -27074,14 +27360,14 @@ ${finalValue.trim()}`;
|
|
|
27074
27360
|
onChange: customSetTextAndResetCompletionSignal
|
|
27075
27361
|
});
|
|
27076
27362
|
resetHistoryNavRef.current = inputHistory.resetHistoryNav;
|
|
27077
|
-
const prevHasAgentsRef =
|
|
27078
|
-
|
|
27363
|
+
const prevHasAgentsRef = useRef13(hasAgents);
|
|
27364
|
+
useEffect23(() => {
|
|
27079
27365
|
if (hasAgents && !prevHasAgentsRef.current) {
|
|
27080
27366
|
inputHistory.resetHistoryNav();
|
|
27081
27367
|
}
|
|
27082
27368
|
prevHasAgentsRef.current = hasAgents;
|
|
27083
27369
|
}, [hasAgents, inputHistory]);
|
|
27084
|
-
|
|
27370
|
+
useEffect23(() => {
|
|
27085
27371
|
if (justNavigatedHistory) {
|
|
27086
27372
|
resetCompletionState();
|
|
27087
27373
|
resetReverseSearchCompletionState();
|
|
@@ -27097,7 +27383,7 @@ ${finalValue.trim()}`;
|
|
|
27097
27383
|
resetReverseSearchCompletionState,
|
|
27098
27384
|
resetCommandSearchCompletionState
|
|
27099
27385
|
]);
|
|
27100
|
-
const handleClipboardImage =
|
|
27386
|
+
const handleClipboardImage = useCallback17(async (validated = false) => {
|
|
27101
27387
|
try {
|
|
27102
27388
|
const hasImage = validated || await clipboardHasImage();
|
|
27103
27389
|
if (hasImage) {
|
|
@@ -27105,7 +27391,7 @@ ${finalValue.trim()}`;
|
|
|
27105
27391
|
if (imagePath) {
|
|
27106
27392
|
cleanupOldClipboardImages(Storage.getGlobalTempDir()).catch(() => {
|
|
27107
27393
|
});
|
|
27108
|
-
const filename =
|
|
27394
|
+
const filename = path132.basename(imagePath);
|
|
27109
27395
|
const newAttachment = {
|
|
27110
27396
|
id: String(Date.now()),
|
|
27111
27397
|
path: imagePath,
|
|
@@ -27118,7 +27404,7 @@ ${finalValue.trim()}`;
|
|
|
27118
27404
|
debugLogger14.error("Error handling clipboard image:", error);
|
|
27119
27405
|
}
|
|
27120
27406
|
}, []);
|
|
27121
|
-
const handleAttachmentDelete =
|
|
27407
|
+
const handleAttachmentDelete = useCallback17((index) => {
|
|
27122
27408
|
setAttachments((prev) => {
|
|
27123
27409
|
const newList = prev.filter((_, i) => i !== index);
|
|
27124
27410
|
if (newList.length === 0) {
|
|
@@ -27130,7 +27416,7 @@ ${finalValue.trim()}`;
|
|
|
27130
27416
|
return newList;
|
|
27131
27417
|
});
|
|
27132
27418
|
}, []);
|
|
27133
|
-
const handleInput =
|
|
27419
|
+
const handleInput = useCallback17(
|
|
27134
27420
|
(key) => {
|
|
27135
27421
|
if (agentTabBarFocused || bgPillFocused) {
|
|
27136
27422
|
if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
@@ -27701,7 +27987,7 @@ ${currentText}`);
|
|
|
27701
27987
|
exportCompletion
|
|
27702
27988
|
]
|
|
27703
27989
|
);
|
|
27704
|
-
const renderLineWithHighlighting =
|
|
27990
|
+
const renderLineWithHighlighting = useCallback17(
|
|
27705
27991
|
(opts) => {
|
|
27706
27992
|
const {
|
|
27707
27993
|
lineText,
|
|
@@ -27797,12 +28083,12 @@ ${currentText}`);
|
|
|
27797
28083
|
scrollOffset: activeCompletion.visibleStartIndex
|
|
27798
28084
|
};
|
|
27799
28085
|
const shouldShowSuggestions = shouldUseExportSuggestions && exportCompletion.shouldShowSuggestions || activeCompletion.showSuggestions;
|
|
27800
|
-
|
|
28086
|
+
useEffect23(() => {
|
|
27801
28087
|
if (onSuggestionsVisibilityChange) {
|
|
27802
28088
|
onSuggestionsVisibilityChange(shouldShowSuggestions);
|
|
27803
28089
|
}
|
|
27804
28090
|
}, [shouldShowSuggestions, onSuggestionsVisibilityChange]);
|
|
27805
|
-
|
|
28091
|
+
useEffect23(() => {
|
|
27806
28092
|
followup.setSuggestion(promptSuggestion ?? null);
|
|
27807
28093
|
}, [promptSuggestion]);
|
|
27808
28094
|
const showAutoAcceptStyling = !shellModeActive && approvalMode === "auto-edit";
|
|
@@ -27972,14 +28258,14 @@ function MCPHealthPill() {
|
|
|
27972
28258
|
function useStatusLine() {
|
|
27973
28259
|
const config = useConfig();
|
|
27974
28260
|
const cwd = config.getWorkingDir();
|
|
27975
|
-
const [line, setLine] =
|
|
27976
|
-
|
|
28261
|
+
const [line, setLine] = useState222(null);
|
|
28262
|
+
useEffect24(() => {
|
|
27977
28263
|
let cancelled = false;
|
|
27978
28264
|
execFile22("git", ["branch", "--show-current"], { cwd }, (err, stdout) => {
|
|
27979
28265
|
if (cancelled) return;
|
|
27980
28266
|
const branch = err ? null : stdout.trim();
|
|
27981
28267
|
if (!branch) return;
|
|
27982
|
-
const home =
|
|
28268
|
+
const home = os5.homedir();
|
|
27983
28269
|
const displayCwd = cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd;
|
|
27984
28270
|
setLine(`${displayCwd} [${branch}]`);
|
|
27985
28271
|
});
|
|
@@ -27997,11 +28283,11 @@ var VimModeProvider = ({
|
|
|
27997
28283
|
children,
|
|
27998
28284
|
initialVimEnabled = false
|
|
27999
28285
|
}) => {
|
|
28000
|
-
const [vimEnabled, setVimEnabled] =
|
|
28001
|
-
const [vimMode, setVimMode] =
|
|
28286
|
+
const [vimEnabled, setVimEnabled] = useState23(initialVimEnabled);
|
|
28287
|
+
const [vimMode, setVimMode] = useState23(
|
|
28002
28288
|
initialVimEnabled ? "NORMAL" : "INSERT"
|
|
28003
28289
|
);
|
|
28004
|
-
const toggleVimEnabled =
|
|
28290
|
+
const toggleVimEnabled = useCallback18(async () => {
|
|
28005
28291
|
const next = !vimEnabled;
|
|
28006
28292
|
setVimEnabled(next);
|
|
28007
28293
|
setVimMode(next ? "NORMAL" : "INSERT");
|
|
@@ -28103,8 +28389,8 @@ var NUM_TIMES_QUEUE_HINT_SHOWN = 3;
|
|
|
28103
28389
|
var QueuedMessageDisplay = ({
|
|
28104
28390
|
messageQueue
|
|
28105
28391
|
}) => {
|
|
28106
|
-
const hintSeenCountRef =
|
|
28107
|
-
const wasEmptyRef =
|
|
28392
|
+
const hintSeenCountRef = useRef14(0);
|
|
28393
|
+
const wasEmptyRef = useRef14(true);
|
|
28108
28394
|
if (messageQueue.length === 0) {
|
|
28109
28395
|
wasEmptyRef.current = true;
|
|
28110
28396
|
return null;
|
|
@@ -28237,12 +28523,12 @@ var Composer = () => {
|
|
|
28237
28523
|
}
|
|
28238
28524
|
}
|
|
28239
28525
|
}
|
|
28240
|
-
const [showShortcuts, setShowShortcuts] =
|
|
28241
|
-
const handleToggleShortcuts =
|
|
28526
|
+
const [showShortcuts, setShowShortcuts] = useState24(false);
|
|
28527
|
+
const handleToggleShortcuts = useCallback19(() => {
|
|
28242
28528
|
setShowShortcuts((prev) => !prev);
|
|
28243
28529
|
}, []);
|
|
28244
|
-
const [showSuggestions, setShowSuggestions] =
|
|
28245
|
-
const handleSuggestionsVisibilityChange =
|
|
28530
|
+
const [showSuggestions, setShowSuggestions] = useState24(false);
|
|
28531
|
+
const handleSuggestionsVisibilityChange = useCallback19(
|
|
28246
28532
|
(visible) => {
|
|
28247
28533
|
setShowSuggestions(visible);
|
|
28248
28534
|
uiActions.onSuggestionsVisibilityChange(visible);
|
|
@@ -28541,84 +28827,7 @@ var compactCommand = {
|
|
|
28541
28827
|
await context.ui.compact();
|
|
28542
28828
|
}
|
|
28543
28829
|
};
|
|
28544
|
-
var
|
|
28545
|
-
var PACKAGE_NAME = "deepcode-ai";
|
|
28546
|
-
function cachePath() {
|
|
28547
|
-
const cacheHome = process.env["XDG_CACHE_HOME"] ?? path132.join(os5.homedir(), ".cache");
|
|
28548
|
-
return path132.join(cacheHome, "deepcode-ai", "update.json");
|
|
28549
|
-
}
|
|
28550
|
-
function readCache() {
|
|
28551
|
-
try {
|
|
28552
|
-
const raw = fs6.readFileSync(cachePath(), "utf8");
|
|
28553
|
-
const parsed = JSON.parse(raw);
|
|
28554
|
-
if (typeof parsed.checkedAt !== "number" || typeof parsed.latest !== "string" || Date.now() - parsed.checkedAt >= CACHE_TTL_MS) {
|
|
28555
|
-
return null;
|
|
28556
|
-
}
|
|
28557
|
-
return {
|
|
28558
|
-
checkedAt: parsed.checkedAt,
|
|
28559
|
-
latest: parsed.latest,
|
|
28560
|
-
stable: typeof parsed.stable === "string" ? parsed.stable : null
|
|
28561
|
-
};
|
|
28562
|
-
} catch {
|
|
28563
|
-
return null;
|
|
28564
|
-
}
|
|
28565
|
-
}
|
|
28566
|
-
function writeCache(cache) {
|
|
28567
|
-
try {
|
|
28568
|
-
const filePath = cachePath();
|
|
28569
|
-
fs6.mkdirSync(path132.dirname(filePath), { recursive: true });
|
|
28570
|
-
fs6.writeFileSync(filePath, `${JSON.stringify(cache)}
|
|
28571
|
-
`, "utf8");
|
|
28572
|
-
} catch {
|
|
28573
|
-
}
|
|
28574
|
-
}
|
|
28575
|
-
async function checkForUpdate(_currentVersion, options = {}) {
|
|
28576
|
-
if (process.env["CI"] || process.env["NODE_ENV"] === "test" || process.env["DEEPCODE_DISABLE_UPDATE_CHECK"] === "1") {
|
|
28577
|
-
return null;
|
|
28578
|
-
}
|
|
28579
|
-
if (!options.force) {
|
|
28580
|
-
const cached = readCache();
|
|
28581
|
-
if (cached) {
|
|
28582
|
-
return { latest: cached.latest, stable: cached.stable };
|
|
28583
|
-
}
|
|
28584
|
-
}
|
|
28585
|
-
try {
|
|
28586
|
-
const response = await fetch(
|
|
28587
|
-
`https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`,
|
|
28588
|
-
{ signal: AbortSignal.timeout(3e3) }
|
|
28589
|
-
);
|
|
28590
|
-
if (!response.ok) return null;
|
|
28591
|
-
const tags = await response.json();
|
|
28592
|
-
const latest = tags["latest"];
|
|
28593
|
-
if (typeof latest !== "string" || latest.length === 0) return null;
|
|
28594
|
-
const stable = typeof tags["stable"] === "string" && tags["stable"].length > 0 ? tags["stable"] : null;
|
|
28595
|
-
const update = { latest, stable };
|
|
28596
|
-
writeCache({ ...update, checkedAt: Date.now() });
|
|
28597
|
-
return update;
|
|
28598
|
-
} catch {
|
|
28599
|
-
return null;
|
|
28600
|
-
}
|
|
28601
|
-
}
|
|
28602
|
-
function isNewer(current, candidate) {
|
|
28603
|
-
const currentParts = parseVersion2(current);
|
|
28604
|
-
const candidateParts = parseVersion2(candidate);
|
|
28605
|
-
if (!currentParts || !candidateParts) return false;
|
|
28606
|
-
for (let index = 0; index < 3; index += 1) {
|
|
28607
|
-
const currentPart = currentParts[index] ?? 0;
|
|
28608
|
-
const candidatePart = candidateParts[index] ?? 0;
|
|
28609
|
-
if (candidatePart !== currentPart) {
|
|
28610
|
-
return candidatePart > currentPart;
|
|
28611
|
-
}
|
|
28612
|
-
}
|
|
28613
|
-
return false;
|
|
28614
|
-
}
|
|
28615
|
-
function parseVersion2(version) {
|
|
28616
|
-
const match = version.trim().match(/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/);
|
|
28617
|
-
if (!match) return null;
|
|
28618
|
-
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
28619
|
-
}
|
|
28620
|
-
var VERSION = "1.2.8".length > 0 ? "1.2.8" : "0.0.0-dev";
|
|
28621
|
-
var updateCommand = {
|
|
28830
|
+
var updateCommand2 = {
|
|
28622
28831
|
name: "update",
|
|
28623
28832
|
description: "Check published DeepCode versions",
|
|
28624
28833
|
kind: "built-in",
|
|
@@ -28853,9 +29062,9 @@ var CommandDialog = ({
|
|
|
28853
29062
|
/* @__PURE__ */ jsx42(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx42(Text41, { color: theme.text.secondary, children: footerText }) })
|
|
28854
29063
|
] }) });
|
|
28855
29064
|
var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
28856
|
-
const originalTheme =
|
|
28857
|
-
const available =
|
|
28858
|
-
const items =
|
|
29065
|
+
const originalTheme = useRef15(themeManager.getActiveTheme().name);
|
|
29066
|
+
const available = useMemo12(() => themeManager.getAvailableThemes(), []);
|
|
29067
|
+
const items = useMemo12(
|
|
28859
29068
|
() => available.map((entry) => ({
|
|
28860
29069
|
key: entry.name,
|
|
28861
29070
|
value: entry.name,
|
|
@@ -28869,7 +29078,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
28869
29078
|
0,
|
|
28870
29079
|
available.findIndex((entry) => entry.name === originalTheme.current)
|
|
28871
29080
|
);
|
|
28872
|
-
const handleEscape =
|
|
29081
|
+
const handleEscape = useCallback20(
|
|
28873
29082
|
(key) => {
|
|
28874
29083
|
if (key.name === "escape") {
|
|
28875
29084
|
themeManager.setActiveTheme(originalTheme.current);
|
|
@@ -28880,7 +29089,7 @@ var ThemeDialog = ({ onSelect, onClose, onPreview }) => {
|
|
|
28880
29089
|
[onClose, onPreview]
|
|
28881
29090
|
);
|
|
28882
29091
|
useKeypress(handleEscape, { isActive: true });
|
|
28883
|
-
const handleHighlight =
|
|
29092
|
+
const handleHighlight = useCallback20(
|
|
28884
29093
|
(themeName) => {
|
|
28885
29094
|
themeManager.setActiveTheme(themeName);
|
|
28886
29095
|
onPreview();
|
|
@@ -28945,17 +29154,17 @@ var ProviderDialog = ({
|
|
|
28945
29154
|
onTestProvider,
|
|
28946
29155
|
onClose
|
|
28947
29156
|
}) => {
|
|
28948
|
-
const [phase, setPhase] =
|
|
28949
|
-
const [selectedProvider, setSelectedProvider] =
|
|
28950
|
-
const [apiKeyInput, setApiKeyInput] =
|
|
28951
|
-
const [isBusy, setIsBusy] =
|
|
28952
|
-
const [status, setStatus] =
|
|
28953
|
-
const [testLatencyMs, setTestLatencyMs] =
|
|
29157
|
+
const [phase, setPhase] = useState25("providers");
|
|
29158
|
+
const [selectedProvider, setSelectedProvider] = useState25(currentProvider);
|
|
29159
|
+
const [apiKeyInput, setApiKeyInput] = useState25("");
|
|
29160
|
+
const [isBusy, setIsBusy] = useState25(false);
|
|
29161
|
+
const [status, setStatus] = useState25(null);
|
|
29162
|
+
const [testLatencyMs, setTestLatencyMs] = useState25(void 0);
|
|
28954
29163
|
const isLocal = CREDENTIAL_FREE_PROVIDERS.has(selectedProvider);
|
|
28955
29164
|
const keyIsSet = hasApiKey(selectedProvider);
|
|
28956
29165
|
const keyHint = getProviderKeyHint(selectedProvider);
|
|
28957
29166
|
const canTest = keyIsSet || isLocal;
|
|
28958
|
-
const providerItems =
|
|
29167
|
+
const providerItems = useMemo13(
|
|
28959
29168
|
() => providers.map((p) => ({
|
|
28960
29169
|
key: p,
|
|
28961
29170
|
value: p,
|
|
@@ -28966,7 +29175,7 @@ var ProviderDialog = ({
|
|
|
28966
29175
|
})),
|
|
28967
29176
|
[currentProvider, hasApiKey, providers]
|
|
28968
29177
|
);
|
|
28969
|
-
const actionItems =
|
|
29178
|
+
const actionItems = useMemo13(
|
|
28970
29179
|
() => [
|
|
28971
29180
|
{
|
|
28972
29181
|
key: "use",
|
|
@@ -29009,7 +29218,7 @@ var ProviderDialog = ({
|
|
|
29009
29218
|
],
|
|
29010
29219
|
[canTest, currentProvider, isLocal, selectedProvider]
|
|
29011
29220
|
);
|
|
29012
|
-
const selectProvider =
|
|
29221
|
+
const selectProvider = useCallback21(
|
|
29013
29222
|
(provider) => {
|
|
29014
29223
|
setSelectedProvider(provider);
|
|
29015
29224
|
setStatus(null);
|
|
@@ -29018,7 +29227,7 @@ var ProviderDialog = ({
|
|
|
29018
29227
|
},
|
|
29019
29228
|
[]
|
|
29020
29229
|
);
|
|
29021
|
-
const runTest =
|
|
29230
|
+
const runTest = useCallback21(async () => {
|
|
29022
29231
|
setIsBusy(true);
|
|
29023
29232
|
setTestLatencyMs(void 0);
|
|
29024
29233
|
setStatus({ text: `Testing ${selectedProvider}\u2026`, ok: true });
|
|
@@ -29040,7 +29249,7 @@ var ProviderDialog = ({
|
|
|
29040
29249
|
setIsBusy(false);
|
|
29041
29250
|
}
|
|
29042
29251
|
}, [onTestProvider, selectedProvider]);
|
|
29043
|
-
const selectAction =
|
|
29252
|
+
const selectAction = useCallback21(
|
|
29044
29253
|
(action) => {
|
|
29045
29254
|
if (isBusy) return;
|
|
29046
29255
|
if (action === "editKey") {
|
|
@@ -29081,7 +29290,7 @@ var ProviderDialog = ({
|
|
|
29081
29290
|
},
|
|
29082
29291
|
[isBusy, onClose, onSelectProvider, onSetDefaultProvider, runTest, selectedProvider]
|
|
29083
29292
|
);
|
|
29084
|
-
const saveApiKey =
|
|
29293
|
+
const saveApiKey = useCallback21(async () => {
|
|
29085
29294
|
const normalized2 = apiKeyInput.trim();
|
|
29086
29295
|
if (!normalized2) {
|
|
29087
29296
|
setStatus({ text: "Type a key before saving.", ok: false });
|
|
@@ -29267,12 +29476,12 @@ var PermissionsDialog = ({
|
|
|
29267
29476
|
onSave,
|
|
29268
29477
|
onClose
|
|
29269
29478
|
}) => {
|
|
29270
|
-
const [modes, setModes] =
|
|
29271
|
-
const dirty =
|
|
29479
|
+
const [modes, setModes] = useState26(current);
|
|
29480
|
+
const dirty = useMemo14(
|
|
29272
29481
|
() => PERMISSION_KEYS.some((key) => modes[key] !== current[key]),
|
|
29273
29482
|
[modes, current]
|
|
29274
29483
|
);
|
|
29275
|
-
const items =
|
|
29484
|
+
const items = useMemo14(() => {
|
|
29276
29485
|
const rows = PERMISSION_KEYS.map((key) => ({
|
|
29277
29486
|
key,
|
|
29278
29487
|
value: key,
|
|
@@ -29282,7 +29491,7 @@ var PermissionsDialog = ({
|
|
|
29282
29491
|
rows.push({ key: CANCEL_VALUE, value: CANCEL_VALUE, label: "Cancel" });
|
|
29283
29492
|
return rows;
|
|
29284
29493
|
}, [modes, dirty]);
|
|
29285
|
-
const handleSelect =
|
|
29494
|
+
const handleSelect = useCallback22(
|
|
29286
29495
|
(value) => {
|
|
29287
29496
|
if (value === SAVE_VALUE) {
|
|
29288
29497
|
onSave(modes);
|
|
@@ -29297,7 +29506,7 @@ var PermissionsDialog = ({
|
|
|
29297
29506
|
},
|
|
29298
29507
|
[modes, onClose, onSave]
|
|
29299
29508
|
);
|
|
29300
|
-
const handleEscape =
|
|
29509
|
+
const handleEscape = useCallback22(
|
|
29301
29510
|
(key) => {
|
|
29302
29511
|
if (key.name === "escape") {
|
|
29303
29512
|
onClose();
|
|
@@ -29333,11 +29542,11 @@ var AuthDialog = ({
|
|
|
29333
29542
|
onPersistToken,
|
|
29334
29543
|
onClose
|
|
29335
29544
|
}) => {
|
|
29336
|
-
const [phase, setPhase] =
|
|
29337
|
-
const [deviceCode, setDeviceCode] =
|
|
29338
|
-
const [message, setMessage] =
|
|
29339
|
-
const abortRef =
|
|
29340
|
-
const items =
|
|
29545
|
+
const [phase, setPhase] = useState27("menu");
|
|
29546
|
+
const [deviceCode, setDeviceCode] = useState27(null);
|
|
29547
|
+
const [message, setMessage] = useState27("");
|
|
29548
|
+
const abortRef = useRef16(null);
|
|
29549
|
+
const items = useMemo15(
|
|
29341
29550
|
() => [
|
|
29342
29551
|
{ key: "login", value: "login", label: "Login with GitHub" },
|
|
29343
29552
|
{ key: "clear", value: "clear", label: "Clear stored token", disabled: !hasToken },
|
|
@@ -29345,7 +29554,7 @@ var AuthDialog = ({
|
|
|
29345
29554
|
],
|
|
29346
29555
|
[hasToken]
|
|
29347
29556
|
);
|
|
29348
|
-
const startLogin =
|
|
29557
|
+
const startLogin = useCallback23(async () => {
|
|
29349
29558
|
if (!clientId) {
|
|
29350
29559
|
setMessage(
|
|
29351
29560
|
"No OAuth client configured. Set github.oauthClientId in .deepcode/config.json, or run `deepcode github login` in a terminal."
|
|
@@ -29389,7 +29598,7 @@ var AuthDialog = ({
|
|
|
29389
29598
|
abortRef.current = null;
|
|
29390
29599
|
}
|
|
29391
29600
|
}, [clientId, enterpriseUrl, onPersistToken, scopes, worktree]);
|
|
29392
|
-
const clearToken =
|
|
29601
|
+
const clearToken = useCallback23(async () => {
|
|
29393
29602
|
try {
|
|
29394
29603
|
await onPersistToken(void 0);
|
|
29395
29604
|
setPhase("done");
|
|
@@ -29399,7 +29608,7 @@ var AuthDialog = ({
|
|
|
29399
29608
|
setMessage(error instanceof Error ? error.message : String(error));
|
|
29400
29609
|
}
|
|
29401
29610
|
}, [onPersistToken]);
|
|
29402
|
-
const handleSelect =
|
|
29611
|
+
const handleSelect = useCallback23(
|
|
29403
29612
|
(value) => {
|
|
29404
29613
|
if (value === "login") {
|
|
29405
29614
|
void startLogin();
|
|
@@ -29411,10 +29620,10 @@ var AuthDialog = ({
|
|
|
29411
29620
|
},
|
|
29412
29621
|
[clearToken, onClose, startLogin]
|
|
29413
29622
|
);
|
|
29414
|
-
|
|
29623
|
+
useEffect25(() => () => {
|
|
29415
29624
|
abortRef.current?.abort();
|
|
29416
29625
|
}, []);
|
|
29417
|
-
const handleEscape =
|
|
29626
|
+
const handleEscape = useCallback23(
|
|
29418
29627
|
(key) => {
|
|
29419
29628
|
if (key.name !== "escape") return;
|
|
29420
29629
|
if (phase === "running") {
|
|
@@ -29507,13 +29716,13 @@ var ModelDialog = ({
|
|
|
29507
29716
|
onSelectModel,
|
|
29508
29717
|
onClose
|
|
29509
29718
|
}) => {
|
|
29510
|
-
const [loadState, setLoadState] =
|
|
29511
|
-
const [models, setModels] =
|
|
29512
|
-
const [errorMsg, setErrorMsg] =
|
|
29513
|
-
const [search, setSearch] =
|
|
29514
|
-
const [activeSelIndex, setActiveSelIndex] =
|
|
29515
|
-
const abortRef =
|
|
29516
|
-
|
|
29719
|
+
const [loadState, setLoadState] = useState28("loading");
|
|
29720
|
+
const [models, setModels] = useState28([]);
|
|
29721
|
+
const [errorMsg, setErrorMsg] = useState28("");
|
|
29722
|
+
const [search, setSearch] = useState28("");
|
|
29723
|
+
const [activeSelIndex, setActiveSelIndex] = useState28(0);
|
|
29724
|
+
const abortRef = useRef17(null);
|
|
29725
|
+
useEffect26(() => {
|
|
29517
29726
|
const ctrl = new AbortController();
|
|
29518
29727
|
abortRef.current = ctrl;
|
|
29519
29728
|
onFetchModels(currentProvider, ctrl.signal).then((fetched) => {
|
|
@@ -29527,25 +29736,25 @@ var ModelDialog = ({
|
|
|
29527
29736
|
});
|
|
29528
29737
|
return () => ctrl.abort();
|
|
29529
29738
|
}, [currentProvider, onFetchModels]);
|
|
29530
|
-
const rows =
|
|
29739
|
+
const rows = useMemo16(
|
|
29531
29740
|
() => buildRows(models, currentModel, search),
|
|
29532
29741
|
[models, currentModel, search]
|
|
29533
29742
|
);
|
|
29534
29743
|
const selectableCount = rows.filter((r) => r.kind === "item").length;
|
|
29535
29744
|
const clampedIndex = Math.min(activeSelIndex, Math.max(0, selectableCount - 1));
|
|
29536
|
-
|
|
29745
|
+
useEffect26(() => {
|
|
29537
29746
|
setActiveSelIndex(0);
|
|
29538
29747
|
}, [search]);
|
|
29539
|
-
const activeRowPos =
|
|
29748
|
+
const activeRowPos = useMemo16(
|
|
29540
29749
|
() => rows.findIndex((r) => r.kind === "item" && r.selIndex === clampedIndex),
|
|
29541
29750
|
[rows, clampedIndex]
|
|
29542
29751
|
);
|
|
29543
|
-
const scrollTop =
|
|
29752
|
+
const scrollTop = useMemo16(
|
|
29544
29753
|
() => Math.max(0, Math.min(activeRowPos - 4, rows.length - MAX_VISIBLE)),
|
|
29545
29754
|
[activeRowPos, rows.length]
|
|
29546
29755
|
);
|
|
29547
29756
|
const visibleRows = rows.slice(scrollTop, scrollTop + MAX_VISIBLE);
|
|
29548
|
-
const confirm =
|
|
29757
|
+
const confirm = useCallback24(() => {
|
|
29549
29758
|
const row = rows.find((r) => r.kind === "item" && r.selIndex === clampedIndex);
|
|
29550
29759
|
if (row?.kind === "item") onSelectModel(row.model.id);
|
|
29551
29760
|
}, [rows, clampedIndex, onSelectModel]);
|
|
@@ -29708,7 +29917,7 @@ function appendFeedbackEntry(cwd, rating, label) {
|
|
|
29708
29917
|
}
|
|
29709
29918
|
}
|
|
29710
29919
|
var FeedbackDialog = ({ cwd, onClose }) => {
|
|
29711
|
-
const items =
|
|
29920
|
+
const items = useMemo17(
|
|
29712
29921
|
() => [
|
|
29713
29922
|
...RATINGS.map(({ rating, label }) => ({
|
|
29714
29923
|
key: String(rating),
|
|
@@ -29719,7 +29928,7 @@ var FeedbackDialog = ({ cwd, onClose }) => {
|
|
|
29719
29928
|
],
|
|
29720
29929
|
[]
|
|
29721
29930
|
);
|
|
29722
|
-
const handleSelect =
|
|
29931
|
+
const handleSelect = useCallback25(
|
|
29723
29932
|
(value) => {
|
|
29724
29933
|
if (value !== CANCEL_VALUE2) {
|
|
29725
29934
|
const opt = RATINGS.find((r) => String(r.rating) === value);
|
|
@@ -29729,7 +29938,7 @@ var FeedbackDialog = ({ cwd, onClose }) => {
|
|
|
29729
29938
|
},
|
|
29730
29939
|
[cwd, onClose]
|
|
29731
29940
|
);
|
|
29732
|
-
const handleEscape =
|
|
29941
|
+
const handleEscape = useCallback25(
|
|
29733
29942
|
(key) => {
|
|
29734
29943
|
if (key.name === "escape") onClose();
|
|
29735
29944
|
},
|
|
@@ -29760,11 +29969,11 @@ function sessionLabel2(session) {
|
|
|
29760
29969
|
return name ?? firstUser?.content?.slice(0, 55) ?? "(no messages)";
|
|
29761
29970
|
}
|
|
29762
29971
|
var SessionsDialog = ({ cwd, onSelect, onClose }) => {
|
|
29763
|
-
const [loadState, setLoadState] =
|
|
29764
|
-
const [allSessions, setAllSessions] =
|
|
29765
|
-
const [search, setSearch] =
|
|
29766
|
-
const [activeIndex, setActiveIndex] =
|
|
29767
|
-
|
|
29972
|
+
const [loadState, setLoadState] = useState29("loading");
|
|
29973
|
+
const [allSessions, setAllSessions] = useState29([]);
|
|
29974
|
+
const [search, setSearch] = useState29("");
|
|
29975
|
+
const [activeIndex, setActiveIndex] = useState29(0);
|
|
29976
|
+
useEffect27(() => {
|
|
29768
29977
|
const manager = new SessionManager(cwd);
|
|
29769
29978
|
manager.loadAll().then((loaded) => {
|
|
29770
29979
|
const sorted = [...loaded].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
@@ -29772,21 +29981,21 @@ var SessionsDialog = ({ cwd, onSelect, onClose }) => {
|
|
|
29772
29981
|
setLoadState("ready");
|
|
29773
29982
|
}).catch(() => setLoadState("error"));
|
|
29774
29983
|
}, [cwd]);
|
|
29775
|
-
|
|
29984
|
+
useEffect27(() => {
|
|
29776
29985
|
setActiveIndex(0);
|
|
29777
29986
|
}, [search]);
|
|
29778
|
-
const sessions =
|
|
29987
|
+
const sessions = useMemo18(() => {
|
|
29779
29988
|
if (!search) return allSessions;
|
|
29780
29989
|
const q = search.toLowerCase();
|
|
29781
29990
|
return allSessions.filter((s) => sessionLabel2(s).toLowerCase().includes(q));
|
|
29782
29991
|
}, [allSessions, search]);
|
|
29783
29992
|
const clampedIndex = Math.min(activeIndex, Math.max(0, sessions.length - 1));
|
|
29784
|
-
const scrollTop =
|
|
29993
|
+
const scrollTop = useMemo18(
|
|
29785
29994
|
() => Math.max(0, Math.min(clampedIndex - Math.floor(MAX_VISIBLE2 / 2), sessions.length - MAX_VISIBLE2)),
|
|
29786
29995
|
[clampedIndex, sessions.length]
|
|
29787
29996
|
);
|
|
29788
29997
|
const visibleSessions = sessions.slice(scrollTop, scrollTop + MAX_VISIBLE2);
|
|
29789
|
-
const confirm =
|
|
29998
|
+
const confirm = useCallback26(() => {
|
|
29790
29999
|
const session = sessions[clampedIndex];
|
|
29791
30000
|
if (session) onSelect(session.id);
|
|
29792
30001
|
}, [sessions, clampedIndex, onSelect]);
|
|
@@ -30209,79 +30418,79 @@ var APPROVAL_ENTER_ARM_DELAY_MS = 350;
|
|
|
30209
30418
|
var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
30210
30419
|
const historyManager = useHistory();
|
|
30211
30420
|
const addHistoryItem = historyManager.addItem;
|
|
30212
|
-
const [initError, setInitError] =
|
|
30213
|
-
const [isInitializing, setIsInitializing] =
|
|
30214
|
-
const [isRunning, setIsRunning] =
|
|
30215
|
-
const [pendingAssistantText, setPendingAssistantText] =
|
|
30216
|
-
const [approvalQueue, setApprovalQueue] =
|
|
30217
|
-
const [providerLabel, setProviderLabel] =
|
|
30218
|
-
const [targetSource, setTargetSource] =
|
|
30219
|
-
const [currentModel, setCurrentModel] =
|
|
30220
|
-
const [agentMode, setAgentMode] =
|
|
30221
|
-
const [streamingState, setStreamingState] =
|
|
30421
|
+
const [initError, setInitError] = useState30(null);
|
|
30422
|
+
const [isInitializing, setIsInitializing] = useState30(true);
|
|
30423
|
+
const [isRunning, setIsRunning] = useState30(false);
|
|
30424
|
+
const [pendingAssistantText, setPendingAssistantText] = useState30("");
|
|
30425
|
+
const [approvalQueue, setApprovalQueue] = useState30([]);
|
|
30426
|
+
const [providerLabel, setProviderLabel] = useState30("(unconfigured)");
|
|
30427
|
+
const [targetSource, setTargetSource] = useState30("config");
|
|
30428
|
+
const [currentModel, setCurrentModel] = useState30("(unconfigured)");
|
|
30429
|
+
const [agentMode, setAgentMode] = useState30("build");
|
|
30430
|
+
const [streamingState, setStreamingState] = useState30(
|
|
30222
30431
|
"idle"
|
|
30223
30432
|
/* Idle */
|
|
30224
30433
|
);
|
|
30225
|
-
const [compactMode, setCompactMode] =
|
|
30226
|
-
const [shellModeActive, setShellModeActive] =
|
|
30227
|
-
const [showEscapePrompt, setShowEscapePrompt] =
|
|
30228
|
-
const [messageQueue, setMessageQueue] =
|
|
30229
|
-
const [historyRemountKey, setHistoryRemountKey] =
|
|
30230
|
-
const [pendingItem, setPendingItem] =
|
|
30231
|
-
const [lastPromptTokenCount, setLastPromptTokenCount] =
|
|
30232
|
-
const [lastOutputTokenCount, setLastOutputTokenCount] =
|
|
30233
|
-
const [elapsedTime, setElapsedTime] =
|
|
30234
|
-
const [isReceivingContent, setIsReceivingContent] =
|
|
30235
|
-
const [iterationInfo, setIterationInfo] =
|
|
30236
|
-
const [liveToolCalls, setLiveToolCalls] =
|
|
30237
|
-
const [taskPlan, setTaskPlan] =
|
|
30238
|
-
const [taskStreams, setTaskStreams] =
|
|
30239
|
-
const [recentSlashCommandsState, setRecentSlashCommandsState] =
|
|
30240
|
-
const [activeDialog, setActiveDialog] =
|
|
30241
|
-
const [themeName, setThemeName] =
|
|
30242
|
-
const [permissionSummary, setPermissionSummary] =
|
|
30243
|
-
const [authSummary, setAuthSummary] =
|
|
30244
|
-
const [permissionModes, setPermissionModes] =
|
|
30434
|
+
const [compactMode, setCompactMode] = useState30(true);
|
|
30435
|
+
const [shellModeActive, setShellModeActive] = useState30(false);
|
|
30436
|
+
const [showEscapePrompt, setShowEscapePrompt] = useState30(false);
|
|
30437
|
+
const [messageQueue, setMessageQueue] = useState30([]);
|
|
30438
|
+
const [historyRemountKey, setHistoryRemountKey] = useState30(0);
|
|
30439
|
+
const [pendingItem, setPendingItem] = useState30(null);
|
|
30440
|
+
const [lastPromptTokenCount, setLastPromptTokenCount] = useState30(0);
|
|
30441
|
+
const [lastOutputTokenCount, setLastOutputTokenCount] = useState30(0);
|
|
30442
|
+
const [elapsedTime, setElapsedTime] = useState30(0);
|
|
30443
|
+
const [isReceivingContent, setIsReceivingContent] = useState30(false);
|
|
30444
|
+
const [iterationInfo, setIterationInfo] = useState30(null);
|
|
30445
|
+
const [liveToolCalls, setLiveToolCalls] = useState30([]);
|
|
30446
|
+
const [taskPlan, setTaskPlan] = useState30(null);
|
|
30447
|
+
const [taskStreams, setTaskStreams] = useState30({});
|
|
30448
|
+
const [recentSlashCommandsState, setRecentSlashCommandsState] = useState30(/* @__PURE__ */ new Map());
|
|
30449
|
+
const [activeDialog, setActiveDialog] = useState30(null);
|
|
30450
|
+
const [themeName, setThemeName] = useState30("(unknown)");
|
|
30451
|
+
const [permissionSummary, setPermissionSummary] = useState30("(unknown)");
|
|
30452
|
+
const [authSummary, setAuthSummary] = useState30("(unknown)");
|
|
30453
|
+
const [permissionModes, setPermissionModes] = useState30({
|
|
30245
30454
|
read: "allow",
|
|
30246
30455
|
write: "ask",
|
|
30247
30456
|
gitLocal: "allow",
|
|
30248
30457
|
shell: "ask",
|
|
30249
30458
|
dangerous: "ask"
|
|
30250
30459
|
});
|
|
30251
|
-
const [providerConfigVersion, setProviderConfigVersion] =
|
|
30252
|
-
const [, setThemeVersion] =
|
|
30253
|
-
const [mcpConnected, setMcpConnected] =
|
|
30254
|
-
const [mcpTotal, setMcpTotal] =
|
|
30255
|
-
const [subagentMap, setSubagentMap] =
|
|
30256
|
-
const [, setDrainTick] =
|
|
30257
|
-
const [pendingCommandConfirmation, setPendingCommandConfirmation] =
|
|
30258
|
-
const runtimeRef =
|
|
30259
|
-
const sessionRef =
|
|
30260
|
-
const configAdapterRef =
|
|
30261
|
-
const abortRef =
|
|
30262
|
-
const unsubscribeRef =
|
|
30263
|
-
const lastSubmittedPromptRef =
|
|
30264
|
-
const runStartedAtRef =
|
|
30265
|
-
const streamingResponseLengthRef =
|
|
30266
|
-
const pendingTextBufferRef =
|
|
30267
|
-
const taskStreamsBufferRef =
|
|
30268
|
-
const liveToolCallsBufferRef =
|
|
30269
|
-
const subagentChunkBufferRef =
|
|
30270
|
-
const subagentToolBufferRef =
|
|
30271
|
-
const drainingQueueRef =
|
|
30272
|
-
const messageQueueRef =
|
|
30273
|
-
const sessionShellAllowlistRef =
|
|
30274
|
-
const mainControlsRef =
|
|
30275
|
-
const approvalPromptVisibleAtRef =
|
|
30460
|
+
const [providerConfigVersion, setProviderConfigVersion] = useState30(0);
|
|
30461
|
+
const [, setThemeVersion] = useState30(0);
|
|
30462
|
+
const [mcpConnected, setMcpConnected] = useState30(0);
|
|
30463
|
+
const [mcpTotal, setMcpTotal] = useState30(0);
|
|
30464
|
+
const [subagentMap, setSubagentMap] = useState30(/* @__PURE__ */ new Map());
|
|
30465
|
+
const [, setDrainTick] = useState30(0);
|
|
30466
|
+
const [pendingCommandConfirmation, setPendingCommandConfirmation] = useState30(null);
|
|
30467
|
+
const runtimeRef = useRef18(null);
|
|
30468
|
+
const sessionRef = useRef18(null);
|
|
30469
|
+
const configAdapterRef = useRef18(null);
|
|
30470
|
+
const abortRef = useRef18(null);
|
|
30471
|
+
const unsubscribeRef = useRef18([]);
|
|
30472
|
+
const lastSubmittedPromptRef = useRef18(null);
|
|
30473
|
+
const runStartedAtRef = useRef18(null);
|
|
30474
|
+
const streamingResponseLengthRef = useRef18(0);
|
|
30475
|
+
const pendingTextBufferRef = useRef18("");
|
|
30476
|
+
const taskStreamsBufferRef = useRef18({});
|
|
30477
|
+
const liveToolCallsBufferRef = useRef18([]);
|
|
30478
|
+
const subagentChunkBufferRef = useRef18(/* @__PURE__ */ new Map());
|
|
30479
|
+
const subagentToolBufferRef = useRef18([]);
|
|
30480
|
+
const drainingQueueRef = useRef18(false);
|
|
30481
|
+
const messageQueueRef = useRef18([]);
|
|
30482
|
+
const sessionShellAllowlistRef = useRef18(/* @__PURE__ */ new Set());
|
|
30483
|
+
const mainControlsRef = useRef18(null);
|
|
30484
|
+
const approvalPromptVisibleAtRef = useRef18(null);
|
|
30276
30485
|
const { stdin, setRawMode } = useStdin3();
|
|
30277
30486
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
30278
30487
|
const mainAreaWidth = Math.min(Math.max(terminalWidth - 4, 20), 120);
|
|
30279
|
-
const promptWidths =
|
|
30488
|
+
const promptWidths = useMemo19(
|
|
30280
30489
|
() => calculatePromptWidths(terminalWidth),
|
|
30281
30490
|
[terminalWidth]
|
|
30282
30491
|
);
|
|
30283
30492
|
const bufferViewportHeight = Math.max(3, Math.min(8, terminalHeight - 10));
|
|
30284
|
-
const loadedSettings =
|
|
30493
|
+
const loadedSettings = useMemo19(
|
|
30285
30494
|
() => ({
|
|
30286
30495
|
merged: {
|
|
30287
30496
|
general: { vimMode: false },
|
|
@@ -30293,7 +30502,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30293
30502
|
[]
|
|
30294
30503
|
);
|
|
30295
30504
|
const configAdapter = configAdapterRef.current ?? new DeepCodeConfigAdapter(cwd);
|
|
30296
|
-
const isValidPath =
|
|
30505
|
+
const isValidPath = useCallback27(
|
|
30297
30506
|
(candidate) => {
|
|
30298
30507
|
const resolved = path15.resolve(cwd, candidate);
|
|
30299
30508
|
const relative2 = path15.relative(cwd, resolved);
|
|
@@ -30311,15 +30520,15 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30311
30520
|
isValidPath,
|
|
30312
30521
|
shellModeActive
|
|
30313
30522
|
});
|
|
30314
|
-
const pendingGeminiHistoryItems =
|
|
30523
|
+
const pendingGeminiHistoryItems = useMemo19(
|
|
30315
30524
|
() => pendingAssistantText ? [{ type: "gemini", text: pendingAssistantText }] : [],
|
|
30316
30525
|
[pendingAssistantText]
|
|
30317
30526
|
);
|
|
30318
|
-
const userMessages =
|
|
30527
|
+
const userMessages = useMemo19(
|
|
30319
30528
|
() => historyManager.history.filter((item) => item.type === "user").map((item) => item.text),
|
|
30320
30529
|
[historyManager.history]
|
|
30321
30530
|
);
|
|
30322
|
-
const slashCommands =
|
|
30531
|
+
const slashCommands = useMemo19(
|
|
30323
30532
|
() => [
|
|
30324
30533
|
helpCommand,
|
|
30325
30534
|
clearCommand,
|
|
@@ -30330,7 +30539,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30330
30539
|
modelCommand,
|
|
30331
30540
|
modeCommand,
|
|
30332
30541
|
renameCommand,
|
|
30333
|
-
|
|
30542
|
+
updateCommand2,
|
|
30334
30543
|
settingsDialogCommand,
|
|
30335
30544
|
themeDialogCommand,
|
|
30336
30545
|
permissionsDialogCommand,
|
|
@@ -30340,13 +30549,13 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30340
30549
|
],
|
|
30341
30550
|
[]
|
|
30342
30551
|
);
|
|
30343
|
-
const recentSlashCommands =
|
|
30552
|
+
const recentSlashCommands = useMemo19(
|
|
30344
30553
|
() => recentSlashCommandsState,
|
|
30345
30554
|
[recentSlashCommandsState]
|
|
30346
30555
|
);
|
|
30347
|
-
const [promptSuggestion, setPromptSuggestion] =
|
|
30348
|
-
const dismissPromptSuggestion =
|
|
30349
|
-
const registerSlashCommandUsage =
|
|
30556
|
+
const [promptSuggestion, setPromptSuggestion] = useState30(null);
|
|
30557
|
+
const dismissPromptSuggestion = useCallback27(() => setPromptSuggestion(null), []);
|
|
30558
|
+
const registerSlashCommandUsage = useCallback27((name) => {
|
|
30350
30559
|
setRecentSlashCommandsState((prev) => {
|
|
30351
30560
|
const next = new Map(prev);
|
|
30352
30561
|
const existing = next.get(name);
|
|
@@ -30358,8 +30567,8 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30358
30567
|
return next;
|
|
30359
30568
|
});
|
|
30360
30569
|
}, []);
|
|
30361
|
-
const listAvailableProviders =
|
|
30362
|
-
const getSessionCommandState =
|
|
30570
|
+
const listAvailableProviders = useCallback27(() => PROVIDER_IDS, []);
|
|
30571
|
+
const getSessionCommandState = useCallback27(() => {
|
|
30363
30572
|
const runtime = runtimeRef.current;
|
|
30364
30573
|
const session = sessionRef.current;
|
|
30365
30574
|
const fallbackProvider = runtime?.config.defaultProvider ?? PROVIDER_IDS[0];
|
|
@@ -30371,7 +30580,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30371
30580
|
mode: agentMode
|
|
30372
30581
|
};
|
|
30373
30582
|
}, [agentMode]);
|
|
30374
|
-
const setSessionProvider =
|
|
30583
|
+
const setSessionProvider = useCallback27((provider2) => {
|
|
30375
30584
|
const runtime = runtimeRef.current;
|
|
30376
30585
|
const session = sessionRef.current;
|
|
30377
30586
|
if (!runtime || !session) return;
|
|
@@ -30393,7 +30602,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30393
30602
|
);
|
|
30394
30603
|
}
|
|
30395
30604
|
}, [cwd, historyManager]);
|
|
30396
|
-
const setSessionModel =
|
|
30605
|
+
const setSessionModel = useCallback27((model2) => {
|
|
30397
30606
|
const runtime = runtimeRef.current;
|
|
30398
30607
|
const session = sessionRef.current;
|
|
30399
30608
|
if (!runtime || !session) return;
|
|
@@ -30406,7 +30615,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30406
30615
|
setCurrentModel(session.model ?? "(unconfigured)");
|
|
30407
30616
|
setProviderLabel(formatProviderLabel(session.provider, session.model));
|
|
30408
30617
|
}, [cwd]);
|
|
30409
|
-
const setSessionMode =
|
|
30618
|
+
const setSessionMode = useCallback27((mode) => {
|
|
30410
30619
|
setAgentMode(mode);
|
|
30411
30620
|
const runtime = runtimeRef.current;
|
|
30412
30621
|
const session = sessionRef.current;
|
|
@@ -30417,7 +30626,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30417
30626
|
});
|
|
30418
30627
|
}
|
|
30419
30628
|
}, []);
|
|
30420
|
-
const setSessionName =
|
|
30629
|
+
const setSessionName = useCallback27((name) => {
|
|
30421
30630
|
const runtime = runtimeRef.current;
|
|
30422
30631
|
const session = sessionRef.current;
|
|
30423
30632
|
if (!runtime || !session) return;
|
|
@@ -30426,7 +30635,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30426
30635
|
runtime.sessions.persist(session.id).catch(() => {
|
|
30427
30636
|
});
|
|
30428
30637
|
}, []);
|
|
30429
|
-
const sessionCommandServices =
|
|
30638
|
+
const sessionCommandServices = useMemo19(
|
|
30430
30639
|
() => ({
|
|
30431
30640
|
getState: getSessionCommandState,
|
|
30432
30641
|
setProvider: setSessionProvider,
|
|
@@ -30444,13 +30653,13 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30444
30653
|
setSessionProvider
|
|
30445
30654
|
]
|
|
30446
30655
|
);
|
|
30447
|
-
const handleUndo =
|
|
30656
|
+
const handleUndo = useCallback27(async () => {
|
|
30448
30657
|
const runtime = runtimeRef.current;
|
|
30449
30658
|
const session = sessionRef.current;
|
|
30450
30659
|
if (!runtime || !session) return null;
|
|
30451
30660
|
return runtime.agent.undo(session.id);
|
|
30452
30661
|
}, []);
|
|
30453
|
-
const handleCompact =
|
|
30662
|
+
const handleCompact = useCallback27(async () => {
|
|
30454
30663
|
const runtime = runtimeRef.current;
|
|
30455
30664
|
const session = sessionRef.current;
|
|
30456
30665
|
if (!runtime || !session) return;
|
|
@@ -30479,7 +30688,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30479
30688
|
setIsRunning(false);
|
|
30480
30689
|
}
|
|
30481
30690
|
}, [addHistoryItem, historyManager]);
|
|
30482
|
-
const commandContext =
|
|
30691
|
+
const commandContext = useMemo19(
|
|
30483
30692
|
() => ({
|
|
30484
30693
|
executionMode: "interactive",
|
|
30485
30694
|
services: {
|
|
@@ -30507,10 +30716,10 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30507
30716
|
}),
|
|
30508
30717
|
[configAdapter, handleCompact, handleUndo, historyManager, pendingItem, sessionCommandServices]
|
|
30509
30718
|
);
|
|
30510
|
-
|
|
30719
|
+
useEffect28(() => {
|
|
30511
30720
|
messageQueueRef.current = messageQueue;
|
|
30512
30721
|
}, [messageQueue]);
|
|
30513
|
-
|
|
30722
|
+
useEffect28(() => {
|
|
30514
30723
|
if (approvalQueue.length > 0) {
|
|
30515
30724
|
approvalPromptVisibleAtRef.current ??= Date.now();
|
|
30516
30725
|
setStreamingState(
|
|
@@ -30532,7 +30741,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30532
30741
|
/* Idle */
|
|
30533
30742
|
);
|
|
30534
30743
|
}, [approvalQueue.length, isRunning]);
|
|
30535
|
-
|
|
30744
|
+
useEffect28(() => {
|
|
30536
30745
|
if (!isRunning) {
|
|
30537
30746
|
runStartedAtRef.current = null;
|
|
30538
30747
|
setElapsedTime(0);
|
|
@@ -30548,7 +30757,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30548
30757
|
}, 250);
|
|
30549
30758
|
return () => clearInterval(interval);
|
|
30550
30759
|
}, [isRunning]);
|
|
30551
|
-
|
|
30760
|
+
useEffect28(() => {
|
|
30552
30761
|
const id = setInterval(() => {
|
|
30553
30762
|
const text = pendingTextBufferRef.current;
|
|
30554
30763
|
if (text) {
|
|
@@ -30593,7 +30802,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30593
30802
|
}, 50);
|
|
30594
30803
|
return () => clearInterval(id);
|
|
30595
30804
|
}, []);
|
|
30596
|
-
|
|
30805
|
+
useEffect28(() => {
|
|
30597
30806
|
let mounted = true;
|
|
30598
30807
|
const initialize = async () => {
|
|
30599
30808
|
try {
|
|
@@ -30813,7 +31022,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30813
31022
|
unsubscribeRef.current = [];
|
|
30814
31023
|
};
|
|
30815
31024
|
}, [addHistoryItem, config, cwd, model, provider, resumeSessionId]);
|
|
30816
|
-
const resolveApproval =
|
|
31025
|
+
const resolveApproval = useCallback27(
|
|
30817
31026
|
(decision) => {
|
|
30818
31027
|
const runtime = runtimeRef.current;
|
|
30819
31028
|
const current = approvalQueue[0];
|
|
@@ -30826,7 +31035,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30826
31035
|
},
|
|
30827
31036
|
[approvalQueue]
|
|
30828
31037
|
);
|
|
30829
|
-
const appendTurnItems =
|
|
31038
|
+
const appendTurnItems = useCallback27(
|
|
30830
31039
|
(items) => {
|
|
30831
31040
|
const base = Date.now();
|
|
30832
31041
|
for (const item of items) {
|
|
@@ -30835,7 +31044,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30835
31044
|
},
|
|
30836
31045
|
[historyManager]
|
|
30837
31046
|
);
|
|
30838
|
-
const runPrompt =
|
|
31047
|
+
const runPrompt = useCallback27(
|
|
30839
31048
|
async (rawPrompt) => {
|
|
30840
31049
|
const runtime = runtimeRef.current;
|
|
30841
31050
|
const session = sessionRef.current;
|
|
@@ -30956,7 +31165,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
30956
31165
|
},
|
|
30957
31166
|
[agentMode, appendTurnItems, historyManager]
|
|
30958
31167
|
);
|
|
30959
|
-
const executeClientToolCommand =
|
|
31168
|
+
const executeClientToolCommand = useCallback27(
|
|
30960
31169
|
async (toolName, toolArgs) => {
|
|
30961
31170
|
const runtime = runtimeRef.current;
|
|
30962
31171
|
const session = sessionRef.current;
|
|
@@ -31051,7 +31260,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31051
31260
|
},
|
|
31052
31261
|
[agentMode, historyManager]
|
|
31053
31262
|
);
|
|
31054
|
-
const applySlashCommandResult =
|
|
31263
|
+
const applySlashCommandResult = useCallback27(
|
|
31055
31264
|
async (result, _rawInvocation) => {
|
|
31056
31265
|
if (!result) return;
|
|
31057
31266
|
switch (result.type) {
|
|
@@ -31112,7 +31321,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31112
31321
|
},
|
|
31113
31322
|
[appendTurnItems, executeClientToolCommand, historyManager, runPrompt]
|
|
31114
31323
|
);
|
|
31115
|
-
const executeSlashCommand =
|
|
31324
|
+
const executeSlashCommand = useCallback27(
|
|
31116
31325
|
async (rawInput, overwriteConfirmed = false) => {
|
|
31117
31326
|
const trimmed = rawInput.trim();
|
|
31118
31327
|
if (!trimmed.startsWith("/")) return false;
|
|
@@ -31185,7 +31394,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31185
31394
|
slashCommands
|
|
31186
31395
|
]
|
|
31187
31396
|
);
|
|
31188
|
-
const executeSubmission =
|
|
31397
|
+
const executeSubmission = useCallback27(
|
|
31189
31398
|
async (value) => {
|
|
31190
31399
|
const trimmed = value.trim();
|
|
31191
31400
|
if (!trimmed) return;
|
|
@@ -31195,7 +31404,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31195
31404
|
},
|
|
31196
31405
|
[executeSlashCommand, runPrompt]
|
|
31197
31406
|
);
|
|
31198
|
-
const handleFinalSubmit =
|
|
31407
|
+
const handleFinalSubmit = useCallback27(
|
|
31199
31408
|
(value) => {
|
|
31200
31409
|
const prompt = value.trim();
|
|
31201
31410
|
if (!prompt) return;
|
|
@@ -31221,7 +31430,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31221
31430
|
isRunning
|
|
31222
31431
|
]
|
|
31223
31432
|
);
|
|
31224
|
-
const handleRetryLastPrompt =
|
|
31433
|
+
const handleRetryLastPrompt = useCallback27(() => {
|
|
31225
31434
|
const lastPrompt = lastSubmittedPromptRef.current;
|
|
31226
31435
|
if (!lastPrompt) {
|
|
31227
31436
|
historyManager.addItem(
|
|
@@ -31236,7 +31445,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31236
31445
|
}
|
|
31237
31446
|
void runPrompt(lastPrompt);
|
|
31238
31447
|
}, [approvalQueue.length, historyManager, isInitializing, isRunning, runPrompt]);
|
|
31239
|
-
const resolveCommandConfirmation =
|
|
31448
|
+
const resolveCommandConfirmation = useCallback27(
|
|
31240
31449
|
(confirmed) => {
|
|
31241
31450
|
const pending = pendingCommandConfirmation;
|
|
31242
31451
|
if (!pending) return;
|
|
@@ -31267,7 +31476,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31267
31476
|
pendingCommandConfirmation
|
|
31268
31477
|
]
|
|
31269
31478
|
);
|
|
31270
|
-
const persistConfig =
|
|
31479
|
+
const persistConfig = useCallback27(
|
|
31271
31480
|
async (mutate) => {
|
|
31272
31481
|
const loader = new ConfigLoader();
|
|
31273
31482
|
const options = { cwd, configPath: config };
|
|
@@ -31276,7 +31485,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31276
31485
|
},
|
|
31277
31486
|
[config, cwd]
|
|
31278
31487
|
);
|
|
31279
|
-
const handleSelectTheme =
|
|
31488
|
+
const handleSelectTheme = useCallback27(
|
|
31280
31489
|
(nextThemeName) => {
|
|
31281
31490
|
themeManager.setActiveTheme(nextThemeName);
|
|
31282
31491
|
setThemeName(themeManager.getActiveTheme().name);
|
|
@@ -31297,7 +31506,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31297
31506
|
},
|
|
31298
31507
|
[cwd, historyManager]
|
|
31299
31508
|
);
|
|
31300
|
-
const handleSavePermissions =
|
|
31509
|
+
const handleSavePermissions = useCallback27(
|
|
31301
31510
|
(modes) => {
|
|
31302
31511
|
setPermissionModes(modes);
|
|
31303
31512
|
setPermissionSummary(formatPermissionSummary(modes));
|
|
@@ -31326,7 +31535,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31326
31535
|
},
|
|
31327
31536
|
[historyManager, persistConfig]
|
|
31328
31537
|
);
|
|
31329
|
-
const handlePersistToken =
|
|
31538
|
+
const handlePersistToken = useCallback27(
|
|
31330
31539
|
async (token) => {
|
|
31331
31540
|
await persistConfig((cfg) => ({
|
|
31332
31541
|
...cfg,
|
|
@@ -31340,12 +31549,12 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31340
31549
|
},
|
|
31341
31550
|
[persistConfig]
|
|
31342
31551
|
);
|
|
31343
|
-
const providerHasApiKey =
|
|
31552
|
+
const providerHasApiKey = useCallback27((provider2) => {
|
|
31344
31553
|
const runtime = runtimeRef.current;
|
|
31345
31554
|
void providerConfigVersion;
|
|
31346
31555
|
return Boolean(runtime?.config.providers[provider2]?.apiKey?.trim());
|
|
31347
31556
|
}, [providerConfigVersion]);
|
|
31348
|
-
const getProviderKeyHint =
|
|
31557
|
+
const getProviderKeyHint = useCallback27((provider2) => {
|
|
31349
31558
|
const runtime = runtimeRef.current;
|
|
31350
31559
|
void providerConfigVersion;
|
|
31351
31560
|
const key = runtime?.config.providers[provider2]?.apiKey?.trim();
|
|
@@ -31353,7 +31562,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31353
31562
|
if (key.length <= 8) return "\u25CF".repeat(key.length);
|
|
31354
31563
|
return `${key.slice(0, 6)}\u25CF\u25CF\u25CF\u25CF${key.slice(-4)}`;
|
|
31355
31564
|
}, [providerConfigVersion]);
|
|
31356
|
-
const handleSaveProviderApiKey =
|
|
31565
|
+
const handleSaveProviderApiKey = useCallback27(
|
|
31357
31566
|
async (provider2, apiKey) => {
|
|
31358
31567
|
await persistConfig((cfg) => ({
|
|
31359
31568
|
...cfg,
|
|
@@ -31378,7 +31587,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31378
31587
|
},
|
|
31379
31588
|
[historyManager, persistConfig]
|
|
31380
31589
|
);
|
|
31381
|
-
const handleSetDefaultProvider =
|
|
31590
|
+
const handleSetDefaultProvider = useCallback27(
|
|
31382
31591
|
async (provider2) => {
|
|
31383
31592
|
const runtime = runtimeRef.current;
|
|
31384
31593
|
const session = sessionRef.current;
|
|
@@ -31422,7 +31631,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31422
31631
|
},
|
|
31423
31632
|
[cwd, historyManager, persistConfig]
|
|
31424
31633
|
);
|
|
31425
|
-
const handleTestProvider =
|
|
31634
|
+
const handleTestProvider = useCallback27(
|
|
31426
31635
|
async (provider2) => {
|
|
31427
31636
|
const runtime = runtimeRef.current;
|
|
31428
31637
|
const session = sessionRef.current;
|
|
@@ -31470,7 +31679,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31470
31679
|
},
|
|
31471
31680
|
[]
|
|
31472
31681
|
);
|
|
31473
|
-
const handleFetchModels =
|
|
31682
|
+
const handleFetchModels = useCallback27(
|
|
31474
31683
|
async (provider2, signal) => {
|
|
31475
31684
|
const runtime = runtimeRef.current;
|
|
31476
31685
|
if (!runtime) throw new Error("Runtime not ready.");
|
|
@@ -31478,14 +31687,14 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31478
31687
|
},
|
|
31479
31688
|
[]
|
|
31480
31689
|
);
|
|
31481
|
-
const handleSelectModel =
|
|
31690
|
+
const handleSelectModel = useCallback27(
|
|
31482
31691
|
(modelId) => {
|
|
31483
31692
|
setSessionModel(modelId);
|
|
31484
31693
|
setActiveDialog(null);
|
|
31485
31694
|
},
|
|
31486
31695
|
[setSessionModel]
|
|
31487
31696
|
);
|
|
31488
|
-
const handleSelectSession =
|
|
31697
|
+
const handleSelectSession = useCallback27(
|
|
31489
31698
|
async (sessionId) => {
|
|
31490
31699
|
const runtime = runtimeRef.current;
|
|
31491
31700
|
if (!runtime) return;
|
|
@@ -31514,9 +31723,9 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31514
31723
|
},
|
|
31515
31724
|
[historyManager]
|
|
31516
31725
|
);
|
|
31517
|
-
const closeDialog =
|
|
31518
|
-
const previewTheme =
|
|
31519
|
-
|
|
31726
|
+
const closeDialog = useCallback27(() => setActiveDialog(null), []);
|
|
31727
|
+
const previewTheme = useCallback27(() => setThemeVersion((version) => version + 1), []);
|
|
31728
|
+
useEffect28(() => {
|
|
31520
31729
|
if (drainingQueueRef.current || isRunning || isInitializing || Boolean(initError) || approvalQueue.length > 0 || messageQueue.length === 0) {
|
|
31521
31730
|
return;
|
|
31522
31731
|
}
|
|
@@ -31593,7 +31802,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31593
31802
|
abortRef.current?.abort();
|
|
31594
31803
|
}
|
|
31595
31804
|
});
|
|
31596
|
-
const uiActions =
|
|
31805
|
+
const uiActions = useMemo19(
|
|
31597
31806
|
() => ({
|
|
31598
31807
|
refreshStatic: () => {
|
|
31599
31808
|
setHistoryRemountKey((prev) => prev + 1);
|
|
@@ -31620,7 +31829,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31620
31829
|
}),
|
|
31621
31830
|
[handleFinalSubmit, handleRetryLastPrompt, historyManager]
|
|
31622
31831
|
);
|
|
31623
|
-
const dialogModel =
|
|
31832
|
+
const dialogModel = useMemo19(
|
|
31624
31833
|
() => buildDialogModel(activeDialog, {
|
|
31625
31834
|
cwd,
|
|
31626
31835
|
providerLabel,
|
|
@@ -31647,8 +31856,8 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31647
31856
|
themeName
|
|
31648
31857
|
]
|
|
31649
31858
|
);
|
|
31650
|
-
const activeSubagents =
|
|
31651
|
-
const uiState =
|
|
31859
|
+
const activeSubagents = useMemo19(() => Array.from(subagentMap.values()), [subagentMap]);
|
|
31860
|
+
const uiState = useMemo19(
|
|
31652
31861
|
() => ({
|
|
31653
31862
|
history: historyManager.history,
|
|
31654
31863
|
historyManager,
|
|
@@ -31790,6 +31999,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31790
31999
|
MainContent,
|
|
31791
32000
|
{
|
|
31792
32001
|
history: historyManager.history,
|
|
32002
|
+
historyRemountKey,
|
|
31793
32003
|
pendingAssistantText,
|
|
31794
32004
|
liveToolCalls,
|
|
31795
32005
|
taskPlan,
|
|
@@ -31797,8 +32007,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
|
|
|
31797
32007
|
terminalWidth,
|
|
31798
32008
|
mainAreaWidth,
|
|
31799
32009
|
isFocused: approvalQueue.length === 0
|
|
31800
|
-
}
|
|
31801
|
-
historyRemountKey
|
|
32010
|
+
}
|
|
31802
32011
|
),
|
|
31803
32012
|
approvalQueue.length > 0 && /* @__PURE__ */ jsx51(Box42, { marginLeft: 2, marginRight: 2, marginTop: 1, children: /* @__PURE__ */ jsx51(ApprovalPrompt, { request: approvalQueue[0] }) }),
|
|
31804
32013
|
dialogModel && /* @__PURE__ */ jsx51(CommandDialog, { title: dialogModel.title, lines: dialogModel.lines }),
|
|
@@ -32155,6 +32364,9 @@ function createProgram() {
|
|
|
32155
32364
|
program.command("doctor").description("validate local tools, provider config, GitHub token, and LSP servers").action(async () => {
|
|
32156
32365
|
await doctorCommand({ cwd: program.opts().cwd, config: program.opts().config });
|
|
32157
32366
|
});
|
|
32367
|
+
program.command("update").description("check for published updates").action(async () => {
|
|
32368
|
+
await updateCommand();
|
|
32369
|
+
});
|
|
32158
32370
|
const cache = program.command("cache").description("manage persistent tool cache");
|
|
32159
32371
|
cache.command("clear").description("clear .deepcode/cache").action(async () => {
|
|
32160
32372
|
await cacheClearCommand({ cwd: program.opts().cwd, config: program.opts().config });
|
|
@@ -32277,7 +32489,7 @@ function createProgram() {
|
|
|
32277
32489
|
});
|
|
32278
32490
|
program.command("chat", { isDefault: true }).description("open the terminal UI").option("--provider <provider>", "provider override for this chat session").option("--model <model>", "model override for this chat session (or <provider>/<model>)").option("--resume <id>", "resume a previous session by ID").action((options) => {
|
|
32279
32491
|
render3(
|
|
32280
|
-
|
|
32492
|
+
React40.createElement(App, {
|
|
32281
32493
|
cwd: program.opts().cwd,
|
|
32282
32494
|
config: program.opts().config,
|
|
32283
32495
|
provider: options.provider,
|