snow-ai 0.7.7 → 0.7.8
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/bundle/cli.mjs +1753 -575
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -1505,7 +1505,7 @@ var require_react_development = __commonJS({
|
|
|
1505
1505
|
}
|
|
1506
1506
|
return dispatcher.useContext(Context);
|
|
1507
1507
|
}
|
|
1508
|
-
function
|
|
1508
|
+
function useState88(initialState) {
|
|
1509
1509
|
var dispatcher = resolveDispatcher();
|
|
1510
1510
|
return dispatcher.useState(initialState);
|
|
1511
1511
|
}
|
|
@@ -1513,11 +1513,11 @@ var require_react_development = __commonJS({
|
|
|
1513
1513
|
var dispatcher = resolveDispatcher();
|
|
1514
1514
|
return dispatcher.useReducer(reducer2, initialArg, init);
|
|
1515
1515
|
}
|
|
1516
|
-
function
|
|
1516
|
+
function useRef26(initialValue) {
|
|
1517
1517
|
var dispatcher = resolveDispatcher();
|
|
1518
1518
|
return dispatcher.useRef(initialValue);
|
|
1519
1519
|
}
|
|
1520
|
-
function
|
|
1520
|
+
function useEffect83(create3, deps) {
|
|
1521
1521
|
var dispatcher = resolveDispatcher();
|
|
1522
1522
|
return dispatcher.useEffect(create3, deps);
|
|
1523
1523
|
}
|
|
@@ -1529,11 +1529,11 @@ var require_react_development = __commonJS({
|
|
|
1529
1529
|
var dispatcher = resolveDispatcher();
|
|
1530
1530
|
return dispatcher.useLayoutEffect(create3, deps);
|
|
1531
1531
|
}
|
|
1532
|
-
function
|
|
1532
|
+
function useCallback66(callback, deps) {
|
|
1533
1533
|
var dispatcher = resolveDispatcher();
|
|
1534
1534
|
return dispatcher.useCallback(callback, deps);
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1536
|
+
function useMemo49(create3, deps) {
|
|
1537
1537
|
var dispatcher = resolveDispatcher();
|
|
1538
1538
|
return dispatcher.useMemo(create3, deps);
|
|
1539
1539
|
}
|
|
@@ -2296,19 +2296,19 @@ var require_react_development = __commonJS({
|
|
|
2296
2296
|
exports2.memo = memo9;
|
|
2297
2297
|
exports2.startTransition = startTransition;
|
|
2298
2298
|
exports2.unstable_act = act;
|
|
2299
|
-
exports2.useCallback =
|
|
2299
|
+
exports2.useCallback = useCallback66;
|
|
2300
2300
|
exports2.useContext = useContext13;
|
|
2301
2301
|
exports2.useDebugValue = useDebugValue;
|
|
2302
2302
|
exports2.useDeferredValue = useDeferredValue;
|
|
2303
|
-
exports2.useEffect =
|
|
2303
|
+
exports2.useEffect = useEffect83;
|
|
2304
2304
|
exports2.useId = useId;
|
|
2305
2305
|
exports2.useImperativeHandle = useImperativeHandle2;
|
|
2306
2306
|
exports2.useInsertionEffect = useInsertionEffect;
|
|
2307
2307
|
exports2.useLayoutEffect = useLayoutEffect2;
|
|
2308
|
-
exports2.useMemo =
|
|
2308
|
+
exports2.useMemo = useMemo49;
|
|
2309
2309
|
exports2.useReducer = useReducer8;
|
|
2310
|
-
exports2.useRef =
|
|
2311
|
-
exports2.useState =
|
|
2310
|
+
exports2.useRef = useRef26;
|
|
2311
|
+
exports2.useState = useState88;
|
|
2312
2312
|
exports2.useSyncExternalStore = useSyncExternalStore4;
|
|
2313
2313
|
exports2.useTransition = useTransition;
|
|
2314
2314
|
exports2.version = ReactVersion;
|
|
@@ -10012,9 +10012,9 @@ var require_react_reconciler_development = __commonJS({
|
|
|
10012
10012
|
module2.exports = function $$$reconciler($$$hostConfig) {
|
|
10013
10013
|
var exports3 = {};
|
|
10014
10014
|
"use strict";
|
|
10015
|
-
var
|
|
10015
|
+
var React124 = require_react();
|
|
10016
10016
|
var Scheduler2 = require_scheduler();
|
|
10017
|
-
var ReactSharedInternals =
|
|
10017
|
+
var ReactSharedInternals = React124.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
10018
10018
|
var suppressWarning = false;
|
|
10019
10019
|
function setSuppressWarning(newSuppressWarning) {
|
|
10020
10020
|
{
|
|
@@ -46374,6 +46374,7 @@ var init_codebaseConfig = __esm({
|
|
|
46374
46374
|
DEFAULT_CONFIG = {
|
|
46375
46375
|
enabled: false,
|
|
46376
46376
|
enableAgentReview: true,
|
|
46377
|
+
enableReranking: false,
|
|
46377
46378
|
embedding: {
|
|
46378
46379
|
type: "jina",
|
|
46379
46380
|
// 默认使用jina
|
|
@@ -46391,6 +46392,13 @@ var init_codebaseConfig = __esm({
|
|
|
46391
46392
|
minLinesPerChunk: 10,
|
|
46392
46393
|
minCharsPerChunk: 20,
|
|
46393
46394
|
overlapLines: 20
|
|
46395
|
+
},
|
|
46396
|
+
reranking: {
|
|
46397
|
+
modelName: "",
|
|
46398
|
+
baseUrl: "",
|
|
46399
|
+
apiKey: "",
|
|
46400
|
+
contextLength: 4096,
|
|
46401
|
+
topN: 5
|
|
46394
46402
|
}
|
|
46395
46403
|
};
|
|
46396
46404
|
getGlobalConfigDir = () => {
|
|
@@ -46436,7 +46444,7 @@ var init_codebaseConfig = __esm({
|
|
|
46436
46444
|
}
|
|
46437
46445
|
};
|
|
46438
46446
|
loadCodebaseConfig = (workingDirectory) => {
|
|
46439
|
-
var _a20, _b14, _c6, _d4, _e2, _f;
|
|
46447
|
+
var _a20, _b14, _c6, _d4, _e2, _f, _g, _h, _i, _j, _k;
|
|
46440
46448
|
try {
|
|
46441
46449
|
const projectConfigPath = getProjectConfigPath(workingDirectory);
|
|
46442
46450
|
const globalEmbedding = loadGlobalEmbeddingConfig();
|
|
@@ -46448,6 +46456,7 @@ var init_codebaseConfig = __esm({
|
|
|
46448
46456
|
return {
|
|
46449
46457
|
enabled: projectConfig.enabled ?? DEFAULT_CONFIG.enabled,
|
|
46450
46458
|
enableAgentReview: projectConfig.enableAgentReview ?? DEFAULT_CONFIG.enableAgentReview,
|
|
46459
|
+
enableReranking: projectConfig.enableReranking ?? DEFAULT_CONFIG.enableReranking,
|
|
46451
46460
|
embedding: globalEmbedding,
|
|
46452
46461
|
batch: {
|
|
46453
46462
|
maxLines: ((_a20 = projectConfig.batch) == null ? void 0 : _a20.maxLines) ?? DEFAULT_CONFIG.batch.maxLines,
|
|
@@ -46458,6 +46467,13 @@ var init_codebaseConfig = __esm({
|
|
|
46458
46467
|
minLinesPerChunk: ((_d4 = projectConfig.chunking) == null ? void 0 : _d4.minLinesPerChunk) ?? DEFAULT_CONFIG.chunking.minLinesPerChunk,
|
|
46459
46468
|
minCharsPerChunk: ((_e2 = projectConfig.chunking) == null ? void 0 : _e2.minCharsPerChunk) ?? DEFAULT_CONFIG.chunking.minCharsPerChunk,
|
|
46460
46469
|
overlapLines: ((_f = projectConfig.chunking) == null ? void 0 : _f.overlapLines) ?? DEFAULT_CONFIG.chunking.overlapLines
|
|
46470
|
+
},
|
|
46471
|
+
reranking: {
|
|
46472
|
+
modelName: ((_g = projectConfig.reranking) == null ? void 0 : _g.modelName) ?? DEFAULT_CONFIG.reranking.modelName,
|
|
46473
|
+
baseUrl: ((_h = projectConfig.reranking) == null ? void 0 : _h.baseUrl) ?? DEFAULT_CONFIG.reranking.baseUrl,
|
|
46474
|
+
apiKey: ((_i = projectConfig.reranking) == null ? void 0 : _i.apiKey) ?? DEFAULT_CONFIG.reranking.apiKey,
|
|
46475
|
+
contextLength: ((_j = projectConfig.reranking) == null ? void 0 : _j.contextLength) ?? DEFAULT_CONFIG.reranking.contextLength,
|
|
46476
|
+
topN: ((_k = projectConfig.reranking) == null ? void 0 : _k.topN) ?? DEFAULT_CONFIG.reranking.topN
|
|
46461
46477
|
}
|
|
46462
46478
|
};
|
|
46463
46479
|
} catch (error40) {
|
|
@@ -46474,8 +46490,10 @@ var init_codebaseConfig = __esm({
|
|
|
46474
46490
|
const projectConfig = {
|
|
46475
46491
|
enabled: config3.enabled,
|
|
46476
46492
|
enableAgentReview: config3.enableAgentReview,
|
|
46493
|
+
enableReranking: config3.enableReranking,
|
|
46477
46494
|
batch: config3.batch,
|
|
46478
|
-
chunking: config3.chunking
|
|
46495
|
+
chunking: config3.chunking,
|
|
46496
|
+
reranking: config3.reranking
|
|
46479
46497
|
};
|
|
46480
46498
|
fs7.writeFileSync(projectConfigPath, JSON.stringify(projectConfig, null, 2), "utf-8");
|
|
46481
46499
|
} catch (error40) {
|
|
@@ -351465,15 +351483,22 @@ ${numberedLines3.join("\n")}`;
|
|
|
351465
351483
|
* @param filePath - Path where the file should be created
|
|
351466
351484
|
* @param content - Content to write to the file
|
|
351467
351485
|
* @param createDirectories - Whether to create parent directories if they don't exist
|
|
351486
|
+
* @param overwrite - Whether to overwrite the file if it already exists
|
|
351468
351487
|
* @returns Success message
|
|
351469
351488
|
* @throws Error if file creation fails
|
|
351470
351489
|
*/
|
|
351471
|
-
async createFile(filePath, content, createDirectories = true) {
|
|
351490
|
+
async createFile(filePath, content, createDirectories = true, overwrite = false) {
|
|
351472
351491
|
try {
|
|
351473
351492
|
const fullPath = this.resolvePath(filePath);
|
|
351493
|
+
let fileExisted = false;
|
|
351494
|
+
let originalContent;
|
|
351474
351495
|
try {
|
|
351475
351496
|
await fs21.access(fullPath);
|
|
351476
|
-
|
|
351497
|
+
if (!overwrite) {
|
|
351498
|
+
throw new Error(`File already exists: ${filePath}`);
|
|
351499
|
+
}
|
|
351500
|
+
fileExisted = true;
|
|
351501
|
+
originalContent = await readFileWithEncoding(fullPath);
|
|
351477
351502
|
} catch (error40) {
|
|
351478
351503
|
if (error40.code !== "ENOENT") {
|
|
351479
351504
|
throw error40;
|
|
@@ -351484,15 +351509,7 @@ ${numberedLines3.join("\n")}`;
|
|
|
351484
351509
|
const context2 = getConversationContext2();
|
|
351485
351510
|
if (context2) {
|
|
351486
351511
|
const { hashBasedSnapshotManager: hashBasedSnapshotManager2 } = await Promise.resolve().then(() => (init_hashBasedSnapshot(), hashBasedSnapshot_exports));
|
|
351487
|
-
await hashBasedSnapshotManager2.backupFile(
|
|
351488
|
-
context2.sessionId,
|
|
351489
|
-
context2.messageIndex,
|
|
351490
|
-
filePath,
|
|
351491
|
-
this.basePath,
|
|
351492
|
-
false,
|
|
351493
|
-
// File didn't exist
|
|
351494
|
-
void 0
|
|
351495
|
-
);
|
|
351512
|
+
await hashBasedSnapshotManager2.backupFile(context2.sessionId, context2.messageIndex, filePath, this.basePath, fileExisted, originalContent);
|
|
351496
351513
|
}
|
|
351497
351514
|
} catch (backupError) {
|
|
351498
351515
|
}
|
|
@@ -351501,7 +351518,7 @@ ${numberedLines3.join("\n")}`;
|
|
|
351501
351518
|
await fs21.mkdir(dir, { recursive: true });
|
|
351502
351519
|
}
|
|
351503
351520
|
await writeFileWithEncoding(fullPath, content);
|
|
351504
|
-
return `File created successfully: ${filePath}`;
|
|
351521
|
+
return fileExisted ? `File overwritten successfully: ${filePath}` : `File created successfully: ${filePath}`;
|
|
351505
351522
|
} catch (error40) {
|
|
351506
351523
|
throw new Error(`Failed to create file ${filePath}: ${error40 instanceof Error ? error40.message : "Unknown error"}`);
|
|
351507
351524
|
}
|
|
@@ -351916,7 +351933,7 @@ ${fmt}`;
|
|
|
351916
351933
|
},
|
|
351917
351934
|
{
|
|
351918
351935
|
name: "filesystem-create",
|
|
351919
|
-
description: 'Create a new file with content. **PATH REQUIREMENT**: Use EXACT non-empty string path, never undefined/null/empty/placeholders like "path/to/file".
|
|
351936
|
+
description: 'Create a new file with content. **PATH REQUIREMENT**: Use EXACT non-empty string path, never undefined/null/empty/placeholders like "path/to/file". Set `overwrite` to true to replace an existing file (original content is backed up for rollback). Automatically creates parent directories.',
|
|
351920
351937
|
inputSchema: {
|
|
351921
351938
|
type: "object",
|
|
351922
351939
|
properties: {
|
|
@@ -351928,13 +351945,17 @@ ${fmt}`;
|
|
|
351928
351945
|
type: "string",
|
|
351929
351946
|
description: "Content to write to the file"
|
|
351930
351947
|
},
|
|
351948
|
+
overwrite: {
|
|
351949
|
+
type: "boolean",
|
|
351950
|
+
description: "Whether to overwrite the file if it already exists. When true, the existing file content is backed up for rollback before being replaced. When false, an error is thrown if the file already exists."
|
|
351951
|
+
},
|
|
351931
351952
|
createDirectories: {
|
|
351932
351953
|
type: "boolean",
|
|
351933
351954
|
description: "Whether to create parent directories if they don't exist",
|
|
351934
351955
|
default: true
|
|
351935
351956
|
}
|
|
351936
351957
|
},
|
|
351937
|
-
required: ["filePath", "content"]
|
|
351958
|
+
required: ["filePath", "content", "overwrite"]
|
|
351938
351959
|
}
|
|
351939
351960
|
},
|
|
351940
351961
|
{
|
|
@@ -430627,6 +430648,237 @@ var init_embedding = __esm({
|
|
|
430627
430648
|
}
|
|
430628
430649
|
});
|
|
430629
430650
|
|
|
430651
|
+
// dist/api/rerank.js
|
|
430652
|
+
async function countTokens(text2) {
|
|
430653
|
+
try {
|
|
430654
|
+
const { encoding_for_model: encoding_for_model3 } = await Promise.resolve().then(() => __toESM(require_tiktoken(), 1));
|
|
430655
|
+
let encoder;
|
|
430656
|
+
try {
|
|
430657
|
+
encoder = encoding_for_model3("gpt-5");
|
|
430658
|
+
} catch {
|
|
430659
|
+
encoder = encoding_for_model3("gpt-3.5-turbo");
|
|
430660
|
+
}
|
|
430661
|
+
try {
|
|
430662
|
+
return encoder.encode(text2).length;
|
|
430663
|
+
} finally {
|
|
430664
|
+
encoder.free();
|
|
430665
|
+
}
|
|
430666
|
+
} catch {
|
|
430667
|
+
return Math.ceil(text2.length / 4);
|
|
430668
|
+
}
|
|
430669
|
+
}
|
|
430670
|
+
async function truncateText(text2, maxTokens) {
|
|
430671
|
+
try {
|
|
430672
|
+
const { encoding_for_model: encoding_for_model3 } = await Promise.resolve().then(() => __toESM(require_tiktoken(), 1));
|
|
430673
|
+
let encoder;
|
|
430674
|
+
try {
|
|
430675
|
+
encoder = encoding_for_model3("gpt-5");
|
|
430676
|
+
} catch {
|
|
430677
|
+
encoder = encoding_for_model3("gpt-3.5-turbo");
|
|
430678
|
+
}
|
|
430679
|
+
try {
|
|
430680
|
+
const tokens = encoder.encode(text2);
|
|
430681
|
+
if (tokens.length <= maxTokens) {
|
|
430682
|
+
return text2;
|
|
430683
|
+
}
|
|
430684
|
+
const truncated = tokens.slice(0, maxTokens);
|
|
430685
|
+
const decoder = new TextDecoder();
|
|
430686
|
+
return decoder.decode(encoder.decode(truncated));
|
|
430687
|
+
} finally {
|
|
430688
|
+
encoder.free();
|
|
430689
|
+
}
|
|
430690
|
+
} catch {
|
|
430691
|
+
const maxChars = maxTokens * 4;
|
|
430692
|
+
return text2.length <= maxChars ? text2 : text2.slice(0, maxChars);
|
|
430693
|
+
}
|
|
430694
|
+
}
|
|
430695
|
+
async function fitDocumentsToContext(query, documents, contextLength) {
|
|
430696
|
+
const budgetTotal = Math.floor(contextLength * CONTEXT_RESERVE_RATIO);
|
|
430697
|
+
const queryTokens = await countTokens(query);
|
|
430698
|
+
const overhead = 50;
|
|
430699
|
+
let remaining = budgetTotal - queryTokens - overhead;
|
|
430700
|
+
if (remaining <= 0) {
|
|
430701
|
+
logger.warn(`Rerank context budget exhausted by query alone (${queryTokens} tokens, budget ${budgetTotal})`);
|
|
430702
|
+
return {
|
|
430703
|
+
documents: [],
|
|
430704
|
+
originalIndices: [],
|
|
430705
|
+
droppedCount: documents.length,
|
|
430706
|
+
truncatedCount: 0
|
|
430707
|
+
};
|
|
430708
|
+
}
|
|
430709
|
+
const singleDocMax = Math.floor(contextLength * SINGLE_DOC_MAX_RATIO);
|
|
430710
|
+
const fitted = [];
|
|
430711
|
+
const originalIndices = [];
|
|
430712
|
+
let droppedCount = 0;
|
|
430713
|
+
let truncatedCount = 0;
|
|
430714
|
+
for (let i = 0; i < documents.length; i++) {
|
|
430715
|
+
const doc = documents[i];
|
|
430716
|
+
let docTokens = await countTokens(doc);
|
|
430717
|
+
if (docTokens > singleDocMax) {
|
|
430718
|
+
const truncatedDoc = await truncateText(doc, singleDocMax);
|
|
430719
|
+
docTokens = await countTokens(truncatedDoc);
|
|
430720
|
+
truncatedCount++;
|
|
430721
|
+
if (docTokens <= remaining) {
|
|
430722
|
+
fitted.push(truncatedDoc);
|
|
430723
|
+
originalIndices.push(i);
|
|
430724
|
+
remaining -= docTokens;
|
|
430725
|
+
} else {
|
|
430726
|
+
droppedCount++;
|
|
430727
|
+
}
|
|
430728
|
+
continue;
|
|
430729
|
+
}
|
|
430730
|
+
if (docTokens <= remaining) {
|
|
430731
|
+
fitted.push(doc);
|
|
430732
|
+
originalIndices.push(i);
|
|
430733
|
+
remaining -= docTokens;
|
|
430734
|
+
} else {
|
|
430735
|
+
droppedCount++;
|
|
430736
|
+
}
|
|
430737
|
+
}
|
|
430738
|
+
if (droppedCount > 0 || truncatedCount > 0) {
|
|
430739
|
+
logger.info(`Rerank context fitting: ${documents.length} docs \u2192 ${fitted.length} kept, ${truncatedCount} truncated, ${droppedCount} dropped (context ${contextLength} tokens)`);
|
|
430740
|
+
}
|
|
430741
|
+
return { documents: fitted, originalIndices, droppedCount, truncatedCount };
|
|
430742
|
+
}
|
|
430743
|
+
function resolveRerankEndpoint(baseUrl) {
|
|
430744
|
+
const trimmed = baseUrl.trim().replace(/\/+$/, "");
|
|
430745
|
+
if (trimmed.endsWith("/rerank")) {
|
|
430746
|
+
return trimmed;
|
|
430747
|
+
}
|
|
430748
|
+
if (trimmed.endsWith("/v1/rerank")) {
|
|
430749
|
+
return trimmed;
|
|
430750
|
+
}
|
|
430751
|
+
if (trimmed.endsWith("/v1")) {
|
|
430752
|
+
return `${trimmed}/rerank`;
|
|
430753
|
+
}
|
|
430754
|
+
return `${trimmed}/v1/rerank`;
|
|
430755
|
+
}
|
|
430756
|
+
function normalizeRerankResponse(data) {
|
|
430757
|
+
if (data && Array.isArray(data.results)) {
|
|
430758
|
+
return {
|
|
430759
|
+
results: data.results.map((r) => ({
|
|
430760
|
+
index: r.index ?? 0,
|
|
430761
|
+
relevanceScore: r.relevance_score ?? r.relevanceScore ?? 0
|
|
430762
|
+
}))
|
|
430763
|
+
};
|
|
430764
|
+
}
|
|
430765
|
+
if (Array.isArray(data)) {
|
|
430766
|
+
return {
|
|
430767
|
+
results: data.map((r) => ({
|
|
430768
|
+
index: r.index ?? 0,
|
|
430769
|
+
relevanceScore: r.relevance_score ?? r.relevanceScore ?? r.score ?? 0
|
|
430770
|
+
}))
|
|
430771
|
+
};
|
|
430772
|
+
}
|
|
430773
|
+
throw new Error(`Unexpected rerank API response format: ${JSON.stringify(data).slice(0, 200)}`);
|
|
430774
|
+
}
|
|
430775
|
+
async function callRerankAPI(options3) {
|
|
430776
|
+
const { url: url2, model, query, documents, topN, apiKey } = options3;
|
|
430777
|
+
const requestBody = {
|
|
430778
|
+
model,
|
|
430779
|
+
query,
|
|
430780
|
+
documents
|
|
430781
|
+
};
|
|
430782
|
+
if (topN !== void 0) {
|
|
430783
|
+
requestBody["top_n"] = topN;
|
|
430784
|
+
}
|
|
430785
|
+
const headers = {
|
|
430786
|
+
"Content-Type": "application/json",
|
|
430787
|
+
"x-snow": getVersionHeader()
|
|
430788
|
+
};
|
|
430789
|
+
if (apiKey) {
|
|
430790
|
+
headers["Authorization"] = `Bearer ${apiKey}`;
|
|
430791
|
+
}
|
|
430792
|
+
const fetchOptions = addProxyToFetchOptions(url2, {
|
|
430793
|
+
method: "POST",
|
|
430794
|
+
headers,
|
|
430795
|
+
body: JSON.stringify(requestBody)
|
|
430796
|
+
});
|
|
430797
|
+
const response = await fetch(url2, fetchOptions);
|
|
430798
|
+
if (!response.ok) {
|
|
430799
|
+
const errorText = await response.text();
|
|
430800
|
+
throw new Error(`Rerank API error (${response.status}): ${errorText}`);
|
|
430801
|
+
}
|
|
430802
|
+
const data = await response.json();
|
|
430803
|
+
return normalizeRerankResponse(data);
|
|
430804
|
+
}
|
|
430805
|
+
async function rerankDocuments(options3) {
|
|
430806
|
+
const config3 = loadCodebaseConfig();
|
|
430807
|
+
const rerankingConfig = config3.reranking;
|
|
430808
|
+
const model = options3.model || rerankingConfig.modelName;
|
|
430809
|
+
const baseUrl = options3.baseUrl || rerankingConfig.baseUrl;
|
|
430810
|
+
const apiKey = options3.apiKey || rerankingConfig.apiKey;
|
|
430811
|
+
const topN = options3.topN ?? rerankingConfig.topN;
|
|
430812
|
+
const contextLength = options3.contextLength ?? rerankingConfig.contextLength;
|
|
430813
|
+
const { query, documents } = options3;
|
|
430814
|
+
if (!model) {
|
|
430815
|
+
throw new Error("Reranking model name is required");
|
|
430816
|
+
}
|
|
430817
|
+
if (!baseUrl) {
|
|
430818
|
+
throw new Error("Reranking base URL is required");
|
|
430819
|
+
}
|
|
430820
|
+
if (!documents || documents.length === 0) {
|
|
430821
|
+
throw new Error("Documents are required for reranking");
|
|
430822
|
+
}
|
|
430823
|
+
const fitResult = await fitDocumentsToContext(query, documents, contextLength);
|
|
430824
|
+
if (fitResult.documents.length === 0) {
|
|
430825
|
+
logger.warn("All documents dropped during context fitting, returning empty results");
|
|
430826
|
+
return {
|
|
430827
|
+
results: [],
|
|
430828
|
+
droppedDocuments: fitResult.droppedCount,
|
|
430829
|
+
truncatedDocuments: fitResult.truncatedCount
|
|
430830
|
+
};
|
|
430831
|
+
}
|
|
430832
|
+
const url2 = resolveRerankEndpoint(baseUrl);
|
|
430833
|
+
const effectiveTopN = topN >= fitResult.documents.length ? void 0 : topN;
|
|
430834
|
+
let lastError = null;
|
|
430835
|
+
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
430836
|
+
try {
|
|
430837
|
+
logger.info(`Rerank API call attempt ${attempt}/${MAX_RETRIES} (${fitResult.documents.length}/${documents.length} docs, context ${contextLength})`);
|
|
430838
|
+
const response = await callRerankAPI({
|
|
430839
|
+
url: url2,
|
|
430840
|
+
model,
|
|
430841
|
+
query,
|
|
430842
|
+
documents: fitResult.documents,
|
|
430843
|
+
topN: effectiveTopN,
|
|
430844
|
+
apiKey
|
|
430845
|
+
});
|
|
430846
|
+
const mappedResults = response.results.map((r) => ({
|
|
430847
|
+
index: fitResult.originalIndices[r.index] ?? r.index,
|
|
430848
|
+
relevanceScore: r.relevanceScore
|
|
430849
|
+
}));
|
|
430850
|
+
logger.info(`Rerank API succeeded on attempt ${attempt}, got ${mappedResults.length} results`);
|
|
430851
|
+
return {
|
|
430852
|
+
results: mappedResults,
|
|
430853
|
+
droppedDocuments: fitResult.droppedCount,
|
|
430854
|
+
truncatedDocuments: fitResult.truncatedCount
|
|
430855
|
+
};
|
|
430856
|
+
} catch (error40) {
|
|
430857
|
+
lastError = error40 instanceof Error ? error40 : new Error(String(error40));
|
|
430858
|
+
logger.warn(`Rerank API attempt ${attempt}/${MAX_RETRIES} failed: ${lastError.message}`);
|
|
430859
|
+
if (attempt < MAX_RETRIES) {
|
|
430860
|
+
const delay2 = RETRY_BASE_DELAY_MS * attempt;
|
|
430861
|
+
await new Promise((resolve13) => setTimeout(resolve13, delay2));
|
|
430862
|
+
}
|
|
430863
|
+
}
|
|
430864
|
+
}
|
|
430865
|
+
throw new Error(`Rerank API failed after ${MAX_RETRIES} attempts: ${lastError == null ? void 0 : lastError.message}`);
|
|
430866
|
+
}
|
|
430867
|
+
var MAX_RETRIES, RETRY_BASE_DELAY_MS, CONTEXT_RESERVE_RATIO, SINGLE_DOC_MAX_RATIO;
|
|
430868
|
+
var init_rerank = __esm({
|
|
430869
|
+
"dist/api/rerank.js"() {
|
|
430870
|
+
"use strict";
|
|
430871
|
+
init_codebaseConfig();
|
|
430872
|
+
init_logger();
|
|
430873
|
+
init_proxyUtils();
|
|
430874
|
+
init_version();
|
|
430875
|
+
MAX_RETRIES = 3;
|
|
430876
|
+
RETRY_BASE_DELAY_MS = 500;
|
|
430877
|
+
CONTEXT_RESERVE_RATIO = 0.95;
|
|
430878
|
+
SINGLE_DOC_MAX_RATIO = 0.3;
|
|
430879
|
+
}
|
|
430880
|
+
});
|
|
430881
|
+
|
|
430630
430882
|
// dist/utils/codebase/codebaseSearchEvents.js
|
|
430631
430883
|
import { EventEmitter as EventEmitter7 } from "events";
|
|
430632
430884
|
var CodebaseSearchEventEmitter, codebaseSearchEvents;
|
|
@@ -430662,6 +430914,7 @@ var init_codebaseSearch = __esm({
|
|
|
430662
430914
|
"use strict";
|
|
430663
430915
|
init_codebaseDatabase();
|
|
430664
430916
|
init_embedding();
|
|
430917
|
+
init_rerank();
|
|
430665
430918
|
init_logger();
|
|
430666
430919
|
init_codebaseReviewAgent();
|
|
430667
430920
|
init_codebaseSearchEvents();
|
|
@@ -430727,6 +430980,7 @@ var init_codebaseSearch = __esm({
|
|
|
430727
430980
|
async search(query, topN = 10, abortSignal, deepExploreFiles, queriedTerms = /* @__PURE__ */ new Set()) {
|
|
430728
430981
|
const config3 = loadCodebaseConfig();
|
|
430729
430982
|
const enableAgentReview = config3.enableAgentReview;
|
|
430983
|
+
const enableReranking = config3.enableReranking;
|
|
430730
430984
|
const { available, reason } = await this.isCodebaseIndexAvailable();
|
|
430731
430985
|
if (!available) {
|
|
430732
430986
|
return {
|
|
@@ -430749,7 +431003,7 @@ var init_codebaseSearch = __esm({
|
|
|
430749
431003
|
queriedTerms.add(query.toLowerCase());
|
|
430750
431004
|
while (searchAttempt < MAX_SEARCH_RETRIES) {
|
|
430751
431005
|
searchAttempt++;
|
|
430752
|
-
if (enableAgentReview) {
|
|
431006
|
+
if (enableAgentReview || enableReranking) {
|
|
430753
431007
|
codebaseSearchEvents.emitSearchEvent({
|
|
430754
431008
|
type: searchAttempt === 1 ? "search-start" : "search-retry",
|
|
430755
431009
|
attempt: searchAttempt,
|
|
@@ -430779,7 +431033,48 @@ var init_codebaseSearch = __esm({
|
|
|
430779
431033
|
let removedCount = 0;
|
|
430780
431034
|
let suggestion;
|
|
430781
431035
|
let highConfidenceFiles = [];
|
|
430782
|
-
if (
|
|
431036
|
+
if (enableReranking) {
|
|
431037
|
+
codebaseSearchEvents.emitSearchEvent({
|
|
431038
|
+
type: "search-retry",
|
|
431039
|
+
attempt: searchAttempt,
|
|
431040
|
+
maxAttempts: MAX_SEARCH_RETRIES,
|
|
431041
|
+
currentTopN,
|
|
431042
|
+
message: `Reranking ${formattedResults.length} results...`,
|
|
431043
|
+
query,
|
|
431044
|
+
originalResultsCount: formattedResults.length
|
|
431045
|
+
});
|
|
431046
|
+
logger.info(`Reranking ${formattedResults.length} search results (attempt ${searchAttempt})`);
|
|
431047
|
+
try {
|
|
431048
|
+
const rerankTopN = config3.reranking.topN;
|
|
431049
|
+
const documents = formattedResults.map((r) => {
|
|
431050
|
+
return `File: ${r.filePath} (Lines ${r.startLine}-${r.endLine})
|
|
431051
|
+
${r.content}`;
|
|
431052
|
+
});
|
|
431053
|
+
const rerankResponse = await rerankDocuments({
|
|
431054
|
+
query: currentQuery,
|
|
431055
|
+
documents,
|
|
431056
|
+
topN: rerankTopN
|
|
431057
|
+
});
|
|
431058
|
+
const rerankedResults = rerankResponse.results.sort((a, b) => b.relevanceScore - a.relevanceScore).filter((r) => r.index >= 0 && r.index < formattedResults.length).map((r, newRank) => {
|
|
431059
|
+
const original = formattedResults[r.index];
|
|
431060
|
+
return {
|
|
431061
|
+
...original,
|
|
431062
|
+
rank: newRank + 1,
|
|
431063
|
+
similarityScore: `${(r.relevanceScore * 100).toFixed(2)}`,
|
|
431064
|
+
relevanceScore: r.relevanceScore
|
|
431065
|
+
};
|
|
431066
|
+
});
|
|
431067
|
+
finalResults = rerankedResults;
|
|
431068
|
+
removedCount = formattedResults.length - finalResults.length;
|
|
431069
|
+
reviewFailed = false;
|
|
431070
|
+
logger.info(`Reranking complete: ${formattedResults.length} \u2192 ${finalResults.length} results`);
|
|
431071
|
+
} catch (rerankError) {
|
|
431072
|
+
logger.error("Reranking failed, falling back to raw results:", rerankError);
|
|
431073
|
+
finalResults = formattedResults;
|
|
431074
|
+
reviewFailed = true;
|
|
431075
|
+
removedCount = 0;
|
|
431076
|
+
}
|
|
431077
|
+
} else if (enableAgentReview) {
|
|
430783
431078
|
codebaseSearchEvents.emitSearchEvent({
|
|
430784
431079
|
type: "search-retry",
|
|
430785
431080
|
attempt: searchAttempt,
|
|
@@ -430806,7 +431101,7 @@ var init_codebaseSearch = __esm({
|
|
|
430806
431101
|
reviewFailed = false;
|
|
430807
431102
|
removedCount = 0;
|
|
430808
431103
|
suggestion = void 0;
|
|
430809
|
-
logger.info(`Agent review disabled, returning all ${finalResults.length} search results`);
|
|
431104
|
+
logger.info(`Agent review & reranking disabled, returning all ${finalResults.length} search results`);
|
|
430810
431105
|
}
|
|
430811
431106
|
lastResults = {
|
|
430812
431107
|
query,
|
|
@@ -430819,7 +431114,7 @@ var init_codebaseSearch = __esm({
|
|
|
430819
431114
|
suggestion,
|
|
430820
431115
|
searchAttempts: searchAttempt
|
|
430821
431116
|
};
|
|
430822
|
-
if (!enableAgentReview) {
|
|
431117
|
+
if (!enableAgentReview && !enableReranking) {
|
|
430823
431118
|
codebaseSearchEvents.emitSearchEvent({
|
|
430824
431119
|
type: "search-complete",
|
|
430825
431120
|
attempt: searchAttempt,
|
|
@@ -430832,8 +431127,20 @@ var init_codebaseSearch = __esm({
|
|
|
430832
431127
|
db.close();
|
|
430833
431128
|
return lastResults;
|
|
430834
431129
|
}
|
|
431130
|
+
if (enableReranking && !reviewFailed) {
|
|
431131
|
+
codebaseSearchEvents.emitSearchEvent({
|
|
431132
|
+
type: "search-complete",
|
|
431133
|
+
attempt: searchAttempt,
|
|
431134
|
+
maxAttempts: MAX_SEARCH_RETRIES,
|
|
431135
|
+
currentTopN,
|
|
431136
|
+
message: `Search complete`,
|
|
431137
|
+
query: currentQuery
|
|
431138
|
+
});
|
|
431139
|
+
db.close();
|
|
431140
|
+
return lastResults;
|
|
431141
|
+
}
|
|
430835
431142
|
if (reviewFailed) {
|
|
430836
|
-
logger.info("Review failed, returning all results without retry");
|
|
431143
|
+
logger.info("Review/reranking failed, returning all results without retry");
|
|
430837
431144
|
codebaseSearchEvents.emitSearchEvent({
|
|
430838
431145
|
type: "search-complete",
|
|
430839
431146
|
attempt: searchAttempt,
|
|
@@ -430892,7 +431199,7 @@ var init_codebaseSearch = __esm({
|
|
|
430892
431199
|
return lastResults;
|
|
430893
431200
|
} catch (error40) {
|
|
430894
431201
|
logger.error("Codebase search failed:", error40);
|
|
430895
|
-
if (enableAgentReview) {
|
|
431202
|
+
if (enableAgentReview || enableReranking) {
|
|
430896
431203
|
codebaseSearchEvents.emitSearchEvent({
|
|
430897
431204
|
type: "search-complete",
|
|
430898
431205
|
attempt: 0,
|
|
@@ -434879,13 +435186,35 @@ async function handleContextCompression(ctx, config3, model) {
|
|
|
434879
435186
|
const lockId = ctx.instanceId || `subagent-${ctx.agent.id}`;
|
|
434880
435187
|
await compressionCoordinator.acquireLock(lockId);
|
|
434881
435188
|
try {
|
|
434882
|
-
const
|
|
434883
|
-
|
|
434884
|
-
|
|
434885
|
-
|
|
434886
|
-
|
|
434887
|
-
|
|
434888
|
-
|
|
435189
|
+
const COMPRESS_MAX_RETRIES = 3;
|
|
435190
|
+
const COMPRESS_RETRY_BASE_DELAY = 1e3;
|
|
435191
|
+
let compressionResult;
|
|
435192
|
+
for (let retryAttempt = 0; retryAttempt <= COMPRESS_MAX_RETRIES; retryAttempt++) {
|
|
435193
|
+
try {
|
|
435194
|
+
compressionResult = await compressSubAgentContext(ctx.messages, ctx.latestTotalTokens, config3.maxContextTokens, {
|
|
435195
|
+
model,
|
|
435196
|
+
requestMethod: config3.requestMethod,
|
|
435197
|
+
maxTokens: config3.maxTokens,
|
|
435198
|
+
configProfile: ctx.agent.configProfile
|
|
435199
|
+
});
|
|
435200
|
+
break;
|
|
435201
|
+
} catch (retryError) {
|
|
435202
|
+
if (retryAttempt < COMPRESS_MAX_RETRIES) {
|
|
435203
|
+
const retryDelay = COMPRESS_RETRY_BASE_DELAY * Math.pow(2, retryAttempt);
|
|
435204
|
+
emitSubAgentMessage(ctx, {
|
|
435205
|
+
type: "context_compress_retrying",
|
|
435206
|
+
attempt: retryAttempt + 1,
|
|
435207
|
+
maxRetries: COMPRESS_MAX_RETRIES,
|
|
435208
|
+
error: retryError instanceof Error ? retryError.message : String(retryError)
|
|
435209
|
+
});
|
|
435210
|
+
console.warn(`[SubAgent:${ctx.agent.name}] Compression failed, retrying (${retryAttempt + 1}/${COMPRESS_MAX_RETRIES}) in ${retryDelay / 1e3}s...`, retryError);
|
|
435211
|
+
await new Promise((resolve13) => setTimeout(resolve13, retryDelay));
|
|
435212
|
+
continue;
|
|
435213
|
+
}
|
|
435214
|
+
throw retryError;
|
|
435215
|
+
}
|
|
435216
|
+
}
|
|
435217
|
+
if (compressionResult == null ? void 0 : compressionResult.compressed) {
|
|
434889
435218
|
ctx.messages.length = 0;
|
|
434890
435219
|
ctx.messages.push(...compressionResult.messages);
|
|
434891
435220
|
if (compressionResult.afterTokensEstimate) {
|
|
@@ -434900,7 +435229,7 @@ async function handleContextCompression(ctx, config3, model) {
|
|
|
434900
435229
|
return true;
|
|
434901
435230
|
}
|
|
434902
435231
|
} catch (compressError) {
|
|
434903
|
-
console.error(`[SubAgent:${ctx.agent.name}] Context compression failed:`, compressError);
|
|
435232
|
+
console.error(`[SubAgent:${ctx.agent.name}] Context compression failed after retries:`, compressError);
|
|
434904
435233
|
} finally {
|
|
434905
435234
|
compressionCoordinator.releaseLock(lockId);
|
|
434906
435235
|
}
|
|
@@ -435223,6 +435552,7 @@ __export(sensitiveCommandManager_exports, {
|
|
|
435223
435552
|
PRESET_SENSITIVE_COMMANDS: () => PRESET_SENSITIVE_COMMANDS,
|
|
435224
435553
|
addSensitiveCommand: () => addSensitiveCommand,
|
|
435225
435554
|
getAllSensitiveCommands: () => getAllSensitiveCommands,
|
|
435555
|
+
isDuplicatePattern: () => isDuplicatePattern,
|
|
435226
435556
|
isSensitiveCommand: () => isSensitiveCommand,
|
|
435227
435557
|
loadSensitiveCommands: () => loadSensitiveCommands,
|
|
435228
435558
|
removeSensitiveCommand: () => removeSensitiveCommand,
|
|
@@ -435234,46 +435564,81 @@ __export(sensitiveCommandManager_exports, {
|
|
|
435234
435564
|
import { homedir as homedir10 } from "os";
|
|
435235
435565
|
import { join as join19 } from "path";
|
|
435236
435566
|
import { readFileSync as readFileSync18, writeFileSync as writeFileSync11, existsSync as existsSync19, mkdirSync as mkdirSync11 } from "fs";
|
|
435237
|
-
function
|
|
435238
|
-
|
|
435239
|
-
|
|
435567
|
+
function getProjectConfigDir2() {
|
|
435568
|
+
return join19(process.cwd(), ".snow");
|
|
435569
|
+
}
|
|
435570
|
+
function getProjectConfigPath2() {
|
|
435571
|
+
return join19(getProjectConfigDir2(), "sensitive-commands.json");
|
|
435572
|
+
}
|
|
435573
|
+
function ensureDirectory(dir) {
|
|
435574
|
+
if (!existsSync19(dir)) {
|
|
435575
|
+
mkdirSync11(dir, { recursive: true });
|
|
435240
435576
|
}
|
|
435241
435577
|
}
|
|
435242
|
-
function
|
|
435243
|
-
|
|
435244
|
-
|
|
435245
|
-
|
|
435246
|
-
|
|
435247
|
-
|
|
435248
|
-
|
|
435249
|
-
|
|
435578
|
+
function loadScopedConfig(scope) {
|
|
435579
|
+
const dir = scope === "project" ? getProjectConfigDir2() : GLOBAL_CONFIG_DIR;
|
|
435580
|
+
const file2 = scope === "project" ? getProjectConfigPath2() : GLOBAL_SENSITIVE_FILE;
|
|
435581
|
+
ensureDirectory(dir);
|
|
435582
|
+
if (!existsSync19(file2)) {
|
|
435583
|
+
if (scope === "global") {
|
|
435584
|
+
const defaultConfig = {
|
|
435585
|
+
commands: [...PRESET_SENSITIVE_COMMANDS]
|
|
435586
|
+
};
|
|
435587
|
+
saveScopedConfig("global", defaultConfig);
|
|
435588
|
+
return defaultConfig;
|
|
435589
|
+
}
|
|
435590
|
+
return { commands: [] };
|
|
435250
435591
|
}
|
|
435251
435592
|
try {
|
|
435252
|
-
const configData = readFileSync18(
|
|
435593
|
+
const configData = readFileSync18(file2, "utf8");
|
|
435253
435594
|
const config3 = JSON.parse(configData);
|
|
435254
|
-
|
|
435255
|
-
|
|
435256
|
-
|
|
435257
|
-
|
|
435258
|
-
|
|
435595
|
+
if (scope === "global") {
|
|
435596
|
+
const existingIds = new Set(config3.commands.map((cmd) => cmd.id));
|
|
435597
|
+
const newPresets = PRESET_SENSITIVE_COMMANDS.filter((preset) => !existingIds.has(preset.id));
|
|
435598
|
+
if (newPresets.length > 0) {
|
|
435599
|
+
config3.commands = [...config3.commands, ...newPresets];
|
|
435600
|
+
saveScopedConfig("global", config3);
|
|
435601
|
+
}
|
|
435259
435602
|
}
|
|
435260
435603
|
return config3;
|
|
435261
|
-
} catch
|
|
435262
|
-
|
|
435263
|
-
|
|
435604
|
+
} catch {
|
|
435605
|
+
if (scope === "global") {
|
|
435606
|
+
return { commands: [...PRESET_SENSITIVE_COMMANDS] };
|
|
435607
|
+
}
|
|
435608
|
+
return { commands: [] };
|
|
435264
435609
|
}
|
|
435265
435610
|
}
|
|
435266
|
-
function
|
|
435267
|
-
|
|
435611
|
+
function saveScopedConfig(scope, config3) {
|
|
435612
|
+
const dir = scope === "project" ? getProjectConfigDir2() : GLOBAL_CONFIG_DIR;
|
|
435613
|
+
const file2 = scope === "project" ? getProjectConfigPath2() : GLOBAL_SENSITIVE_FILE;
|
|
435614
|
+
ensureDirectory(dir);
|
|
435268
435615
|
try {
|
|
435269
435616
|
const configData = JSON.stringify(config3, null, 2);
|
|
435270
|
-
writeFileSync11(
|
|
435617
|
+
writeFileSync11(file2, configData, "utf8");
|
|
435271
435618
|
} catch (error40) {
|
|
435272
435619
|
throw new Error(`Failed to save sensitive commands config: ${error40}`);
|
|
435273
435620
|
}
|
|
435274
435621
|
}
|
|
435275
|
-
function
|
|
435276
|
-
|
|
435622
|
+
function loadSensitiveCommands() {
|
|
435623
|
+
return loadScopedConfig("global");
|
|
435624
|
+
}
|
|
435625
|
+
function saveSensitiveCommands(config3) {
|
|
435626
|
+
saveScopedConfig("global", config3);
|
|
435627
|
+
}
|
|
435628
|
+
function isDuplicatePattern(pattern) {
|
|
435629
|
+
const allCommands = getAllSensitiveCommands();
|
|
435630
|
+
const duplicate = allCommands.find((cmd) => cmd.pattern.trim() === pattern.trim());
|
|
435631
|
+
if (duplicate) {
|
|
435632
|
+
return { isDuplicate: true, existingScope: duplicate.scope };
|
|
435633
|
+
}
|
|
435634
|
+
return { isDuplicate: false };
|
|
435635
|
+
}
|
|
435636
|
+
function addSensitiveCommand(pattern, description, scope = "global") {
|
|
435637
|
+
const { isDuplicate, existingScope } = isDuplicatePattern(pattern);
|
|
435638
|
+
if (isDuplicate) {
|
|
435639
|
+
throw new Error(`DUPLICATE:${existingScope}`);
|
|
435640
|
+
}
|
|
435641
|
+
const config3 = loadScopedConfig(scope);
|
|
435277
435642
|
const id = `custom-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
435278
435643
|
config3.commands.push({
|
|
435279
435644
|
id,
|
|
@@ -435282,36 +435647,56 @@ function addSensitiveCommand(pattern, description) {
|
|
|
435282
435647
|
enabled: true,
|
|
435283
435648
|
isPreset: false
|
|
435284
435649
|
});
|
|
435285
|
-
|
|
435286
|
-
}
|
|
435287
|
-
function removeSensitiveCommand(id) {
|
|
435288
|
-
|
|
435289
|
-
|
|
435290
|
-
|
|
435291
|
-
|
|
435292
|
-
|
|
435293
|
-
|
|
435294
|
-
|
|
435295
|
-
|
|
435296
|
-
|
|
435297
|
-
|
|
435298
|
-
|
|
435299
|
-
|
|
435300
|
-
|
|
435301
|
-
|
|
435302
|
-
|
|
435303
|
-
|
|
435304
|
-
|
|
435305
|
-
|
|
435650
|
+
saveScopedConfig(scope, config3);
|
|
435651
|
+
}
|
|
435652
|
+
function removeSensitiveCommand(id, scope) {
|
|
435653
|
+
if (scope) {
|
|
435654
|
+
const config3 = loadScopedConfig(scope);
|
|
435655
|
+
config3.commands = config3.commands.filter((cmd) => cmd.id !== id);
|
|
435656
|
+
saveScopedConfig(scope, config3);
|
|
435657
|
+
} else {
|
|
435658
|
+
for (const s of ["global", "project"]) {
|
|
435659
|
+
const config3 = loadScopedConfig(s);
|
|
435660
|
+
const before2 = config3.commands.length;
|
|
435661
|
+
config3.commands = config3.commands.filter((cmd) => cmd.id !== id);
|
|
435662
|
+
if (config3.commands.length < before2) {
|
|
435663
|
+
saveScopedConfig(s, config3);
|
|
435664
|
+
return;
|
|
435665
|
+
}
|
|
435666
|
+
}
|
|
435667
|
+
}
|
|
435668
|
+
}
|
|
435669
|
+
function updateSensitiveCommand(id, updates, scope) {
|
|
435670
|
+
const scopesToSearch = scope ? [scope] : ["global", "project"];
|
|
435671
|
+
for (const s of scopesToSearch) {
|
|
435672
|
+
const config3 = loadScopedConfig(s);
|
|
435673
|
+
const commandIndex = config3.commands.findIndex((cmd) => cmd.id === id);
|
|
435674
|
+
if (commandIndex !== -1) {
|
|
435675
|
+
const existingCommand = config3.commands[commandIndex];
|
|
435676
|
+
config3.commands[commandIndex] = {
|
|
435677
|
+
...existingCommand,
|
|
435678
|
+
...updates,
|
|
435679
|
+
id: existingCommand.id,
|
|
435680
|
+
isPreset: existingCommand.isPreset
|
|
435681
|
+
};
|
|
435682
|
+
saveScopedConfig(s, config3);
|
|
435683
|
+
return;
|
|
435684
|
+
}
|
|
435685
|
+
}
|
|
435686
|
+
throw new Error(`Sensitive command with id "${id}" not found`);
|
|
435306
435687
|
}
|
|
435307
|
-
function toggleSensitiveCommand(id) {
|
|
435308
|
-
const
|
|
435309
|
-
const
|
|
435310
|
-
|
|
435311
|
-
|
|
435688
|
+
function toggleSensitiveCommand(id, scope) {
|
|
435689
|
+
const scopesToSearch = scope ? [scope] : ["global", "project"];
|
|
435690
|
+
for (const s of scopesToSearch) {
|
|
435691
|
+
const config3 = loadScopedConfig(s);
|
|
435692
|
+
const command = config3.commands.find((cmd) => cmd.id === id);
|
|
435693
|
+
if (command) {
|
|
435694
|
+
command.enabled = !command.enabled;
|
|
435695
|
+
saveScopedConfig(s, config3);
|
|
435696
|
+
return;
|
|
435697
|
+
}
|
|
435312
435698
|
}
|
|
435313
|
-
command
|
|
435314
|
-
saveSensitiveCommands(config3);
|
|
435699
|
+
throw new Error(`Sensitive command with id "${id}" not found`);
|
|
435315
435700
|
}
|
|
435316
435701
|
function patternToRegex(pattern) {
|
|
435317
435702
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
@@ -435323,8 +435708,8 @@ function splitCommand(command) {
|
|
|
435323
435708
|
return parts.filter((part) => part.trim().length > 0);
|
|
435324
435709
|
}
|
|
435325
435710
|
function isSensitiveCommand(command) {
|
|
435326
|
-
const
|
|
435327
|
-
const enabledCommands =
|
|
435711
|
+
const allCommands = getAllSensitiveCommands();
|
|
435712
|
+
const enabledCommands = allCommands.filter((cmd) => cmd.enabled);
|
|
435328
435713
|
const commandParts = splitCommand(command);
|
|
435329
435714
|
for (const part of commandParts) {
|
|
435330
435715
|
const trimmedPart = part.trim();
|
|
@@ -435339,21 +435724,32 @@ ${trimmedPart}`) || regex2.test(trimmedPart)) {
|
|
|
435339
435724
|
return { isSensitive: false };
|
|
435340
435725
|
}
|
|
435341
435726
|
function getAllSensitiveCommands() {
|
|
435342
|
-
const
|
|
435343
|
-
|
|
435727
|
+
const globalConfig2 = loadScopedConfig("global");
|
|
435728
|
+
const projectConfig = loadScopedConfig("project");
|
|
435729
|
+
const globalCommands = globalConfig2.commands.map((cmd) => ({
|
|
435730
|
+
...cmd,
|
|
435731
|
+
scope: "global"
|
|
435732
|
+
}));
|
|
435733
|
+
const projectCommands = projectConfig.commands.map((cmd) => ({
|
|
435734
|
+
...cmd,
|
|
435735
|
+
scope: "project"
|
|
435736
|
+
}));
|
|
435737
|
+
return [...globalCommands, ...projectCommands];
|
|
435344
435738
|
}
|
|
435345
|
-
function resetToDefaults() {
|
|
435346
|
-
|
|
435347
|
-
commands: [...PRESET_SENSITIVE_COMMANDS]
|
|
435348
|
-
}
|
|
435349
|
-
|
|
435739
|
+
function resetToDefaults(scope) {
|
|
435740
|
+
if (!scope || scope === "global") {
|
|
435741
|
+
saveScopedConfig("global", { commands: [...PRESET_SENSITIVE_COMMANDS] });
|
|
435742
|
+
}
|
|
435743
|
+
if (!scope || scope === "project") {
|
|
435744
|
+
saveScopedConfig("project", { commands: [] });
|
|
435745
|
+
}
|
|
435350
435746
|
}
|
|
435351
|
-
var
|
|
435747
|
+
var GLOBAL_CONFIG_DIR, GLOBAL_SENSITIVE_FILE, PRESET_SENSITIVE_COMMANDS;
|
|
435352
435748
|
var init_sensitiveCommandManager = __esm({
|
|
435353
435749
|
"dist/utils/execution/sensitiveCommandManager.js"() {
|
|
435354
435750
|
"use strict";
|
|
435355
|
-
|
|
435356
|
-
|
|
435751
|
+
GLOBAL_CONFIG_DIR = join19(homedir10(), ".snow");
|
|
435752
|
+
GLOBAL_SENSITIVE_FILE = join19(GLOBAL_CONFIG_DIR, "sensitive-commands.json");
|
|
435357
435753
|
PRESET_SENSITIVE_COMMANDS = [
|
|
435358
435754
|
{
|
|
435359
435755
|
id: "rm",
|
|
@@ -437722,8 +438118,37 @@ ${msg.content}`
|
|
|
437722
438118
|
}
|
|
437723
438119
|
await compressionCoordinator.acquireLock(instanceId);
|
|
437724
438120
|
try {
|
|
437725
|
-
const
|
|
437726
|
-
|
|
438121
|
+
const COMPRESS_MAX_RETRIES = 3;
|
|
438122
|
+
const COMPRESS_RETRY_BASE_DELAY = 1e3;
|
|
438123
|
+
let compressionResult;
|
|
438124
|
+
for (let retryAttempt = 0; retryAttempt <= COMPRESS_MAX_RETRIES; retryAttempt++) {
|
|
438125
|
+
try {
|
|
438126
|
+
compressionResult = await compressSubAgentContext2(messages, latestTotalTokens, config3.maxContextTokens, { model, requestMethod: config3.requestMethod, maxTokens: config3.maxTokens });
|
|
438127
|
+
break;
|
|
438128
|
+
} catch (retryError) {
|
|
438129
|
+
if (retryAttempt < COMPRESS_MAX_RETRIES) {
|
|
438130
|
+
const retryDelay = COMPRESS_RETRY_BASE_DELAY * Math.pow(2, retryAttempt);
|
|
438131
|
+
if (onMessage) {
|
|
438132
|
+
onMessage({
|
|
438133
|
+
type: "sub_agent_message",
|
|
438134
|
+
agentId: `teammate-${memberId}`,
|
|
438135
|
+
agentName: memberName,
|
|
438136
|
+
message: {
|
|
438137
|
+
type: "context_compress_retrying",
|
|
438138
|
+
attempt: retryAttempt + 1,
|
|
438139
|
+
maxRetries: COMPRESS_MAX_RETRIES,
|
|
438140
|
+
error: retryError instanceof Error ? retryError.message : String(retryError)
|
|
438141
|
+
}
|
|
438142
|
+
});
|
|
438143
|
+
}
|
|
438144
|
+
console.warn(`[Teammate:${memberName}] Compression failed, retrying (${retryAttempt + 1}/${COMPRESS_MAX_RETRIES}) in ${retryDelay / 1e3}s...`, retryError);
|
|
438145
|
+
await new Promise((resolve13) => setTimeout(resolve13, retryDelay));
|
|
438146
|
+
continue;
|
|
438147
|
+
}
|
|
438148
|
+
throw retryError;
|
|
438149
|
+
}
|
|
438150
|
+
}
|
|
438151
|
+
if (compressionResult == null ? void 0 : compressionResult.compressed) {
|
|
437727
438152
|
messages.length = 0;
|
|
437728
438153
|
messages.push(...compressionResult.messages);
|
|
437729
438154
|
justCompressed = true;
|
|
@@ -437745,7 +438170,7 @@ ${msg.content}`
|
|
|
437745
438170
|
console.log(`[Teammate:${memberName}] Context compressed: ${compressionResult.beforeTokens} \u2192 ~${compressionResult.afterTokensEstimate} tokens`);
|
|
437746
438171
|
}
|
|
437747
438172
|
} catch (compressError) {
|
|
437748
|
-
console.error(`[Teammate:${memberName}] Context compression failed:`, compressError);
|
|
438173
|
+
console.error(`[Teammate:${memberName}] Context compression failed after retries:`, compressError);
|
|
437749
438174
|
} finally {
|
|
437750
438175
|
compressionCoordinator.releaseLock(instanceId);
|
|
437751
438176
|
}
|
|
@@ -438533,6 +438958,8 @@ var init_subAgentMessageHandler = __esm({
|
|
|
438533
438958
|
return this.handleContextUsage(prev, subAgentMessage);
|
|
438534
438959
|
case "context_compressing":
|
|
438535
438960
|
return this.handleContextCompressing(prev, subAgentMessage);
|
|
438961
|
+
case "context_compress_retrying":
|
|
438962
|
+
return this.handleContextCompressRetrying(prev, subAgentMessage);
|
|
438536
438963
|
case "context_compressed":
|
|
438537
438964
|
return this.handleContextCompressed(prev, subAgentMessage);
|
|
438538
438965
|
case "inter_agent_sent":
|
|
@@ -438939,6 +439366,23 @@ var init_subAgentMessageHandler = __esm({
|
|
|
438939
439366
|
}
|
|
438940
439367
|
];
|
|
438941
439368
|
}
|
|
439369
|
+
handleContextCompressRetrying(prev, subAgentMessage) {
|
|
439370
|
+
const msg = subAgentMessage.message;
|
|
439371
|
+
return [
|
|
439372
|
+
...prev,
|
|
439373
|
+
{
|
|
439374
|
+
role: "subagent",
|
|
439375
|
+
content: `\x1B[36m\u2687 ${subAgentMessage.agentName}\x1B[0m \x1B[33m\u27F3 Compression retry (${msg.attempt}/${msg.maxRetries})...\x1B[0m${msg.error ? ` \x1B[90m${msg.error}\x1B[0m` : ""}`,
|
|
439376
|
+
streaming: false,
|
|
439377
|
+
subAgent: {
|
|
439378
|
+
agentId: subAgentMessage.agentId,
|
|
439379
|
+
agentName: subAgentMessage.agentName,
|
|
439380
|
+
isComplete: false
|
|
439381
|
+
},
|
|
439382
|
+
subAgentInternal: true
|
|
439383
|
+
}
|
|
439384
|
+
];
|
|
439385
|
+
}
|
|
438942
439386
|
handleContextCompressed(prev, subAgentMessage) {
|
|
438943
439387
|
const msg = subAgentMessage.message;
|
|
438944
439388
|
return [
|
|
@@ -444044,18 +444488,18 @@ var init_skills = __esm({
|
|
|
444044
444488
|
import fs36 from "node:fs";
|
|
444045
444489
|
import os19 from "node:os";
|
|
444046
444490
|
import path42 from "node:path";
|
|
444047
|
-
function
|
|
444491
|
+
function getProjectConfigPath3() {
|
|
444048
444492
|
return path42.join(process.cwd(), ".snow", CONFIG_FILE3);
|
|
444049
444493
|
}
|
|
444050
444494
|
function getGlobalConfigPath2() {
|
|
444051
444495
|
return path42.join(os19.homedir(), ".snow", CONFIG_FILE3);
|
|
444052
444496
|
}
|
|
444053
444497
|
function getConfigPath2() {
|
|
444054
|
-
return
|
|
444498
|
+
return getProjectConfigPath3();
|
|
444055
444499
|
}
|
|
444056
444500
|
function getDisabledBuiltInServices() {
|
|
444057
444501
|
try {
|
|
444058
|
-
const projectConfigPath =
|
|
444502
|
+
const projectConfigPath = getProjectConfigPath3();
|
|
444059
444503
|
const globalConfigPath = getGlobalConfigPath2();
|
|
444060
444504
|
if (fs36.existsSync(projectConfigPath)) {
|
|
444061
444505
|
const data = JSON.parse(fs36.readFileSync(projectConfigPath, "utf-8"));
|
|
@@ -444105,7 +444549,7 @@ var init_disabledBuiltInTools = __esm({
|
|
|
444105
444549
|
import fs37 from "node:fs";
|
|
444106
444550
|
import os20 from "node:os";
|
|
444107
444551
|
import path43 from "node:path";
|
|
444108
|
-
function
|
|
444552
|
+
function getProjectConfigPath4() {
|
|
444109
444553
|
return path43.join(process.cwd(), ".snow", CONFIG_FILE4);
|
|
444110
444554
|
}
|
|
444111
444555
|
function getGlobalConfigPath3() {
|
|
@@ -444133,11 +444577,11 @@ function makeToolKey(serviceName, toolName) {
|
|
|
444133
444577
|
}
|
|
444134
444578
|
function getDisabledMCPTools() {
|
|
444135
444579
|
const globalDisabled = readConfig(getGlobalConfigPath3());
|
|
444136
|
-
const projectDisabled = readConfig(
|
|
444580
|
+
const projectDisabled = readConfig(getProjectConfigPath4());
|
|
444137
444581
|
return [.../* @__PURE__ */ new Set([...globalDisabled, ...projectDisabled])];
|
|
444138
444582
|
}
|
|
444139
444583
|
function getDisabledMCPToolsByScope(scope) {
|
|
444140
|
-
const configPath = scope === "project" ?
|
|
444584
|
+
const configPath = scope === "project" ? getProjectConfigPath4() : getGlobalConfigPath3();
|
|
444141
444585
|
return readConfig(configPath);
|
|
444142
444586
|
}
|
|
444143
444587
|
function isMCPToolEnabled(serviceName, toolName) {
|
|
@@ -444145,7 +444589,7 @@ function isMCPToolEnabled(serviceName, toolName) {
|
|
|
444145
444589
|
return !getDisabledMCPTools().includes(key);
|
|
444146
444590
|
}
|
|
444147
444591
|
function toggleMCPTool(serviceName, toolName, scope) {
|
|
444148
|
-
const configPath = scope === "project" ?
|
|
444592
|
+
const configPath = scope === "project" ? getProjectConfigPath4() : getGlobalConfigPath3();
|
|
444149
444593
|
const disabled = readConfig(configPath);
|
|
444150
444594
|
const key = makeToolKey(serviceName, toolName);
|
|
444151
444595
|
const index = disabled.indexOf(key);
|
|
@@ -448332,9 +448776,9 @@ import { existsSync as existsSync26, mkdirSync as mkdirSync16, readFileSync as r
|
|
|
448332
448776
|
import { homedir as homedir15 } from "os";
|
|
448333
448777
|
import { join as join26 } from "path";
|
|
448334
448778
|
import { promisify } from "util";
|
|
448335
|
-
function
|
|
448336
|
-
if (!existsSync26(
|
|
448337
|
-
mkdirSync16(
|
|
448779
|
+
function ensureConfigDirectory4() {
|
|
448780
|
+
if (!existsSync26(CONFIG_DIR5)) {
|
|
448781
|
+
mkdirSync16(CONFIG_DIR5, { recursive: true });
|
|
448338
448782
|
}
|
|
448339
448783
|
}
|
|
448340
448784
|
function isRecord(value) {
|
|
@@ -448406,7 +448850,7 @@ function getDefaultConfigFile() {
|
|
|
448406
448850
|
};
|
|
448407
448851
|
}
|
|
448408
448852
|
function loadServersFromDisk() {
|
|
448409
|
-
|
|
448853
|
+
ensureConfigDirectory4();
|
|
448410
448854
|
if (!existsSync26(LSP_CONFIG_FILE)) {
|
|
448411
448855
|
try {
|
|
448412
448856
|
writeFileSync16(LSP_CONFIG_FILE, JSON.stringify(getDefaultConfigFile(), null, 2), "utf8");
|
|
@@ -448425,13 +448869,13 @@ function loadServersFromDisk() {
|
|
|
448425
448869
|
return DEFAULT_LSP_SERVERS;
|
|
448426
448870
|
}
|
|
448427
448871
|
}
|
|
448428
|
-
var execAsync,
|
|
448872
|
+
var execAsync, CONFIG_DIR5, LSP_CONFIG_FILE, DEFAULT_LSP_SERVERS, LSPServerRegistry;
|
|
448429
448873
|
var init_LSPServerRegistry = __esm({
|
|
448430
448874
|
"dist/mcp/lsp/LSPServerRegistry.js"() {
|
|
448431
448875
|
"use strict";
|
|
448432
448876
|
execAsync = promisify(exec6);
|
|
448433
|
-
|
|
448434
|
-
LSP_CONFIG_FILE = join26(
|
|
448877
|
+
CONFIG_DIR5 = join26(homedir15(), ".snow");
|
|
448878
|
+
LSP_CONFIG_FILE = join26(CONFIG_DIR5, "lsp-config.json");
|
|
448435
448879
|
DEFAULT_LSP_SERVERS = {
|
|
448436
448880
|
typescript: {
|
|
448437
448881
|
command: "typescript-language-server",
|
|
@@ -450100,7 +450544,7 @@ AI Tip: Make sure to provide the 'filePath' parameter as a string.`);
|
|
|
450100
450544
|
Received args: ${JSON.stringify(args2, null, 2)}
|
|
450101
450545
|
AI Tip: Make sure to provide the 'content' parameter as a string (can be empty string "").`);
|
|
450102
450546
|
}
|
|
450103
|
-
result2 = await filesystemService2.createFile(args2.filePath, args2.content, args2.createDirectories);
|
|
450547
|
+
result2 = await filesystemService2.createFile(args2.filePath, args2.content, args2.createDirectories, args2.overwrite);
|
|
450104
450548
|
break;
|
|
450105
450549
|
case "edit":
|
|
450106
450550
|
if (!args2.filePath) {
|
|
@@ -452549,13 +452993,13 @@ __export(languageConfig_exports, {
|
|
|
452549
452993
|
import { homedir as homedir17 } from "os";
|
|
452550
452994
|
import { join as join29 } from "path";
|
|
452551
452995
|
import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync24, writeFileSync as writeFileSync17 } from "fs";
|
|
452552
|
-
function
|
|
452553
|
-
if (!existsSync28(
|
|
452554
|
-
mkdirSync17(
|
|
452996
|
+
function ensureConfigDirectory5() {
|
|
452997
|
+
if (!existsSync28(CONFIG_DIR6)) {
|
|
452998
|
+
mkdirSync17(CONFIG_DIR6, { recursive: true });
|
|
452555
452999
|
}
|
|
452556
453000
|
}
|
|
452557
453001
|
function loadLanguageConfig() {
|
|
452558
|
-
|
|
453002
|
+
ensureConfigDirectory5();
|
|
452559
453003
|
if (!existsSync28(LANGUAGE_CONFIG_FILE)) {
|
|
452560
453004
|
saveLanguageConfig(DEFAULT_CONFIG3);
|
|
452561
453005
|
return DEFAULT_CONFIG3;
|
|
@@ -452572,7 +453016,7 @@ function loadLanguageConfig() {
|
|
|
452572
453016
|
}
|
|
452573
453017
|
}
|
|
452574
453018
|
function saveLanguageConfig(config3) {
|
|
452575
|
-
|
|
453019
|
+
ensureConfigDirectory5();
|
|
452576
453020
|
try {
|
|
452577
453021
|
const configData = JSON.stringify(config3, null, 2);
|
|
452578
453022
|
writeFileSync17(LANGUAGE_CONFIG_FILE, configData, "utf-8");
|
|
@@ -452587,12 +453031,12 @@ function getCurrentLanguage() {
|
|
|
452587
453031
|
function setCurrentLanguage(language) {
|
|
452588
453032
|
saveLanguageConfig({ language });
|
|
452589
453033
|
}
|
|
452590
|
-
var
|
|
453034
|
+
var CONFIG_DIR6, LANGUAGE_CONFIG_FILE, DEFAULT_CONFIG3;
|
|
452591
453035
|
var init_languageConfig = __esm({
|
|
452592
453036
|
"dist/utils/config/languageConfig.js"() {
|
|
452593
453037
|
"use strict";
|
|
452594
|
-
|
|
452595
|
-
LANGUAGE_CONFIG_FILE = join29(
|
|
453038
|
+
CONFIG_DIR6 = join29(homedir17(), ".snow");
|
|
453039
|
+
LANGUAGE_CONFIG_FILE = join29(CONFIG_DIR6, "language.json");
|
|
452596
453040
|
DEFAULT_CONFIG3 = {
|
|
452597
453041
|
language: "en"
|
|
452598
453042
|
};
|
|
@@ -452684,6 +453128,10 @@ var init_en2 = __esm({
|
|
|
452684
453128
|
embeddingApiKey: "Embedding API Key:",
|
|
452685
453129
|
embeddingApiKeyOptional: "Embedding API Key (Optional for local):",
|
|
452686
453130
|
embeddingDimensions: "Embedding Dimensions:",
|
|
453131
|
+
embeddingSettingsGroup: "Embedding Model Config",
|
|
453132
|
+
embeddingSettingsExpandHint: "(Press Enter to expand/collapse)",
|
|
453133
|
+
batchSettingsGroup: "Batch Settings",
|
|
453134
|
+
batchSettingsExpandHint: "(Press Enter to expand/collapse)",
|
|
452687
453135
|
batchMaxLines: "Batch Max Lines:",
|
|
452688
453136
|
batchConcurrency: "Batch Concurrency:",
|
|
452689
453137
|
notSet: "Not set",
|
|
@@ -452705,6 +453153,19 @@ var init_en2 = __esm({
|
|
|
452705
453153
|
chunkingMinLinesPerChunk: "Min Lines Per Chunk:",
|
|
452706
453154
|
chunkingMinCharsPerChunk: "Min Characters Per Chunk:",
|
|
452707
453155
|
chunkingOverlapLines: "Overlap Lines:",
|
|
453156
|
+
rerankingToggle: "Result Reranking:",
|
|
453157
|
+
rerankingSettingsGroup: "Reranking Model Config",
|
|
453158
|
+
rerankingSettingsExpandHint: "(Press Enter to expand/collapse)",
|
|
453159
|
+
rerankingModelName: "Model Name:",
|
|
453160
|
+
rerankingBaseUrl: "Base URL:",
|
|
453161
|
+
rerankingApiKey: "API Key:",
|
|
453162
|
+
rerankingContextLength: "Model Context Length:",
|
|
453163
|
+
rerankingTopN: "Top N:",
|
|
453164
|
+
rerankingNotConfigured: 'Please configure Model Name and Base URL in "Reranking Model Config" first',
|
|
453165
|
+
validationRerankingModelNameRequired: "Reranking model name is required when enabled",
|
|
453166
|
+
validationRerankingBaseUrlRequired: "Reranking base URL is required when enabled",
|
|
453167
|
+
validationRerankingContextLengthPositive: "Model context length must be greater than 0",
|
|
453168
|
+
validationRerankingTopNPositive: "Top N must be greater than 0",
|
|
452708
453169
|
saveError: "Failed to save configuration",
|
|
452709
453170
|
gitignoreNotFound: "Cannot create index: .gitignore file not found. Please add a .gitignore file to your project to prevent indexing unnecessary files.",
|
|
452710
453171
|
enterValue: "Enter value:"
|
|
@@ -452961,8 +453422,18 @@ var init_en2 = __esm({
|
|
|
452961
453422
|
enabled: "Enabled",
|
|
452962
453423
|
disabled: "Disabled",
|
|
452963
453424
|
customLabel: "Custom",
|
|
453425
|
+
// Scope
|
|
453426
|
+
scopeProject: "Project",
|
|
453427
|
+
scopeGlobal: "Global",
|
|
453428
|
+
scopeSelectTitle: "Select scope for new command",
|
|
453429
|
+
scopeSelectHint: "\u2191\u2193: Navigate \u2022 Enter: Select \u2022 Esc: Cancel",
|
|
453430
|
+
duplicatePattern: 'Pattern "{pattern}" already exists in {scope} scope',
|
|
453431
|
+
resetScopeSelectTitle: "Select scope to reset",
|
|
453432
|
+
resetGlobalDesc: "Restore to default preset commands",
|
|
453433
|
+
resetProjectDesc: "Clear all project custom commands",
|
|
453434
|
+
confirmResetScopeMessage: "\u26A0\uFE0F Press Enter again to confirm {scope} reset",
|
|
452964
453435
|
// Add view
|
|
452965
|
-
addTitle: "Add Custom Sensitive Command",
|
|
453436
|
+
addTitle: "Add Custom Sensitive Command ({scope})",
|
|
452966
453437
|
patternLabel: 'Pattern (supports wildcards, e.g., "rm*"):',
|
|
452967
453438
|
patternPlaceholder: "e.g., rm -rf, sudo, etc.",
|
|
452968
453439
|
descriptionLabel: "Description:",
|
|
@@ -453238,7 +453709,9 @@ var init_en2 = __esm({
|
|
|
453238
453709
|
anthropicSpeed: "Speed:",
|
|
453239
453710
|
saveFailed: "Save failed",
|
|
453240
453711
|
modelSaveFailed: "Model save failed",
|
|
453241
|
-
tipLabel: "Tip:"
|
|
453712
|
+
tipLabel: "Tip:",
|
|
453713
|
+
modelCount: "{count} models",
|
|
453714
|
+
scrollHint: "\u2191\u2193 scroll for more"
|
|
453242
453715
|
},
|
|
453243
453716
|
profilePanel: {
|
|
453244
453717
|
title: "Select Profile",
|
|
@@ -454122,6 +454595,12 @@ var init_en2 = __esm({
|
|
|
454122
454595
|
actionClose: "Close",
|
|
454123
454596
|
errorPrefix: "Error: ",
|
|
454124
454597
|
scrollHint: "\u2191\u2193 Scroll"
|
|
454598
|
+
},
|
|
454599
|
+
exitScreen: {
|
|
454600
|
+
title: "Goodbye",
|
|
454601
|
+
goodbye: "Thanks for using Snow CLI",
|
|
454602
|
+
thankYou: "See you next time",
|
|
454603
|
+
version: "v{version}"
|
|
454125
454604
|
}
|
|
454126
454605
|
};
|
|
454127
454606
|
}
|
|
@@ -454212,6 +454691,10 @@ var init_zh = __esm({
|
|
|
454212
454691
|
embeddingApiKey: "\u5D4C\u5165 API \u5BC6\u94A5:",
|
|
454213
454692
|
embeddingApiKeyOptional: "\u5D4C\u5165 API \u5BC6\u94A5(\u672C\u5730\u90E8\u7F72\u53EF\u9009):",
|
|
454214
454693
|
embeddingDimensions: "\u5D4C\u5165\u7EF4\u5EA6:",
|
|
454694
|
+
embeddingSettingsGroup: "\u5D4C\u5165\u6A21\u578B\u914D\u7F6E",
|
|
454695
|
+
embeddingSettingsExpandHint: "(\u6309 Enter \u5C55\u5F00/\u6536\u8D77)",
|
|
454696
|
+
batchSettingsGroup: "\u6279\u5904\u7406\u8BBE\u7F6E",
|
|
454697
|
+
batchSettingsExpandHint: "(\u6309 Enter \u5C55\u5F00/\u6536\u8D77)",
|
|
454215
454698
|
batchMaxLines: "\u6279\u5904\u7406\u6700\u5927\u884C\u6570:",
|
|
454216
454699
|
batchConcurrency: "\u6279\u5904\u7406\u5E76\u53D1\u6570:",
|
|
454217
454700
|
notSet: "\u672A\u8BBE\u7F6E",
|
|
@@ -454233,6 +454716,19 @@ var init_zh = __esm({
|
|
|
454233
454716
|
chunkingMinLinesPerChunk: "\u6BCF\u5757\u6700\u5C0F\u884C\u6570:",
|
|
454234
454717
|
chunkingMinCharsPerChunk: "\u6BCF\u5757\u6700\u5C0F\u5B57\u7B26\u6570:",
|
|
454235
454718
|
chunkingOverlapLines: "\u91CD\u53E0\u884C\u6570:",
|
|
454719
|
+
rerankingToggle: "\u7ED3\u679C\u91CD\u6392\u5E8F:",
|
|
454720
|
+
rerankingSettingsGroup: "\u91CD\u6392\u5E8F\u6A21\u578B\u914D\u7F6E",
|
|
454721
|
+
rerankingSettingsExpandHint: "(\u6309 Enter \u5C55\u5F00/\u6536\u8D77)",
|
|
454722
|
+
rerankingModelName: "\u6A21\u578B\u540D:",
|
|
454723
|
+
rerankingBaseUrl: "Base URL:",
|
|
454724
|
+
rerankingApiKey: "API \u5BC6\u94A5:",
|
|
454725
|
+
rerankingContextLength: "\u6A21\u578B\u4E0A\u4E0B\u6587\u957F\u5EA6:",
|
|
454726
|
+
rerankingTopN: "Top N:",
|
|
454727
|
+
rerankingNotConfigured: "\u8BF7\u5148\u5728\u300C\u91CD\u6392\u5E8F\u6A21\u578B\u914D\u7F6E\u300D\u4E2D\u8BBE\u7F6E\u6A21\u578B\u540D\u548C Base URL",
|
|
454728
|
+
validationRerankingModelNameRequired: "\u542F\u7528\u91CD\u6392\u5E8F\u65F6\u9700\u8981\u6A21\u578B\u540D",
|
|
454729
|
+
validationRerankingBaseUrlRequired: "\u542F\u7528\u91CD\u6392\u5E8F\u65F6\u9700\u8981 Base URL",
|
|
454730
|
+
validationRerankingContextLengthPositive: "\u6A21\u578B\u4E0A\u4E0B\u6587\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E 0",
|
|
454731
|
+
validationRerankingTopNPositive: "Top N \u5FC5\u987B\u5927\u4E8E 0",
|
|
454236
454732
|
saveError: "\u4FDD\u5B58\u914D\u7F6E\u5931\u8D25",
|
|
454237
454733
|
gitignoreNotFound: "\u65E0\u6CD5\u521B\u5EFA\u7D22\u5F15\uFF1A\u672A\u627E\u5230 .gitignore \u6587\u4EF6\u3002\u8BF7\u5728\u9879\u76EE\u4E2D\u6DFB\u52A0 .gitignore \u6587\u4EF6\u4EE5\u9632\u6B62\u7D22\u5F15\u4E0D\u5FC5\u8981\u7684\u6587\u4EF6\u3002",
|
|
454238
454734
|
enterValue: "\u8F93\u5165\u503C:"
|
|
@@ -454489,8 +454985,18 @@ var init_zh = __esm({
|
|
|
454489
454985
|
enabled: "\u5DF2\u542F\u7528",
|
|
454490
454986
|
disabled: "\u5DF2\u7981\u7528",
|
|
454491
454987
|
customLabel: "\u81EA\u5B9A\u4E49",
|
|
454988
|
+
// Scope
|
|
454989
|
+
scopeProject: "\u9879\u76EE",
|
|
454990
|
+
scopeGlobal: "\u5168\u5C40",
|
|
454991
|
+
scopeSelectTitle: "\u9009\u62E9\u65B0\u547D\u4EE4\u7684\u4F5C\u7528\u57DF",
|
|
454992
|
+
scopeSelectHint: "\u2191\u2193: \u5BFC\u822A \u2022 Enter: \u9009\u62E9 \u2022 Esc: \u53D6\u6D88",
|
|
454993
|
+
duplicatePattern: '\u6A21\u5F0F "{pattern}" \u5DF2\u5B58\u5728\u4E8E{scope}\u4F5C\u7528\u57DF',
|
|
454994
|
+
resetScopeSelectTitle: "\u9009\u62E9\u8981\u91CD\u7F6E\u7684\u4F5C\u7528\u57DF",
|
|
454995
|
+
resetGlobalDesc: "\u6062\u590D\u4E3A\u9ED8\u8BA4\u9884\u8BBE\u547D\u4EE4",
|
|
454996
|
+
resetProjectDesc: "\u6E05\u7A7A\u6240\u6709\u9879\u76EE\u81EA\u5B9A\u4E49\u547D\u4EE4",
|
|
454997
|
+
confirmResetScopeMessage: "\u26A0\uFE0F \u518D\u6B21\u6309 Enter \u786E\u8BA4\u91CD\u7F6E{scope}",
|
|
454492
454998
|
// Add view
|
|
454493
|
-
addTitle: "\u6DFB\u52A0\u81EA\u5B9A\u4E49\u654F\u611F\u547D\u4EE4",
|
|
454999
|
+
addTitle: "\u6DFB\u52A0\u81EA\u5B9A\u4E49\u654F\u611F\u547D\u4EE4 ({scope})",
|
|
454494
455000
|
patternLabel: '\u547D\u4EE4\u6A21\u5F0F(\u652F\u6301\u901A\u914D\u7B26,\u4F8B\u5982 "rm*"):',
|
|
454495
455001
|
patternPlaceholder: "\u4F8B\u5982: rm -rf, sudo \u7B49",
|
|
454496
455002
|
descriptionLabel: "\u63CF\u8FF0:",
|
|
@@ -454766,7 +455272,9 @@ var init_zh = __esm({
|
|
|
454766
455272
|
anthropicSpeed: "Speed:",
|
|
454767
455273
|
saveFailed: "\u4FDD\u5B58\u5931\u8D25",
|
|
454768
455274
|
modelSaveFailed: "\u6A21\u578B\u4FDD\u5B58\u5931\u8D25",
|
|
454769
|
-
tipLabel: "\u63D0\u793A:"
|
|
455275
|
+
tipLabel: "\u63D0\u793A:",
|
|
455276
|
+
modelCount: "\u5171 {count} \u4E2A\u6A21\u578B",
|
|
455277
|
+
scrollHint: "\u2191\u2193 \u6EDA\u52A8\u6D4F\u89C8\u66F4\u591A\u6A21\u578B"
|
|
454770
455278
|
},
|
|
454771
455279
|
profilePanel: {
|
|
454772
455280
|
title: "\u9009\u62E9\u914D\u7F6E",
|
|
@@ -455649,6 +456157,12 @@ var init_zh = __esm({
|
|
|
455649
456157
|
actionClose: "\u5173\u95ED",
|
|
455650
456158
|
errorPrefix: "\u9519\u8BEF\uFF1A",
|
|
455651
456159
|
scrollHint: "\u2191\u2193 \u6EDA\u52A8\u6D4F\u89C8"
|
|
456160
|
+
},
|
|
456161
|
+
exitScreen: {
|
|
456162
|
+
title: "\u518D\u89C1",
|
|
456163
|
+
goodbye: "\u611F\u8C22\u4F7F\u7528 Snow CLI",
|
|
456164
|
+
thankYou: "\u671F\u5F85\u4E0B\u6B21\u76F8\u89C1",
|
|
456165
|
+
version: "v{version}"
|
|
455652
456166
|
}
|
|
455653
456167
|
};
|
|
455654
456168
|
}
|
|
@@ -455739,6 +456253,10 @@ var init_zh_TW = __esm({
|
|
|
455739
456253
|
embeddingApiKey: "\u5D4C\u5165 API \u91D1\u9470:",
|
|
455740
456254
|
embeddingApiKeyOptional: "\u5D4C\u5165 API \u91D1\u9470(\u672C\u5730\u90E8\u7F72\u53EF\u9078):",
|
|
455741
456255
|
embeddingDimensions: "\u5D4C\u5165\u7DAD\u5EA6:",
|
|
456256
|
+
embeddingSettingsGroup: "\u5D4C\u5165\u6A21\u578B\u8A2D\u5B9A",
|
|
456257
|
+
embeddingSettingsExpandHint: "(\u6309 Enter \u5C55\u958B/\u6536\u8D77)",
|
|
456258
|
+
batchSettingsGroup: "\u6279\u6B21\u8655\u7406\u8A2D\u5B9A",
|
|
456259
|
+
batchSettingsExpandHint: "(\u6309 Enter \u5C55\u958B/\u6536\u8D77)",
|
|
455742
456260
|
batchMaxLines: "\u6279\u6B21\u8655\u7406\u6700\u5927\u884C\u6578:",
|
|
455743
456261
|
batchConcurrency: "\u6279\u6B21\u8655\u7406\u4E26\u884C\u6578:",
|
|
455744
456262
|
notSet: "\u672A\u8A2D\u5B9A",
|
|
@@ -455760,6 +456278,19 @@ var init_zh_TW = __esm({
|
|
|
455760
456278
|
chunkingMinLinesPerChunk: "\u6BCF\u584A\u6700\u5C0F\u884C\u6578:",
|
|
455761
456279
|
chunkingMinCharsPerChunk: "\u6BCF\u584A\u6700\u5C0F\u5B57\u5143\u6578:",
|
|
455762
456280
|
chunkingOverlapLines: "\u91CD\u758A\u884C\u6578:",
|
|
456281
|
+
rerankingToggle: "\u7D50\u679C\u91CD\u6392\u5E8F:",
|
|
456282
|
+
rerankingSettingsGroup: "\u91CD\u6392\u5E8F\u6A21\u578B\u8A2D\u5B9A",
|
|
456283
|
+
rerankingSettingsExpandHint: "(\u6309 Enter \u5C55\u958B/\u6536\u8D77)",
|
|
456284
|
+
rerankingModelName: "\u6A21\u578B\u540D:",
|
|
456285
|
+
rerankingBaseUrl: "Base URL:",
|
|
456286
|
+
rerankingApiKey: "API \u91D1\u9470:",
|
|
456287
|
+
rerankingContextLength: "\u6A21\u578B\u4E0A\u4E0B\u6587\u9577\u5EA6:",
|
|
456288
|
+
rerankingTopN: "Top N:",
|
|
456289
|
+
rerankingNotConfigured: "\u8ACB\u5148\u5728\u300C\u91CD\u6392\u5E8F\u6A21\u578B\u8A2D\u5B9A\u300D\u4E2D\u8A2D\u5B9A\u6A21\u578B\u540D\u548C Base URL",
|
|
456290
|
+
validationRerankingModelNameRequired: "\u555F\u7528\u91CD\u6392\u5E8F\u6642\u9700\u8981\u6A21\u578B\u540D",
|
|
456291
|
+
validationRerankingBaseUrlRequired: "\u555F\u7528\u91CD\u6392\u5E8F\u6642\u9700\u8981 Base URL",
|
|
456292
|
+
validationRerankingContextLengthPositive: "\u6A21\u578B\u4E0A\u4E0B\u6587\u9577\u5EA6\u5FC5\u9808\u5927\u65BC 0",
|
|
456293
|
+
validationRerankingTopNPositive: "Top N \u5FC5\u9808\u5927\u65BC 0",
|
|
455763
456294
|
saveError: "\u5132\u5B58\u914D\u7F6E\u5931\u6557",
|
|
455764
456295
|
gitignoreNotFound: "\u7121\u6CD5\u5EFA\u7ACB\u7D22\u5F15\uFF1A\u672A\u627E\u5230 .gitignore \u6A94\u6848\u3002\u8ACB\u5728\u5C08\u6848\u4E2D\u65B0\u589E .gitignore \u6A94\u6848\u4EE5\u9632\u6B62\u7D22\u5F15\u4E0D\u5FC5\u8981\u7684\u6A94\u6848\u3002",
|
|
455765
456296
|
enterValue: "\u8F38\u5165\u503C:"
|
|
@@ -456016,8 +456547,18 @@ var init_zh_TW = __esm({
|
|
|
456016
456547
|
enabled: "\u5DF2\u555F\u7528",
|
|
456017
456548
|
disabled: "\u5DF2\u505C\u7528",
|
|
456018
456549
|
customLabel: "\u81EA\u8A02",
|
|
456550
|
+
// Scope
|
|
456551
|
+
scopeProject: "\u5C08\u6848",
|
|
456552
|
+
scopeGlobal: "\u5168\u57DF",
|
|
456553
|
+
scopeSelectTitle: "\u9078\u64C7\u65B0\u547D\u4EE4\u7684\u4F5C\u7528\u57DF",
|
|
456554
|
+
scopeSelectHint: "\u2191\u2193: \u5C0E\u822A \u2022 Enter: \u9078\u64C7 \u2022 Esc: \u53D6\u6D88",
|
|
456555
|
+
duplicatePattern: '\u6A21\u5F0F "{pattern}" \u5DF2\u5B58\u5728\u65BC{scope}\u4F5C\u7528\u57DF',
|
|
456556
|
+
resetScopeSelectTitle: "\u9078\u64C7\u8981\u91CD\u8A2D\u7684\u4F5C\u7528\u57DF",
|
|
456557
|
+
resetGlobalDesc: "\u9084\u539F\u70BA\u9810\u8A2D\u547D\u4EE4",
|
|
456558
|
+
resetProjectDesc: "\u6E05\u7A7A\u6240\u6709\u5C08\u6848\u81EA\u8A02\u547D\u4EE4",
|
|
456559
|
+
confirmResetScopeMessage: "\u26A0\uFE0F \u518D\u6B21\u6309 Enter \u78BA\u8A8D\u91CD\u8A2D{scope}",
|
|
456019
456560
|
// Add view
|
|
456020
|
-
addTitle: "\u65B0\u589E\u81EA\u8A02\u654F\u611F\u547D\u4EE4",
|
|
456561
|
+
addTitle: "\u65B0\u589E\u81EA\u8A02\u654F\u611F\u547D\u4EE4 ({scope})",
|
|
456021
456562
|
patternLabel: '\u547D\u4EE4\u6A21\u5F0F(\u652F\u63F4\u842C\u7528\u5B57\u5143,\u4F8B\u5982 "rm*"):',
|
|
456022
456563
|
patternPlaceholder: "\u4F8B\u5982: rm -rf, sudo \u7B49",
|
|
456023
456564
|
descriptionLabel: "\u63CF\u8FF0:",
|
|
@@ -456293,7 +456834,9 @@ var init_zh_TW = __esm({
|
|
|
456293
456834
|
anthropicSpeed: "Speed:",
|
|
456294
456835
|
saveFailed: "\u5132\u5B58\u5931\u6557",
|
|
456295
456836
|
modelSaveFailed: "\u6A21\u578B\u5132\u5B58\u5931\u6557",
|
|
456296
|
-
tipLabel: "\u63D0\u793A:"
|
|
456837
|
+
tipLabel: "\u63D0\u793A:",
|
|
456838
|
+
modelCount: "\u5171 {count} \u500B\u6A21\u578B",
|
|
456839
|
+
scrollHint: "\u2191\u2193 \u6372\u52D5\u700F\u89BD\u66F4\u591A\u6A21\u578B"
|
|
456297
456840
|
},
|
|
456298
456841
|
profilePanel: {
|
|
456299
456842
|
title: "\u9078\u64C7\u8A2D\u5B9A\u6A94",
|
|
@@ -457171,6 +457714,12 @@ var init_zh_TW = __esm({
|
|
|
457171
457714
|
actionClose: "\u95DC\u9589",
|
|
457172
457715
|
errorPrefix: "\u932F\u8AA4\uFF1A",
|
|
457173
457716
|
scrollHint: "\u2191\u2193 \u6372\u52D5\u700F\u89BD"
|
|
457717
|
+
},
|
|
457718
|
+
exitScreen: {
|
|
457719
|
+
title: "\u518D\u898B",
|
|
457720
|
+
goodbye: "\u611F\u8B1D\u4F7F\u7528 Snow CLI",
|
|
457721
|
+
thankYou: "\u671F\u5F85\u4E0B\u6B21\u76F8\u898B",
|
|
457722
|
+
version: "v{version}"
|
|
457174
457723
|
}
|
|
457175
457724
|
};
|
|
457176
457725
|
}
|
|
@@ -458790,7 +459339,7 @@ async function processStreamRound(ctx) {
|
|
|
458790
459339
|
flushListBuffer();
|
|
458791
459340
|
emitStreamLine(line, false);
|
|
458792
459341
|
};
|
|
458793
|
-
const
|
|
459342
|
+
const countTokens2 = (text2) => {
|
|
458794
459343
|
try {
|
|
458795
459344
|
const deltaTokens = encoder.encode(text2);
|
|
458796
459345
|
currentTokenCount += deltaTokens.length;
|
|
@@ -458851,7 +459400,7 @@ async function processStreamRound(ctx) {
|
|
|
458851
459400
|
setIsReasoning == null ? void 0 : setIsReasoning(true);
|
|
458852
459401
|
}
|
|
458853
459402
|
}
|
|
458854
|
-
|
|
459403
|
+
countTokens2(chunk2.delta);
|
|
458855
459404
|
if (hasReceivedContentChunk) {
|
|
458856
459405
|
continue;
|
|
458857
459406
|
}
|
|
@@ -458873,7 +459422,7 @@ async function processStreamRound(ctx) {
|
|
|
458873
459422
|
}
|
|
458874
459423
|
setIsReasoning == null ? void 0 : setIsReasoning(false);
|
|
458875
459424
|
streamedContent += chunk2.content;
|
|
458876
|
-
|
|
459425
|
+
countTokens2(chunk2.content);
|
|
458877
459426
|
contentLineBuffer += chunk2.content;
|
|
458878
459427
|
const contentLines = contentLineBuffer.split("\n");
|
|
458879
459428
|
for (let i = 0; i < contentLines.length - 1; i++) {
|
|
@@ -458884,7 +459433,7 @@ async function processStreamRound(ctx) {
|
|
|
458884
459433
|
}
|
|
458885
459434
|
if (chunk2.type === "tool_call_delta" && chunk2.delta) {
|
|
458886
459435
|
setIsReasoning == null ? void 0 : setIsReasoning(false);
|
|
458887
|
-
|
|
459436
|
+
countTokens2(chunk2.delta);
|
|
458888
459437
|
continue;
|
|
458889
459438
|
}
|
|
458890
459439
|
if (chunk2.type === "tool_calls" && chunk2.tool_calls) {
|
|
@@ -460761,16 +461310,19 @@ function useCommandHandler(options3) {
|
|
|
460761
461310
|
options3.setIsCompressing(true);
|
|
460762
461311
|
options3.setCompressionError(null);
|
|
460763
461312
|
try {
|
|
461313
|
+
const { performAutoCompression: performAutoCompression2 } = await init_autoCompress().then(() => autoCompress_exports);
|
|
460764
461314
|
const currentSession = sessionManager.getCurrentSession();
|
|
460765
|
-
|
|
460766
|
-
throw new Error("No active session to compress");
|
|
460767
|
-
}
|
|
460768
|
-
const compressionResult = await executeContextCompression(currentSession.id, (status) => {
|
|
461315
|
+
const compressionResult = await performAutoCompression2(currentSession == null ? void 0 : currentSession.id, (status) => {
|
|
460769
461316
|
var _a21;
|
|
460770
461317
|
(_a21 = options3.onCompressionStatus) == null ? void 0 : _a21.call(options3, status);
|
|
460771
461318
|
});
|
|
461319
|
+
if (compressionResult && compressionResult.hookFailed) {
|
|
461320
|
+
const errorMsg = "Blocked by beforeCompress hook";
|
|
461321
|
+
options3.setCompressionError(errorMsg);
|
|
461322
|
+
return;
|
|
461323
|
+
}
|
|
460772
461324
|
if (!compressionResult) {
|
|
460773
|
-
|
|
461325
|
+
return;
|
|
460774
461326
|
}
|
|
460775
461327
|
(_a20 = options3.onCompressionStatus) == null ? void 0 : _a20.call(options3, null);
|
|
460776
461328
|
options3.clearSavedMessages();
|
|
@@ -460784,12 +461336,10 @@ function useCommandHandler(options3) {
|
|
|
460784
461336
|
message: errorMsg
|
|
460785
461337
|
});
|
|
460786
461338
|
options3.setCompressionError(errorMsg);
|
|
460787
|
-
|
|
460788
|
-
|
|
460789
|
-
|
|
460790
|
-
|
|
460791
|
-
};
|
|
460792
|
-
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
461339
|
+
setTimeout(() => {
|
|
461340
|
+
var _a21;
|
|
461341
|
+
(_a21 = options3.onCompressionStatus) == null ? void 0 : _a21.call(options3, null);
|
|
461342
|
+
}, 5e3);
|
|
460793
461343
|
} finally {
|
|
460794
461344
|
options3.setIsCompressing(false);
|
|
460795
461345
|
}
|
|
@@ -461361,31 +461911,82 @@ var init_useCommandHandler = __esm({
|
|
|
461361
461911
|
});
|
|
461362
461912
|
|
|
461363
461913
|
// dist/utils/core/autoCompress.js
|
|
461914
|
+
var autoCompress_exports = {};
|
|
461915
|
+
__export(autoCompress_exports, {
|
|
461916
|
+
performAutoCompression: () => performAutoCompression,
|
|
461917
|
+
shouldAutoCompress: () => shouldAutoCompress
|
|
461918
|
+
});
|
|
461364
461919
|
function shouldAutoCompress(percentage, threshold = 80) {
|
|
461365
461920
|
return percentage >= threshold;
|
|
461366
461921
|
}
|
|
461367
461922
|
async function performAutoCompression(sessionId, onStatusUpdate) {
|
|
461368
|
-
|
|
461369
|
-
|
|
461370
|
-
|
|
461371
|
-
|
|
461372
|
-
|
|
461373
|
-
|
|
461374
|
-
|
|
461375
|
-
|
|
461376
|
-
|
|
461377
|
-
|
|
461378
|
-
|
|
461379
|
-
sessionId
|
|
461923
|
+
let lastError = "";
|
|
461924
|
+
for (let attempt = 0; attempt <= COMPRESSION_MAX_RETRIES; attempt++) {
|
|
461925
|
+
try {
|
|
461926
|
+
let failedInAttempt = false;
|
|
461927
|
+
const result2 = await executeContextCompression(sessionId, (status) => {
|
|
461928
|
+
if (status.step === "failed") {
|
|
461929
|
+
failedInAttempt = true;
|
|
461930
|
+
lastError = status.message || "Unknown error";
|
|
461931
|
+
return;
|
|
461932
|
+
}
|
|
461933
|
+
onStatusUpdate == null ? void 0 : onStatusUpdate(status);
|
|
461380
461934
|
});
|
|
461935
|
+
if (result2 && result2.hookFailed) {
|
|
461936
|
+
return result2;
|
|
461937
|
+
}
|
|
461938
|
+
if (result2) {
|
|
461939
|
+
return result2;
|
|
461940
|
+
}
|
|
461941
|
+
if (!failedInAttempt) {
|
|
461942
|
+
return null;
|
|
461943
|
+
}
|
|
461944
|
+
if (attempt < COMPRESSION_MAX_RETRIES) {
|
|
461945
|
+
const retryDelay = COMPRESSION_RETRY_BASE_DELAY * Math.pow(2, attempt);
|
|
461946
|
+
onStatusUpdate == null ? void 0 : onStatusUpdate({
|
|
461947
|
+
step: "retrying",
|
|
461948
|
+
message: lastError,
|
|
461949
|
+
sessionId,
|
|
461950
|
+
retryAttempt: attempt + 1,
|
|
461951
|
+
maxRetries: COMPRESSION_MAX_RETRIES
|
|
461952
|
+
});
|
|
461953
|
+
await new Promise((resolve13) => setTimeout(resolve13, retryDelay));
|
|
461954
|
+
continue;
|
|
461955
|
+
}
|
|
461956
|
+
} catch (error40) {
|
|
461957
|
+
lastError = error40 instanceof Error ? error40.message : "Unknown error";
|
|
461958
|
+
if (attempt < COMPRESSION_MAX_RETRIES) {
|
|
461959
|
+
const retryDelay = COMPRESSION_RETRY_BASE_DELAY * Math.pow(2, attempt);
|
|
461960
|
+
onStatusUpdate == null ? void 0 : onStatusUpdate({
|
|
461961
|
+
step: "retrying",
|
|
461962
|
+
message: lastError,
|
|
461963
|
+
sessionId,
|
|
461964
|
+
retryAttempt: attempt + 1,
|
|
461965
|
+
maxRetries: COMPRESSION_MAX_RETRIES
|
|
461966
|
+
});
|
|
461967
|
+
await new Promise((resolve13) => setTimeout(resolve13, retryDelay));
|
|
461968
|
+
continue;
|
|
461969
|
+
}
|
|
461381
461970
|
}
|
|
461382
|
-
return null;
|
|
461383
461971
|
}
|
|
461972
|
+
onStatusUpdate == null ? void 0 : onStatusUpdate({
|
|
461973
|
+
step: "failed",
|
|
461974
|
+
message: `Failed after ${COMPRESSION_MAX_RETRIES} retries: ${lastError}`,
|
|
461975
|
+
sessionId
|
|
461976
|
+
});
|
|
461977
|
+
if (onStatusUpdate) {
|
|
461978
|
+
setTimeout(() => onStatusUpdate(null), COMPRESSION_ERROR_DISMISS_MS);
|
|
461979
|
+
}
|
|
461980
|
+
return null;
|
|
461384
461981
|
}
|
|
461982
|
+
var COMPRESSION_MAX_RETRIES, COMPRESSION_RETRY_BASE_DELAY, COMPRESSION_ERROR_DISMISS_MS;
|
|
461385
461983
|
var init_autoCompress = __esm({
|
|
461386
461984
|
async "dist/utils/core/autoCompress.js"() {
|
|
461387
461985
|
"use strict";
|
|
461388
461986
|
await init_useCommandHandler();
|
|
461987
|
+
COMPRESSION_MAX_RETRIES = 3;
|
|
461988
|
+
COMPRESSION_RETRY_BASE_DELAY = 1e3;
|
|
461989
|
+
COMPRESSION_ERROR_DISMISS_MS = 5e3;
|
|
461389
461990
|
}
|
|
461390
461991
|
});
|
|
461391
461992
|
|
|
@@ -461411,7 +462012,9 @@ async function handleAutoCompression(options3) {
|
|
|
461411
462012
|
(_a21 = options3.onCompressionStatus) == null ? void 0 : _a21.call(options3, status);
|
|
461412
462013
|
};
|
|
461413
462014
|
const compressionResult = await performAutoCompression(session == null ? void 0 : session.id, onStatusUpdate);
|
|
461414
|
-
(
|
|
462015
|
+
if (compressionResult) {
|
|
462016
|
+
(_b14 = options3.onCompressionStatus) == null ? void 0 : _b14.call(options3, null);
|
|
462017
|
+
}
|
|
461415
462018
|
if (compressionResult && compressionResult.hookFailed) {
|
|
461416
462019
|
(_c6 = options3.setIsAutoCompressing) == null ? void 0 : _c6.call(options3, false);
|
|
461417
462020
|
return {
|
|
@@ -461452,6 +462055,10 @@ async function handleAutoCompression(options3) {
|
|
|
461452
462055
|
step: "failed",
|
|
461453
462056
|
message: error40 instanceof Error ? error40.message : "Unknown error"
|
|
461454
462057
|
});
|
|
462058
|
+
setTimeout(() => {
|
|
462059
|
+
var _a21;
|
|
462060
|
+
(_a21 = options3.onCompressionStatus) == null ? void 0 : _a21.call(options3, null);
|
|
462061
|
+
}, 5e3);
|
|
461455
462062
|
} finally {
|
|
461456
462063
|
compressionCoordinator.releaseLock("main");
|
|
461457
462064
|
}
|
|
@@ -468124,7 +468731,7 @@ function useGlobalExit(onNotification) {
|
|
|
468124
468731
|
if (key.ctrl && input2 === "c") {
|
|
468125
468732
|
const now = Date.now();
|
|
468126
468733
|
if (now - lastCtrlCTime < ctrlCTimeout) {
|
|
468127
|
-
|
|
468734
|
+
navigateTo("exit");
|
|
468128
468735
|
} else {
|
|
468129
468736
|
setLastCtrlCTime(now);
|
|
468130
468737
|
if (onNotification) {
|
|
@@ -468150,6 +468757,7 @@ var init_useGlobalExit = __esm({
|
|
|
468150
468757
|
await init_build2();
|
|
468151
468758
|
import_react60 = __toESM(require_react(), 1);
|
|
468152
468759
|
init_i18n();
|
|
468760
|
+
init_useGlobalNavigation();
|
|
468153
468761
|
}
|
|
468154
468762
|
});
|
|
468155
468763
|
|
|
@@ -468447,13 +469055,13 @@ var init_themes = __esm({
|
|
|
468447
469055
|
import { homedir as homedir23 } from "os";
|
|
468448
469056
|
import { join as join34 } from "path";
|
|
468449
469057
|
import { existsSync as existsSync33, mkdirSync as mkdirSync19, readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "fs";
|
|
468450
|
-
function
|
|
468451
|
-
if (!existsSync33(
|
|
468452
|
-
mkdirSync19(
|
|
469058
|
+
function ensureConfigDirectory6() {
|
|
469059
|
+
if (!existsSync33(CONFIG_DIR7)) {
|
|
469060
|
+
mkdirSync19(CONFIG_DIR7, { recursive: true });
|
|
468453
469061
|
}
|
|
468454
469062
|
}
|
|
468455
469063
|
function loadThemeConfig() {
|
|
468456
|
-
|
|
469064
|
+
ensureConfigDirectory6();
|
|
468457
469065
|
if (!existsSync33(THEME_CONFIG_FILE)) {
|
|
468458
469066
|
saveThemeConfig(DEFAULT_CONFIG4);
|
|
468459
469067
|
return DEFAULT_CONFIG4;
|
|
@@ -468470,7 +469078,7 @@ function loadThemeConfig() {
|
|
|
468470
469078
|
}
|
|
468471
469079
|
}
|
|
468472
469080
|
function saveThemeConfig(config3) {
|
|
468473
|
-
|
|
469081
|
+
ensureConfigDirectory6();
|
|
468474
469082
|
try {
|
|
468475
469083
|
const configData = JSON.stringify(config3, null, 2);
|
|
468476
469084
|
writeFileSync19(THEME_CONFIG_FILE, configData, "utf-8");
|
|
@@ -468506,12 +469114,12 @@ function setDiffOpacity(diffOpacity) {
|
|
|
468506
469114
|
const config3 = loadThemeConfig();
|
|
468507
469115
|
saveThemeConfig({ ...config3, diffOpacity });
|
|
468508
469116
|
}
|
|
468509
|
-
var
|
|
469117
|
+
var CONFIG_DIR7, THEME_CONFIG_FILE, DEFAULT_CONFIG4;
|
|
468510
469118
|
var init_themeConfig = __esm({
|
|
468511
469119
|
"dist/utils/config/themeConfig.js"() {
|
|
468512
469120
|
"use strict";
|
|
468513
|
-
|
|
468514
|
-
THEME_CONFIG_FILE = join34(
|
|
469121
|
+
CONFIG_DIR7 = join34(homedir23(), ".snow");
|
|
469122
|
+
THEME_CONFIG_FILE = join34(CONFIG_DIR7, "theme.json");
|
|
468515
469123
|
DEFAULT_CONFIG4 = {
|
|
468516
469124
|
theme: "dark",
|
|
468517
469125
|
simpleMode: false,
|
|
@@ -472958,7 +473566,13 @@ function useConfigState() {
|
|
|
472958
473566
|
};
|
|
472959
473567
|
const getCurrentOptions = () => {
|
|
472960
473568
|
const filteredModels = filterModels(models, searchTerm);
|
|
472961
|
-
const
|
|
473569
|
+
const seen = /* @__PURE__ */ new Set();
|
|
473570
|
+
const modelOptions = filteredModels.filter((model) => {
|
|
473571
|
+
if (seen.has(model.id))
|
|
473572
|
+
return false;
|
|
473573
|
+
seen.add(model.id);
|
|
473574
|
+
return true;
|
|
473575
|
+
}).map((model) => ({
|
|
472962
473576
|
label: model.id,
|
|
472963
473577
|
value: model.id
|
|
472964
473578
|
}));
|
|
@@ -474795,7 +475409,7 @@ var init_ConfigFieldRenderer = __esm({
|
|
|
474795
475409
|
|
|
474796
475410
|
// dist/ui/pages/configScreen/ConfigSelectPanel.js
|
|
474797
475411
|
function ConfigSelectPanel({ state }) {
|
|
474798
|
-
const { t, theme: theme14, currentField, setIsEditing, requestMethod, setRequestMethod, requestMethodOptions,
|
|
475412
|
+
const { t, theme: theme14, currentField, setIsEditing, requestMethod, setRequestMethod, requestMethodOptions, thinkingMode, setThinkingMode, thinkingEffort, setThinkingEffort, geminiThinkingLevel, setGeminiThinkingLevel, responsesVerbosity, setResponsesVerbosity, anthropicSpeed, setAnthropicSpeed, getCustomHeadersSchemeSelectItems, getCustomHeadersSchemeSelectedValue, applyCustomHeadersSchemeSelectValue } = state;
|
|
474799
475413
|
const getFieldLabel = () => {
|
|
474800
475414
|
switch (currentField) {
|
|
474801
475415
|
case "profile":
|
|
@@ -474852,19 +475466,7 @@ function ConfigSelectPanel({ state }) {
|
|
|
474852
475466
|
setIsEditing(false);
|
|
474853
475467
|
} });
|
|
474854
475468
|
})(),
|
|
474855
|
-
(currentField === "advancedModel" || currentField === "basicModel") && import_react70.default.createElement(
|
|
474856
|
-
Box_default,
|
|
474857
|
-
{ flexDirection: "column" },
|
|
474858
|
-
searchTerm && import_react70.default.createElement(
|
|
474859
|
-
Text,
|
|
474860
|
-
{ color: theme14.colors.menuInfo },
|
|
474861
|
-
"Filter: ",
|
|
474862
|
-
searchTerm
|
|
474863
|
-
),
|
|
474864
|
-
import_react70.default.createElement(ScrollableSelectInput, { items: getCurrentOptions(), limit: 10, disableNumberShortcuts: true, initialIndex: Math.max(0, getCurrentOptions().findIndex((opt) => opt.value === getCurrentValue())), isFocused: true, onSelect: (item) => {
|
|
474865
|
-
handleModelChange(item.value);
|
|
474866
|
-
} })
|
|
474867
|
-
),
|
|
475469
|
+
(currentField === "advancedModel" || currentField === "basicModel") && import_react70.default.createElement(ModelSelect, { state }),
|
|
474868
475470
|
currentField === "thinkingMode" && import_react70.default.createElement(ScrollableSelectInput, { items: [
|
|
474869
475471
|
{ label: t.configScreen.thinkingModeTokens, value: "tokens" },
|
|
474870
475472
|
{
|
|
@@ -475051,6 +475653,46 @@ function SystemPromptSelect({ state }) {
|
|
|
475051
475653
|
)
|
|
475052
475654
|
);
|
|
475053
475655
|
}
|
|
475656
|
+
function ModelSelect({ state }) {
|
|
475657
|
+
const { t, theme: theme14, searchTerm, getCurrentOptions, getCurrentValue, handleModelChange } = state;
|
|
475658
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react70.useState)(0);
|
|
475659
|
+
const options3 = getCurrentOptions();
|
|
475660
|
+
const modelCount = options3.length - 1;
|
|
475661
|
+
return import_react70.default.createElement(
|
|
475662
|
+
Box_default,
|
|
475663
|
+
{ flexDirection: "column" },
|
|
475664
|
+
import_react70.default.createElement(
|
|
475665
|
+
Box_default,
|
|
475666
|
+
null,
|
|
475667
|
+
searchTerm && import_react70.default.createElement(
|
|
475668
|
+
Text,
|
|
475669
|
+
{ color: theme14.colors.menuInfo },
|
|
475670
|
+
t.modelsPanel.filterLabel,
|
|
475671
|
+
" ",
|
|
475672
|
+
searchTerm,
|
|
475673
|
+
" "
|
|
475674
|
+
),
|
|
475675
|
+
import_react70.default.createElement(
|
|
475676
|
+
Text,
|
|
475677
|
+
{ color: theme14.colors.warning, bold: true },
|
|
475678
|
+
t.modelsPanel.modelCount.replace("{count}", modelCount.toString()),
|
|
475679
|
+
options3.length > 10 && ` (${highlightedIndex + 1}/${options3.length})`
|
|
475680
|
+
)
|
|
475681
|
+
),
|
|
475682
|
+
import_react70.default.createElement(ScrollableSelectInput, { items: options3, limit: 10, disableNumberShortcuts: true, initialIndex: Math.max(0, options3.findIndex((opt) => opt.value === getCurrentValue())), isFocused: true, onSelect: (item) => {
|
|
475683
|
+
handleModelChange(item.value);
|
|
475684
|
+
}, onHighlight: (item) => {
|
|
475685
|
+
const idx = options3.findIndex((o) => o.value === item.value);
|
|
475686
|
+
if (idx >= 0)
|
|
475687
|
+
setHighlightedIndex(idx);
|
|
475688
|
+
} }),
|
|
475689
|
+
options3.length > 10 && import_react70.default.createElement(
|
|
475690
|
+
Box_default,
|
|
475691
|
+
null,
|
|
475692
|
+
import_react70.default.createElement(Text, { dimColor: true, color: theme14.colors.menuSecondary }, t.modelsPanel.scrollHint)
|
|
475693
|
+
)
|
|
475694
|
+
);
|
|
475695
|
+
}
|
|
475054
475696
|
function ReasoningEffortSelect({ state }) {
|
|
475055
475697
|
const { supportsXHigh, responsesReasoningEffort, setResponsesReasoningEffort, setIsEditing } = state;
|
|
475056
475698
|
const effortOptions = [
|
|
@@ -476303,7 +476945,7 @@ function SubAgentListScreen({ onBack, onAdd, onEdit, inlineMode = false, default
|
|
|
476303
476945
|
(0, import_react75.useEffect)(() => {
|
|
476304
476946
|
setSelectedIndex(defaultSelectedIndex);
|
|
476305
476947
|
}, [defaultSelectedIndex]);
|
|
476306
|
-
const
|
|
476948
|
+
const truncateText6 = (0, import_react75.useCallback)((text2, prefixLength = 0) => {
|
|
476307
476949
|
if (!text2)
|
|
476308
476950
|
return text2;
|
|
476309
476951
|
const maxLength = Math.max(20, columns - prefixLength - 3 - 5 - 3);
|
|
@@ -476450,7 +477092,7 @@ function SubAgentListScreen({ onBack, onAdd, onEdit, inlineMode = false, default
|
|
|
476450
477092
|
{ color: theme14.colors.menuSecondary },
|
|
476451
477093
|
t.subAgentList.description,
|
|
476452
477094
|
" ",
|
|
476453
|
-
|
|
477095
|
+
truncateText6(agent.description || t.subAgentList.noDescription, t.subAgentList.description.length)
|
|
476454
477096
|
),
|
|
476455
477097
|
import_react75.default.createElement(Text, { color: theme14.colors.menuSecondary }, t.subAgentList.toolsCount.replace("{count}", (((_a20 = agent.tools) == null ? void 0 : _a20.length) || 0).toString())),
|
|
476456
477098
|
import_react75.default.createElement(
|
|
@@ -476500,10 +477142,17 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476500
477142
|
const [showSuccess, setShowSuccess] = (0, import_react76.useState)(false);
|
|
476501
477143
|
const [successMessage, setSuccessMessage] = (0, import_react76.useState)("");
|
|
476502
477144
|
const [confirmDelete, setConfirmDelete] = (0, import_react76.useState)(false);
|
|
476503
|
-
const [
|
|
477145
|
+
const [scopeSelectIndex, setScopeSelectIndex] = (0, import_react76.useState)(0);
|
|
477146
|
+
const [scopeSelectPurpose, setScopeSelectPurpose] = (0, import_react76.useState)("add");
|
|
477147
|
+
const [selectedScope, setSelectedScope] = (0, import_react76.useState)("global");
|
|
477148
|
+
const [confirmResetScope, setConfirmResetScope] = (0, import_react76.useState)(false);
|
|
476504
477149
|
const [customPattern, setCustomPattern] = (0, import_react76.useState)("");
|
|
476505
477150
|
const [customDescription, setCustomDescription] = (0, import_react76.useState)("");
|
|
476506
477151
|
const [addField, setAddField] = (0, import_react76.useState)("pattern");
|
|
477152
|
+
const [addError, setAddError] = (0, import_react76.useState)("");
|
|
477153
|
+
const getScopeLabel = (0, import_react76.useCallback)((scope) => {
|
|
477154
|
+
return scope === "project" ? t.sensitiveCommandConfig.scopeProject : t.sensitiveCommandConfig.scopeGlobal;
|
|
477155
|
+
}, [t]);
|
|
476507
477156
|
const loadCommands = (0, import_react76.useCallback)(() => {
|
|
476508
477157
|
const allCommands = getAllSensitiveCommands();
|
|
476509
477158
|
setCommands(allCommands);
|
|
@@ -476513,9 +477162,8 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476513
477162
|
}, [loadCommands]);
|
|
476514
477163
|
const handleListInput = (0, import_react76.useCallback)((input2, key) => {
|
|
476515
477164
|
if (key.escape) {
|
|
476516
|
-
if (confirmDelete
|
|
477165
|
+
if (confirmDelete) {
|
|
476517
477166
|
setConfirmDelete(false);
|
|
476518
|
-
setConfirmReset(false);
|
|
476519
477167
|
return;
|
|
476520
477168
|
}
|
|
476521
477169
|
onBack();
|
|
@@ -476526,17 +477174,15 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476526
477174
|
return;
|
|
476527
477175
|
setSelectedIndex((prev) => prev > 0 ? prev - 1 : commands.length - 1);
|
|
476528
477176
|
setConfirmDelete(false);
|
|
476529
|
-
setConfirmReset(false);
|
|
476530
477177
|
} else if (key.downArrow) {
|
|
476531
477178
|
if (commands.length === 0)
|
|
476532
477179
|
return;
|
|
476533
477180
|
setSelectedIndex((prev) => prev < commands.length - 1 ? prev + 1 : 0);
|
|
476534
477181
|
setConfirmDelete(false);
|
|
476535
|
-
setConfirmReset(false);
|
|
476536
477182
|
} else if (input2 === " ") {
|
|
476537
477183
|
const cmd = commands[selectedIndex];
|
|
476538
477184
|
if (cmd) {
|
|
476539
|
-
toggleSensitiveCommand(cmd.id);
|
|
477185
|
+
toggleSensitiveCommand(cmd.id, cmd.scope);
|
|
476540
477186
|
loadCommands();
|
|
476541
477187
|
const message = cmd.enabled ? t.sensitiveCommandConfig.disabledMessage : t.sensitiveCommandConfig.enabledMessage;
|
|
476542
477188
|
setSuccessMessage(message.replace("{pattern}", cmd.pattern));
|
|
@@ -476544,18 +477190,17 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476544
477190
|
setTimeout(() => setShowSuccess(false), 2e3);
|
|
476545
477191
|
}
|
|
476546
477192
|
} else if (input2 === "a" || input2 === "A") {
|
|
476547
|
-
|
|
476548
|
-
|
|
476549
|
-
|
|
476550
|
-
|
|
477193
|
+
setScopeSelectPurpose("add");
|
|
477194
|
+
setScopeSelectIndex(0);
|
|
477195
|
+
setConfirmResetScope(false);
|
|
477196
|
+
setViewMode("scope-select");
|
|
476551
477197
|
} else if (input2 === "d" || input2 === "D") {
|
|
476552
477198
|
const cmd = commands[selectedIndex];
|
|
476553
477199
|
if (cmd && !cmd.isPreset) {
|
|
476554
477200
|
if (!confirmDelete) {
|
|
476555
477201
|
setConfirmDelete(true);
|
|
476556
|
-
setConfirmReset(false);
|
|
476557
477202
|
} else {
|
|
476558
|
-
removeSensitiveCommand(cmd.id);
|
|
477203
|
+
removeSensitiveCommand(cmd.id, cmd.scope);
|
|
476559
477204
|
loadCommands();
|
|
476560
477205
|
setSelectedIndex((prev) => Math.min(prev, commands.length - 2));
|
|
476561
477206
|
setSuccessMessage(t.sensitiveCommandConfig.deletedMessage.replace("{pattern}", cmd.pattern));
|
|
@@ -476565,31 +477210,63 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476565
477210
|
}
|
|
476566
477211
|
}
|
|
476567
477212
|
} else if (input2 === "r" || input2 === "R") {
|
|
476568
|
-
|
|
476569
|
-
|
|
476570
|
-
|
|
476571
|
-
|
|
476572
|
-
|
|
477213
|
+
setScopeSelectPurpose("reset");
|
|
477214
|
+
setScopeSelectIndex(0);
|
|
477215
|
+
setConfirmResetScope(false);
|
|
477216
|
+
setViewMode("scope-select");
|
|
477217
|
+
}
|
|
477218
|
+
}, [commands, selectedIndex, onBack, loadCommands, confirmDelete, t]);
|
|
477219
|
+
const handleScopeSelectInput = (0, import_react76.useCallback)((_input, key) => {
|
|
477220
|
+
if (key.escape) {
|
|
477221
|
+
if (confirmResetScope) {
|
|
477222
|
+
setConfirmResetScope(false);
|
|
477223
|
+
return;
|
|
477224
|
+
}
|
|
477225
|
+
setViewMode("list");
|
|
477226
|
+
return;
|
|
477227
|
+
}
|
|
477228
|
+
if (confirmResetScope) {
|
|
477229
|
+
if (key.return) {
|
|
477230
|
+
const scope = SCOPE_OPTIONS[scopeSelectIndex];
|
|
477231
|
+
resetToDefaults(scope);
|
|
476573
477232
|
loadCommands();
|
|
476574
477233
|
setSelectedIndex(0);
|
|
476575
477234
|
setSuccessMessage(t.sensitiveCommandConfig.resetMessage);
|
|
476576
477235
|
setShowSuccess(true);
|
|
476577
477236
|
setTimeout(() => setShowSuccess(false), 2e3);
|
|
476578
|
-
|
|
477237
|
+
setConfirmResetScope(false);
|
|
477238
|
+
setViewMode("list");
|
|
477239
|
+
}
|
|
477240
|
+
return;
|
|
477241
|
+
}
|
|
477242
|
+
if (key.upArrow) {
|
|
477243
|
+
setScopeSelectIndex((prev) => prev > 0 ? prev - 1 : SCOPE_OPTIONS.length - 1);
|
|
477244
|
+
} else if (key.downArrow) {
|
|
477245
|
+
setScopeSelectIndex((prev) => prev < SCOPE_OPTIONS.length - 1 ? prev + 1 : 0);
|
|
477246
|
+
} else if (key.return) {
|
|
477247
|
+
const scope = SCOPE_OPTIONS[scopeSelectIndex];
|
|
477248
|
+
if (scopeSelectPurpose === "add") {
|
|
477249
|
+
setSelectedScope(scope);
|
|
477250
|
+
setViewMode("add");
|
|
477251
|
+
setCustomPattern("");
|
|
477252
|
+
setCustomDescription("");
|
|
477253
|
+
setAddField("pattern");
|
|
477254
|
+
setAddError("");
|
|
477255
|
+
} else {
|
|
477256
|
+
setConfirmResetScope(true);
|
|
476579
477257
|
}
|
|
476580
477258
|
}
|
|
476581
477259
|
}, [
|
|
476582
|
-
|
|
476583
|
-
|
|
476584
|
-
|
|
477260
|
+
scopeSelectIndex,
|
|
477261
|
+
scopeSelectPurpose,
|
|
477262
|
+
confirmResetScope,
|
|
476585
477263
|
loadCommands,
|
|
476586
|
-
confirmDelete,
|
|
476587
|
-
confirmReset,
|
|
476588
477264
|
t
|
|
476589
477265
|
]);
|
|
476590
477266
|
const handleAddInput = (0, import_react76.useCallback)((_input, key) => {
|
|
476591
477267
|
if (key.escape) {
|
|
476592
|
-
setViewMode("
|
|
477268
|
+
setViewMode("scope-select");
|
|
477269
|
+
setAddError("");
|
|
476593
477270
|
return;
|
|
476594
477271
|
}
|
|
476595
477272
|
if (key.tab) {
|
|
@@ -476599,6 +477276,8 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476599
477276
|
use_input_default((input2, key) => {
|
|
476600
477277
|
if (viewMode === "list") {
|
|
476601
477278
|
handleListInput(input2, key);
|
|
477279
|
+
} else if (viewMode === "scope-select") {
|
|
477280
|
+
handleScopeSelectInput(input2, key);
|
|
476602
477281
|
} else {
|
|
476603
477282
|
handleAddInput(input2, key);
|
|
476604
477283
|
}
|
|
@@ -476606,6 +477285,7 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476606
477285
|
const handlePatternChange = (0, import_react76.useCallback)((value) => {
|
|
476607
477286
|
if (!isFocusEventInput3(value)) {
|
|
476608
477287
|
setCustomPattern(stripFocusArtifacts3(value));
|
|
477288
|
+
setAddError("");
|
|
476609
477289
|
}
|
|
476610
477290
|
}, []);
|
|
476611
477291
|
const handleDescriptionChange = (0, import_react76.useCallback)((value) => {
|
|
@@ -476615,26 +477295,95 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476615
477295
|
}, []);
|
|
476616
477296
|
const handleAddSubmit = (0, import_react76.useCallback)(() => {
|
|
476617
477297
|
if (addField === "pattern") {
|
|
477298
|
+
if (customPattern.trim()) {
|
|
477299
|
+
const { isDuplicate, existingScope } = isDuplicatePattern(customPattern.trim());
|
|
477300
|
+
if (isDuplicate) {
|
|
477301
|
+
setAddError(t.sensitiveCommandConfig.duplicatePattern.replace("{pattern}", customPattern.trim()).replace("{scope}", getScopeLabel(existingScope)));
|
|
477302
|
+
return;
|
|
477303
|
+
}
|
|
477304
|
+
}
|
|
476618
477305
|
setAddField("description");
|
|
476619
477306
|
} else {
|
|
476620
477307
|
if (customPattern.trim() && customDescription.trim()) {
|
|
476621
477308
|
try {
|
|
476622
|
-
addSensitiveCommand(customPattern.trim(), customDescription.trim());
|
|
477309
|
+
addSensitiveCommand(customPattern.trim(), customDescription.trim(), selectedScope);
|
|
476623
477310
|
loadCommands();
|
|
476624
477311
|
setViewMode("list");
|
|
476625
477312
|
setSuccessMessage(t.sensitiveCommandConfig.addedMessage.replace("{pattern}", customPattern));
|
|
476626
477313
|
setShowSuccess(true);
|
|
476627
477314
|
setTimeout(() => setShowSuccess(false), 2e3);
|
|
477315
|
+
setAddError("");
|
|
476628
477316
|
} catch (error40) {
|
|
477317
|
+
if (typeof (error40 == null ? void 0 : error40.message) === "string" && error40.message.startsWith("DUPLICATE:")) {
|
|
477318
|
+
const scope = error40.message.split(":")[1];
|
|
477319
|
+
setAddError(t.sensitiveCommandConfig.duplicatePattern.replace("{pattern}", customPattern.trim()).replace("{scope}", getScopeLabel(scope)));
|
|
477320
|
+
}
|
|
476629
477321
|
}
|
|
476630
477322
|
}
|
|
476631
477323
|
}
|
|
476632
|
-
}, [
|
|
477324
|
+
}, [
|
|
477325
|
+
addField,
|
|
477326
|
+
customPattern,
|
|
477327
|
+
customDescription,
|
|
477328
|
+
selectedScope,
|
|
477329
|
+
loadCommands,
|
|
477330
|
+
t,
|
|
477331
|
+
getScopeLabel
|
|
477332
|
+
]);
|
|
477333
|
+
if (viewMode === "scope-select") {
|
|
477334
|
+
const isReset = scopeSelectPurpose === "reset";
|
|
477335
|
+
const title = isReset ? t.sensitiveCommandConfig.resetScopeSelectTitle : t.sensitiveCommandConfig.scopeSelectTitle;
|
|
477336
|
+
const scopeItems = [
|
|
477337
|
+
{
|
|
477338
|
+
label: t.sensitiveCommandConfig.scopeProject,
|
|
477339
|
+
desc: isReset ? t.sensitiveCommandConfig.resetProjectDesc : ".snow/sensitive-commands.json",
|
|
477340
|
+
scope: "project"
|
|
477341
|
+
},
|
|
477342
|
+
{
|
|
477343
|
+
label: t.sensitiveCommandConfig.scopeGlobal,
|
|
477344
|
+
desc: isReset ? t.sensitiveCommandConfig.resetGlobalDesc : "~/.snow/sensitive-commands.json",
|
|
477345
|
+
scope: "global"
|
|
477346
|
+
}
|
|
477347
|
+
];
|
|
477348
|
+
return import_react76.default.createElement(
|
|
477349
|
+
Box_default,
|
|
477350
|
+
{ flexDirection: "column", paddingX: inlineMode ? 0 : 2, paddingY: 1 },
|
|
477351
|
+
import_react76.default.createElement(Text, { bold: true, color: theme14.colors.menuInfo }, title),
|
|
477352
|
+
import_react76.default.createElement(Box_default, { marginTop: 1, flexDirection: "column" }, scopeItems.map((item, idx) => {
|
|
477353
|
+
const isSelected = idx === scopeSelectIndex;
|
|
477354
|
+
return import_react76.default.createElement(
|
|
477355
|
+
Box_default,
|
|
477356
|
+
{ key: item.scope, marginBottom: 1, flexDirection: "column" },
|
|
477357
|
+
import_react76.default.createElement(
|
|
477358
|
+
Text,
|
|
477359
|
+
{ color: isSelected ? theme14.colors.menuSelected : theme14.colors.menuNormal, bold: isSelected },
|
|
477360
|
+
isSelected ? "> " : " ",
|
|
477361
|
+
item.label
|
|
477362
|
+
),
|
|
477363
|
+
import_react76.default.createElement(
|
|
477364
|
+
Box_default,
|
|
477365
|
+
{ marginLeft: 3 },
|
|
477366
|
+
import_react76.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true }, item.desc)
|
|
477367
|
+
)
|
|
477368
|
+
);
|
|
477369
|
+
})),
|
|
477370
|
+
confirmResetScope && import_react76.default.createElement(
|
|
477371
|
+
Box_default,
|
|
477372
|
+
{ marginTop: 1 },
|
|
477373
|
+
import_react76.default.createElement(Text, { bold: true, color: theme14.colors.warning }, t.sensitiveCommandConfig.confirmResetScopeMessage.replace("{scope}", getScopeLabel(SCOPE_OPTIONS[scopeSelectIndex])))
|
|
477374
|
+
),
|
|
477375
|
+
import_react76.default.createElement(
|
|
477376
|
+
Box_default,
|
|
477377
|
+
{ marginTop: 1 },
|
|
477378
|
+
import_react76.default.createElement(Text, { dimColor: true }, confirmResetScope ? t.sensitiveCommandConfig.confirmHint : t.sensitiveCommandConfig.scopeSelectHint)
|
|
477379
|
+
)
|
|
477380
|
+
);
|
|
477381
|
+
}
|
|
476633
477382
|
if (viewMode === "add") {
|
|
476634
477383
|
return import_react76.default.createElement(
|
|
476635
477384
|
Box_default,
|
|
476636
477385
|
{ flexDirection: "column", paddingX: inlineMode ? 0 : 2, paddingY: 1 },
|
|
476637
|
-
import_react76.default.createElement(Text, { bold: true, color: theme14.colors.menuInfo }, t.sensitiveCommandConfig.addTitle),
|
|
477386
|
+
import_react76.default.createElement(Text, { bold: true, color: theme14.colors.menuInfo }, t.sensitiveCommandConfig.addTitle.replace("{scope}", getScopeLabel(selectedScope))),
|
|
476638
477387
|
import_react76.default.createElement(Box_default, { marginTop: 1 }),
|
|
476639
477388
|
import_react76.default.createElement(Text, { dimColor: true }, t.sensitiveCommandConfig.patternLabel),
|
|
476640
477389
|
import_react76.default.createElement(
|
|
@@ -476648,6 +477397,16 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476648
477397
|
),
|
|
476649
477398
|
import_react76.default.createElement(build_default2, { value: customPattern, onChange: handlePatternChange, onSubmit: handleAddSubmit, focus: addField === "pattern", placeholder: t.sensitiveCommandConfig.patternPlaceholder })
|
|
476650
477399
|
),
|
|
477400
|
+
addError && import_react76.default.createElement(
|
|
477401
|
+
Box_default,
|
|
477402
|
+
{ marginTop: 0 },
|
|
477403
|
+
import_react76.default.createElement(
|
|
477404
|
+
Text,
|
|
477405
|
+
{ color: theme14.colors.warning },
|
|
477406
|
+
"\u26A0\uFE0F ",
|
|
477407
|
+
addError
|
|
477408
|
+
)
|
|
477409
|
+
),
|
|
476651
477410
|
import_react76.default.createElement(Box_default, { marginTop: 1 }),
|
|
476652
477411
|
import_react76.default.createElement(Text, { dimColor: true }, t.sensitiveCommandConfig.descriptionLabel),
|
|
476653
477412
|
import_react76.default.createElement(
|
|
@@ -476685,9 +477444,10 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476685
477444
|
if (index < adjustedStart || index >= endIndex) {
|
|
476686
477445
|
return null;
|
|
476687
477446
|
}
|
|
477447
|
+
const scopeTag = cmd.isPreset ? "" : ` \xB7 ${getScopeLabel(cmd.scope)}`;
|
|
476688
477448
|
return import_react76.default.createElement(
|
|
476689
477449
|
Text,
|
|
476690
|
-
{ key: cmd.id
|
|
477450
|
+
{ key: `${cmd.scope}-${cmd.id}`, color: selectedIndex === index ? theme14.colors.menuInfo : cmd.enabled ? theme14.colors.menuNormal : theme14.colors.menuSecondary, bold: selectedIndex === index, dimColor: !cmd.enabled },
|
|
476691
477451
|
selectedIndex === index ? "\u276F " : " ",
|
|
476692
477452
|
"[",
|
|
476693
477453
|
cmd.enabled ? "\u2713" : " ",
|
|
@@ -476700,12 +477460,13 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476700
477460
|
" ",
|
|
476701
477461
|
"(",
|
|
476702
477462
|
t.sensitiveCommandConfig.custom,
|
|
477463
|
+
scopeTag,
|
|
476703
477464
|
")"
|
|
476704
477465
|
)
|
|
476705
477466
|
);
|
|
476706
477467
|
}),
|
|
476707
477468
|
import_react76.default.createElement(Box_default, { marginTop: 1 }),
|
|
476708
|
-
selectedCmd && !confirmDelete &&
|
|
477469
|
+
selectedCmd && !confirmDelete && import_react76.default.createElement(
|
|
476709
477470
|
Text,
|
|
476710
477471
|
{ dimColor: true },
|
|
476711
477472
|
selectedCmd.description,
|
|
@@ -476715,12 +477476,11 @@ function SensitiveCommandConfigScreen({ onBack, inlineMode = false }) {
|
|
|
476715
477476
|
!selectedCmd.isPreset && ` [${t.sensitiveCommandConfig.customLabel}]`
|
|
476716
477477
|
),
|
|
476717
477478
|
confirmDelete && selectedCmd && import_react76.default.createElement(Text, { bold: true, color: theme14.colors.warning }, t.sensitiveCommandConfig.confirmDeleteMessage.replace("{pattern}", selectedCmd.pattern)),
|
|
476718
|
-
confirmReset && import_react76.default.createElement(Text, { bold: true, color: theme14.colors.warning }, t.sensitiveCommandConfig.confirmResetMessage),
|
|
476719
477479
|
import_react76.default.createElement(Box_default, { marginTop: 1 }),
|
|
476720
|
-
import_react76.default.createElement(Text, { dimColor: true }, confirmDelete
|
|
477480
|
+
import_react76.default.createElement(Text, { dimColor: true }, confirmDelete ? t.sensitiveCommandConfig.confirmHint : t.sensitiveCommandConfig.listNavigationHint)
|
|
476721
477481
|
);
|
|
476722
477482
|
}
|
|
476723
|
-
var import_react76, focusEventTokenRegex3, isFocusEventInput3, stripFocusArtifacts3;
|
|
477483
|
+
var import_react76, focusEventTokenRegex3, isFocusEventInput3, stripFocusArtifacts3, SCOPE_OPTIONS;
|
|
476724
477484
|
var init_SensitiveCommandConfigScreen = __esm({
|
|
476725
477485
|
async "dist/ui/pages/SensitiveCommandConfigScreen.js"() {
|
|
476726
477486
|
"use strict";
|
|
@@ -476753,6 +477513,7 @@ var init_SensitiveCommandConfigScreen = __esm({
|
|
|
476753
477513
|
return "";
|
|
476754
477514
|
return value.replace(/\x1b\[[0-9;]*[IO]/g, "").replace(/\[[0-9;]*[IO]/g, "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "");
|
|
476755
477515
|
};
|
|
477516
|
+
SCOPE_OPTIONS = ["project", "global"];
|
|
476756
477517
|
}
|
|
476757
477518
|
});
|
|
476758
477519
|
|
|
@@ -476766,6 +477527,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476766
477527
|
const { theme: theme14 } = useTheme();
|
|
476767
477528
|
const [enabled, setEnabled] = (0, import_react77.useState)(false);
|
|
476768
477529
|
const [enableAgentReview, setEnableAgentReview] = (0, import_react77.useState)(true);
|
|
477530
|
+
const [enableReranking, setEnableReranking] = (0, import_react77.useState)(false);
|
|
476769
477531
|
const [embeddingType, setEmbeddingType] = (0, import_react77.useState)("jina");
|
|
476770
477532
|
const [embeddingModelName, setEmbeddingModelName] = (0, import_react77.useState)("");
|
|
476771
477533
|
const [embeddingBaseUrl, setEmbeddingBaseUrl] = (0, import_react77.useState)("");
|
|
@@ -476777,18 +477539,27 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476777
477539
|
const [chunkingMinLinesPerChunk, setChunkingMinLinesPerChunk] = (0, import_react77.useState)(10);
|
|
476778
477540
|
const [chunkingMinCharsPerChunk, setChunkingMinCharsPerChunk] = (0, import_react77.useState)(20);
|
|
476779
477541
|
const [chunkingOverlapLines, setChunkingOverlapLines] = (0, import_react77.useState)(20);
|
|
477542
|
+
const [rerankingModelName, setRerankingModelName] = (0, import_react77.useState)("");
|
|
477543
|
+
const [rerankingBaseUrl, setRerankingBaseUrl] = (0, import_react77.useState)("");
|
|
477544
|
+
const [rerankingApiKey, setRerankingApiKey] = (0, import_react77.useState)("");
|
|
477545
|
+
const [rerankingContextLength, setRerankingContextLength] = (0, import_react77.useState)(4096);
|
|
477546
|
+
const [rerankingTopN, setRerankingTopN] = (0, import_react77.useState)(5);
|
|
476780
477547
|
const [currentField, setCurrentField] = (0, import_react77.useState)("enabled");
|
|
476781
477548
|
const [isEditing, setIsEditing] = (0, import_react77.useState)(false);
|
|
477549
|
+
const [embeddingExpanded, setEmbeddingExpanded] = (0, import_react77.useState)(false);
|
|
477550
|
+
const [batchExpanded, setBatchExpanded] = (0, import_react77.useState)(false);
|
|
477551
|
+
const [rerankingExpanded, setRerankingExpanded] = (0, import_react77.useState)(false);
|
|
477552
|
+
const [toastMessage, setToastMessage] = (0, import_react77.useState)("");
|
|
476782
477553
|
const [errors, setErrors] = (0, import_react77.useState)([]);
|
|
476783
477554
|
const MAX_VISIBLE_FIELDS2 = 8;
|
|
476784
|
-
const
|
|
476785
|
-
"enabled",
|
|
476786
|
-
"enableAgentReview",
|
|
477555
|
+
const embeddingSubFields = [
|
|
476787
477556
|
"embeddingType",
|
|
476788
477557
|
"embeddingModelName",
|
|
476789
477558
|
"embeddingBaseUrl",
|
|
476790
477559
|
"embeddingApiKey",
|
|
476791
|
-
"embeddingDimensions"
|
|
477560
|
+
"embeddingDimensions"
|
|
477561
|
+
];
|
|
477562
|
+
const batchSubFields = [
|
|
476792
477563
|
"batchMaxLines",
|
|
476793
477564
|
"batchConcurrency",
|
|
476794
477565
|
"chunkingMaxLinesPerChunk",
|
|
@@ -476796,6 +477567,24 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476796
477567
|
"chunkingMinCharsPerChunk",
|
|
476797
477568
|
"chunkingOverlapLines"
|
|
476798
477569
|
];
|
|
477570
|
+
const rerankingSubFields = [
|
|
477571
|
+
"rerankingModelName",
|
|
477572
|
+
"rerankingBaseUrl",
|
|
477573
|
+
"rerankingApiKey",
|
|
477574
|
+
"rerankingContextLength",
|
|
477575
|
+
"rerankingTopN"
|
|
477576
|
+
];
|
|
477577
|
+
const allFields = [
|
|
477578
|
+
"enabled",
|
|
477579
|
+
"enableAgentReview",
|
|
477580
|
+
"enableReranking",
|
|
477581
|
+
"embeddingSettings",
|
|
477582
|
+
...embeddingExpanded ? embeddingSubFields : [],
|
|
477583
|
+
"rerankingSettings",
|
|
477584
|
+
...rerankingExpanded ? rerankingSubFields : [],
|
|
477585
|
+
"batchSettings",
|
|
477586
|
+
...batchExpanded ? batchSubFields : []
|
|
477587
|
+
];
|
|
476799
477588
|
const embeddingTypeOptions = [
|
|
476800
477589
|
{ label: "Jina & OpenAI", value: "jina" },
|
|
476801
477590
|
{ label: "Ollama", value: "ollama" },
|
|
@@ -476803,13 +477592,32 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476803
477592
|
];
|
|
476804
477593
|
const currentFieldIndex = allFields.indexOf(currentField);
|
|
476805
477594
|
const totalFields = allFields.length;
|
|
477595
|
+
const toastTimerRef = (0, import_react77.useRef)(null);
|
|
477596
|
+
const showToast = (0, import_react77.useCallback)((msg) => {
|
|
477597
|
+
if (toastTimerRef.current) {
|
|
477598
|
+
clearTimeout(toastTimerRef.current);
|
|
477599
|
+
}
|
|
477600
|
+
setToastMessage(msg);
|
|
477601
|
+
toastTimerRef.current = setTimeout(() => {
|
|
477602
|
+
setToastMessage("");
|
|
477603
|
+
toastTimerRef.current = null;
|
|
477604
|
+
}, 2e3);
|
|
477605
|
+
}, []);
|
|
476806
477606
|
(0, import_react77.useEffect)(() => {
|
|
476807
477607
|
loadConfiguration();
|
|
476808
477608
|
}, []);
|
|
477609
|
+
(0, import_react77.useEffect)(() => {
|
|
477610
|
+
return () => {
|
|
477611
|
+
if (toastTimerRef.current) {
|
|
477612
|
+
clearTimeout(toastTimerRef.current);
|
|
477613
|
+
}
|
|
477614
|
+
};
|
|
477615
|
+
}, []);
|
|
476809
477616
|
const loadConfiguration = () => {
|
|
476810
477617
|
const config3 = loadCodebaseConfig();
|
|
476811
477618
|
setEnabled(config3.enabled);
|
|
476812
477619
|
setEnableAgentReview(config3.enableAgentReview);
|
|
477620
|
+
setEnableReranking(config3.enableReranking);
|
|
476813
477621
|
setEmbeddingType(config3.embedding.type || "jina");
|
|
476814
477622
|
setEmbeddingModelName(config3.embedding.modelName);
|
|
476815
477623
|
setEmbeddingBaseUrl(config3.embedding.baseUrl);
|
|
@@ -476821,6 +477629,11 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476821
477629
|
setChunkingMinLinesPerChunk(config3.chunking.minLinesPerChunk);
|
|
476822
477630
|
setChunkingMinCharsPerChunk(config3.chunking.minCharsPerChunk);
|
|
476823
477631
|
setChunkingOverlapLines(config3.chunking.overlapLines);
|
|
477632
|
+
setRerankingModelName(config3.reranking.modelName);
|
|
477633
|
+
setRerankingBaseUrl(config3.reranking.baseUrl);
|
|
477634
|
+
setRerankingApiKey(config3.reranking.apiKey);
|
|
477635
|
+
setRerankingContextLength(config3.reranking.contextLength);
|
|
477636
|
+
setRerankingTopN(config3.reranking.topN);
|
|
476824
477637
|
};
|
|
476825
477638
|
const saveConfiguration = () => {
|
|
476826
477639
|
const validationErrors = [];
|
|
@@ -476855,6 +477668,20 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476855
477668
|
if (chunkingOverlapLines >= chunkingMaxLinesPerChunk) {
|
|
476856
477669
|
validationErrors.push(t.codebaseConfig.validationOverlapLessThanMaxLines);
|
|
476857
477670
|
}
|
|
477671
|
+
if (enableReranking) {
|
|
477672
|
+
if (!rerankingModelName.trim()) {
|
|
477673
|
+
validationErrors.push(t.codebaseConfig.validationRerankingModelNameRequired);
|
|
477674
|
+
}
|
|
477675
|
+
if (!rerankingBaseUrl.trim()) {
|
|
477676
|
+
validationErrors.push(t.codebaseConfig.validationRerankingBaseUrlRequired);
|
|
477677
|
+
}
|
|
477678
|
+
if (rerankingContextLength <= 0) {
|
|
477679
|
+
validationErrors.push(t.codebaseConfig.validationRerankingContextLengthPositive);
|
|
477680
|
+
}
|
|
477681
|
+
if (rerankingTopN <= 0) {
|
|
477682
|
+
validationErrors.push(t.codebaseConfig.validationRerankingTopNPositive);
|
|
477683
|
+
}
|
|
477684
|
+
}
|
|
476858
477685
|
}
|
|
476859
477686
|
if (validationErrors.length > 0) {
|
|
476860
477687
|
setErrors(validationErrors);
|
|
@@ -476864,6 +477691,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476864
477691
|
const config3 = {
|
|
476865
477692
|
enabled,
|
|
476866
477693
|
enableAgentReview,
|
|
477694
|
+
enableReranking,
|
|
476867
477695
|
embedding: {
|
|
476868
477696
|
type: embeddingType,
|
|
476869
477697
|
modelName: embeddingModelName,
|
|
@@ -476880,6 +477708,13 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476880
477708
|
minLinesPerChunk: chunkingMinLinesPerChunk,
|
|
476881
477709
|
minCharsPerChunk: chunkingMinCharsPerChunk,
|
|
476882
477710
|
overlapLines: chunkingOverlapLines
|
|
477711
|
+
},
|
|
477712
|
+
reranking: {
|
|
477713
|
+
modelName: rerankingModelName,
|
|
477714
|
+
baseUrl: rerankingBaseUrl,
|
|
477715
|
+
apiKey: rerankingApiKey,
|
|
477716
|
+
contextLength: rerankingContextLength,
|
|
477717
|
+
topN: rerankingTopN
|
|
476883
477718
|
}
|
|
476884
477719
|
};
|
|
476885
477720
|
saveCodebaseConfig(config3);
|
|
@@ -476943,10 +477778,49 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476943
477778
|
)
|
|
476944
477779
|
)
|
|
476945
477780
|
);
|
|
476946
|
-
case "
|
|
477781
|
+
case "enableReranking":
|
|
477782
|
+
return import_react77.default.createElement(
|
|
477783
|
+
Box_default,
|
|
477784
|
+
{ key: field, flexDirection: "column" },
|
|
477785
|
+
import_react77.default.createElement(
|
|
477786
|
+
Text,
|
|
477787
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
477788
|
+
isActive ? "\u276F " : " ",
|
|
477789
|
+
t.codebaseConfig.rerankingToggle
|
|
477790
|
+
),
|
|
477791
|
+
import_react77.default.createElement(
|
|
477792
|
+
Box_default,
|
|
477793
|
+
{ marginLeft: 3 },
|
|
477794
|
+
import_react77.default.createElement(
|
|
477795
|
+
Text,
|
|
477796
|
+
{ color: theme14.colors.menuSecondary },
|
|
477797
|
+
enableReranking ? t.codebaseConfig.enabled : t.codebaseConfig.disabled,
|
|
477798
|
+
" ",
|
|
477799
|
+
t.codebaseConfig.toggleHint
|
|
477800
|
+
)
|
|
477801
|
+
)
|
|
477802
|
+
);
|
|
477803
|
+
case "embeddingSettings":
|
|
476947
477804
|
return import_react77.default.createElement(
|
|
476948
477805
|
Box_default,
|
|
476949
477806
|
{ key: field, flexDirection: "column" },
|
|
477807
|
+
import_react77.default.createElement(
|
|
477808
|
+
Text,
|
|
477809
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
477810
|
+
isActive ? "\u276F " : " ",
|
|
477811
|
+
embeddingExpanded ? "\u25BC " : "\u25B6 ",
|
|
477812
|
+
t.codebaseConfig.embeddingSettingsGroup
|
|
477813
|
+
),
|
|
477814
|
+
import_react77.default.createElement(
|
|
477815
|
+
Box_default,
|
|
477816
|
+
{ marginLeft: 3 },
|
|
477817
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, t.codebaseConfig.embeddingSettingsExpandHint)
|
|
477818
|
+
)
|
|
477819
|
+
);
|
|
477820
|
+
case "embeddingType":
|
|
477821
|
+
return import_react77.default.createElement(
|
|
477822
|
+
Box_default,
|
|
477823
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
476950
477824
|
import_react77.default.createElement(
|
|
476951
477825
|
Text,
|
|
476952
477826
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -476975,7 +477849,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
476975
477849
|
case "embeddingModelName":
|
|
476976
477850
|
return import_react77.default.createElement(
|
|
476977
477851
|
Box_default,
|
|
476978
|
-
{ key: field, flexDirection: "column" },
|
|
477852
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
476979
477853
|
import_react77.default.createElement(
|
|
476980
477854
|
Text,
|
|
476981
477855
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477000,7 +477874,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477000
477874
|
case "embeddingBaseUrl":
|
|
477001
477875
|
return import_react77.default.createElement(
|
|
477002
477876
|
Box_default,
|
|
477003
|
-
{ key: field, flexDirection: "column" },
|
|
477877
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477004
477878
|
import_react77.default.createElement(
|
|
477005
477879
|
Text,
|
|
477006
477880
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477025,7 +477899,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477025
477899
|
case "embeddingApiKey":
|
|
477026
477900
|
return import_react77.default.createElement(
|
|
477027
477901
|
Box_default,
|
|
477028
|
-
{ key: field, flexDirection: "column" },
|
|
477902
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477029
477903
|
import_react77.default.createElement(
|
|
477030
477904
|
Text,
|
|
477031
477905
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477050,7 +477924,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477050
477924
|
case "embeddingDimensions":
|
|
477051
477925
|
return import_react77.default.createElement(
|
|
477052
477926
|
Box_default,
|
|
477053
|
-
{ key: field, flexDirection: "column" },
|
|
477927
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477054
477928
|
import_react77.default.createElement(
|
|
477055
477929
|
Text,
|
|
477056
477930
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477074,10 +477948,27 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477074
477948
|
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, embeddingDimensions)
|
|
477075
477949
|
)
|
|
477076
477950
|
);
|
|
477077
|
-
case "
|
|
477951
|
+
case "batchSettings":
|
|
477078
477952
|
return import_react77.default.createElement(
|
|
477079
477953
|
Box_default,
|
|
477080
477954
|
{ key: field, flexDirection: "column" },
|
|
477955
|
+
import_react77.default.createElement(
|
|
477956
|
+
Text,
|
|
477957
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
477958
|
+
isActive ? "\u276F " : " ",
|
|
477959
|
+
batchExpanded ? "\u25BC " : "\u25B6 ",
|
|
477960
|
+
t.codebaseConfig.batchSettingsGroup
|
|
477961
|
+
),
|
|
477962
|
+
import_react77.default.createElement(
|
|
477963
|
+
Box_default,
|
|
477964
|
+
{ marginLeft: 3 },
|
|
477965
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, t.codebaseConfig.batchSettingsExpandHint)
|
|
477966
|
+
)
|
|
477967
|
+
);
|
|
477968
|
+
case "batchMaxLines":
|
|
477969
|
+
return import_react77.default.createElement(
|
|
477970
|
+
Box_default,
|
|
477971
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477081
477972
|
import_react77.default.createElement(
|
|
477082
477973
|
Text,
|
|
477083
477974
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477104,7 +477995,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477104
477995
|
case "batchConcurrency":
|
|
477105
477996
|
return import_react77.default.createElement(
|
|
477106
477997
|
Box_default,
|
|
477107
|
-
{ key: field, flexDirection: "column" },
|
|
477998
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477108
477999
|
import_react77.default.createElement(
|
|
477109
478000
|
Text,
|
|
477110
478001
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477131,7 +478022,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477131
478022
|
case "chunkingMaxLinesPerChunk":
|
|
477132
478023
|
return import_react77.default.createElement(
|
|
477133
478024
|
Box_default,
|
|
477134
|
-
{ key: field, flexDirection: "column" },
|
|
478025
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477135
478026
|
import_react77.default.createElement(
|
|
477136
478027
|
Text,
|
|
477137
478028
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477158,7 +478049,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477158
478049
|
case "chunkingMinLinesPerChunk":
|
|
477159
478050
|
return import_react77.default.createElement(
|
|
477160
478051
|
Box_default,
|
|
477161
|
-
{ key: field, flexDirection: "column" },
|
|
478052
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477162
478053
|
import_react77.default.createElement(
|
|
477163
478054
|
Text,
|
|
477164
478055
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477185,7 +478076,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477185
478076
|
case "chunkingMinCharsPerChunk":
|
|
477186
478077
|
return import_react77.default.createElement(
|
|
477187
478078
|
Box_default,
|
|
477188
|
-
{ key: field, flexDirection: "column" },
|
|
478079
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477189
478080
|
import_react77.default.createElement(
|
|
477190
478081
|
Text,
|
|
477191
478082
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477212,7 +478103,7 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477212
478103
|
case "chunkingOverlapLines":
|
|
477213
478104
|
return import_react77.default.createElement(
|
|
477214
478105
|
Box_default,
|
|
477215
|
-
{ key: field, flexDirection: "column" },
|
|
478106
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
477216
478107
|
import_react77.default.createElement(
|
|
477217
478108
|
Text,
|
|
477218
478109
|
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
@@ -477236,6 +478127,152 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477236
478127
|
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, chunkingOverlapLines)
|
|
477237
478128
|
)
|
|
477238
478129
|
);
|
|
478130
|
+
case "rerankingSettings":
|
|
478131
|
+
return import_react77.default.createElement(
|
|
478132
|
+
Box_default,
|
|
478133
|
+
{ key: field, flexDirection: "column" },
|
|
478134
|
+
import_react77.default.createElement(
|
|
478135
|
+
Text,
|
|
478136
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
478137
|
+
isActive ? "\u276F " : " ",
|
|
478138
|
+
rerankingExpanded ? "\u25BC " : "\u25B6 ",
|
|
478139
|
+
t.codebaseConfig.rerankingSettingsGroup
|
|
478140
|
+
),
|
|
478141
|
+
import_react77.default.createElement(
|
|
478142
|
+
Box_default,
|
|
478143
|
+
{ marginLeft: 3 },
|
|
478144
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, t.codebaseConfig.rerankingSettingsExpandHint)
|
|
478145
|
+
)
|
|
478146
|
+
);
|
|
478147
|
+
case "rerankingModelName":
|
|
478148
|
+
return import_react77.default.createElement(
|
|
478149
|
+
Box_default,
|
|
478150
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
478151
|
+
import_react77.default.createElement(
|
|
478152
|
+
Text,
|
|
478153
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
478154
|
+
isActive ? "\u276F " : " ",
|
|
478155
|
+
t.codebaseConfig.rerankingModelName
|
|
478156
|
+
),
|
|
478157
|
+
isCurrentlyEditing && import_react77.default.createElement(
|
|
478158
|
+
Box_default,
|
|
478159
|
+
{ marginLeft: 3 },
|
|
478160
|
+
import_react77.default.createElement(
|
|
478161
|
+
Text,
|
|
478162
|
+
{ color: theme14.colors.menuInfo },
|
|
478163
|
+
import_react77.default.createElement(build_default2, { value: rerankingModelName, onChange: (value) => setRerankingModelName(stripFocusArtifacts4(value)), onSubmit: () => setIsEditing(false) })
|
|
478164
|
+
)
|
|
478165
|
+
),
|
|
478166
|
+
!isCurrentlyEditing && import_react77.default.createElement(
|
|
478167
|
+
Box_default,
|
|
478168
|
+
{ marginLeft: 3 },
|
|
478169
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, rerankingModelName || t.codebaseConfig.notSet)
|
|
478170
|
+
)
|
|
478171
|
+
);
|
|
478172
|
+
case "rerankingBaseUrl":
|
|
478173
|
+
return import_react77.default.createElement(
|
|
478174
|
+
Box_default,
|
|
478175
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
478176
|
+
import_react77.default.createElement(
|
|
478177
|
+
Text,
|
|
478178
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
478179
|
+
isActive ? "\u276F " : " ",
|
|
478180
|
+
t.codebaseConfig.rerankingBaseUrl
|
|
478181
|
+
),
|
|
478182
|
+
isCurrentlyEditing && import_react77.default.createElement(
|
|
478183
|
+
Box_default,
|
|
478184
|
+
{ marginLeft: 3 },
|
|
478185
|
+
import_react77.default.createElement(
|
|
478186
|
+
Text,
|
|
478187
|
+
{ color: theme14.colors.menuInfo },
|
|
478188
|
+
import_react77.default.createElement(build_default2, { value: rerankingBaseUrl, onChange: (value) => setRerankingBaseUrl(stripFocusArtifacts4(value)), onSubmit: () => setIsEditing(false) })
|
|
478189
|
+
)
|
|
478190
|
+
),
|
|
478191
|
+
!isCurrentlyEditing && import_react77.default.createElement(
|
|
478192
|
+
Box_default,
|
|
478193
|
+
{ marginLeft: 3 },
|
|
478194
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, rerankingBaseUrl || t.codebaseConfig.notSet)
|
|
478195
|
+
)
|
|
478196
|
+
);
|
|
478197
|
+
case "rerankingApiKey":
|
|
478198
|
+
return import_react77.default.createElement(
|
|
478199
|
+
Box_default,
|
|
478200
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
478201
|
+
import_react77.default.createElement(
|
|
478202
|
+
Text,
|
|
478203
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
478204
|
+
isActive ? "\u276F " : " ",
|
|
478205
|
+
t.codebaseConfig.rerankingApiKey
|
|
478206
|
+
),
|
|
478207
|
+
isCurrentlyEditing && import_react77.default.createElement(
|
|
478208
|
+
Box_default,
|
|
478209
|
+
{ marginLeft: 3 },
|
|
478210
|
+
import_react77.default.createElement(
|
|
478211
|
+
Text,
|
|
478212
|
+
{ color: theme14.colors.menuInfo },
|
|
478213
|
+
import_react77.default.createElement(build_default2, { value: rerankingApiKey, onChange: (value) => setRerankingApiKey(stripFocusArtifacts4(value)), onSubmit: () => setIsEditing(false), mask: "*" })
|
|
478214
|
+
)
|
|
478215
|
+
),
|
|
478216
|
+
!isCurrentlyEditing && import_react77.default.createElement(
|
|
478217
|
+
Box_default,
|
|
478218
|
+
{ marginLeft: 3 },
|
|
478219
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, rerankingApiKey ? t.codebaseConfig.masked : t.codebaseConfig.notSet)
|
|
478220
|
+
)
|
|
478221
|
+
);
|
|
478222
|
+
case "rerankingContextLength":
|
|
478223
|
+
return import_react77.default.createElement(
|
|
478224
|
+
Box_default,
|
|
478225
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
478226
|
+
import_react77.default.createElement(
|
|
478227
|
+
Text,
|
|
478228
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
478229
|
+
isActive ? "\u276F " : " ",
|
|
478230
|
+
t.codebaseConfig.rerankingContextLength
|
|
478231
|
+
),
|
|
478232
|
+
isCurrentlyEditing && import_react77.default.createElement(
|
|
478233
|
+
Box_default,
|
|
478234
|
+
{ marginLeft: 3 },
|
|
478235
|
+
import_react77.default.createElement(
|
|
478236
|
+
Text,
|
|
478237
|
+
{ color: theme14.colors.menuInfo },
|
|
478238
|
+
t.codebaseConfig.enterValue,
|
|
478239
|
+
" ",
|
|
478240
|
+
rerankingContextLength
|
|
478241
|
+
)
|
|
478242
|
+
),
|
|
478243
|
+
!isCurrentlyEditing && import_react77.default.createElement(
|
|
478244
|
+
Box_default,
|
|
478245
|
+
{ marginLeft: 3 },
|
|
478246
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, rerankingContextLength)
|
|
478247
|
+
)
|
|
478248
|
+
);
|
|
478249
|
+
case "rerankingTopN":
|
|
478250
|
+
return import_react77.default.createElement(
|
|
478251
|
+
Box_default,
|
|
478252
|
+
{ key: field, flexDirection: "column", marginLeft: 2 },
|
|
478253
|
+
import_react77.default.createElement(
|
|
478254
|
+
Text,
|
|
478255
|
+
{ color: isActive ? theme14.colors.menuSelected : theme14.colors.menuNormal },
|
|
478256
|
+
isActive ? "\u276F " : " ",
|
|
478257
|
+
t.codebaseConfig.rerankingTopN
|
|
478258
|
+
),
|
|
478259
|
+
isCurrentlyEditing && import_react77.default.createElement(
|
|
478260
|
+
Box_default,
|
|
478261
|
+
{ marginLeft: 3 },
|
|
478262
|
+
import_react77.default.createElement(
|
|
478263
|
+
Text,
|
|
478264
|
+
{ color: theme14.colors.menuInfo },
|
|
478265
|
+
t.codebaseConfig.enterValue,
|
|
478266
|
+
" ",
|
|
478267
|
+
rerankingTopN
|
|
478268
|
+
)
|
|
478269
|
+
),
|
|
478270
|
+
!isCurrentlyEditing && import_react77.default.createElement(
|
|
478271
|
+
Box_default,
|
|
478272
|
+
{ marginLeft: 3 },
|
|
478273
|
+
import_react77.default.createElement(Text, { color: theme14.colors.menuSecondary }, rerankingTopN)
|
|
478274
|
+
)
|
|
478275
|
+
);
|
|
477239
478276
|
default:
|
|
477240
478277
|
return null;
|
|
477241
478278
|
}
|
|
@@ -477247,7 +478284,9 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477247
478284
|
"chunkingMaxLinesPerChunk",
|
|
477248
478285
|
"chunkingMinLinesPerChunk",
|
|
477249
478286
|
"chunkingMinCharsPerChunk",
|
|
477250
|
-
"chunkingOverlapLines"
|
|
478287
|
+
"chunkingOverlapLines",
|
|
478288
|
+
"rerankingContextLength",
|
|
478289
|
+
"rerankingTopN"
|
|
477251
478290
|
];
|
|
477252
478291
|
const isNumericField = (field) => numericFields.includes(field);
|
|
477253
478292
|
const getNumericValue = (field) => {
|
|
@@ -477266,6 +478305,10 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477266
478305
|
return chunkingMinCharsPerChunk;
|
|
477267
478306
|
case "chunkingOverlapLines":
|
|
477268
478307
|
return chunkingOverlapLines;
|
|
478308
|
+
case "rerankingContextLength":
|
|
478309
|
+
return rerankingContextLength;
|
|
478310
|
+
case "rerankingTopN":
|
|
478311
|
+
return rerankingTopN;
|
|
477269
478312
|
default:
|
|
477270
478313
|
return 0;
|
|
477271
478314
|
}
|
|
@@ -477293,6 +478336,12 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477293
478336
|
case "chunkingOverlapLines":
|
|
477294
478337
|
setChunkingOverlapLines(value);
|
|
477295
478338
|
break;
|
|
478339
|
+
case "rerankingContextLength":
|
|
478340
|
+
setRerankingContextLength(value);
|
|
478341
|
+
break;
|
|
478342
|
+
case "rerankingTopN":
|
|
478343
|
+
setRerankingTopN(value);
|
|
478344
|
+
break;
|
|
477296
478345
|
}
|
|
477297
478346
|
};
|
|
477298
478347
|
use_input_default((rawInput, key) => {
|
|
@@ -477348,14 +478397,44 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477348
478397
|
return;
|
|
477349
478398
|
}
|
|
477350
478399
|
if (key.return && currentField === "enableAgentReview") {
|
|
477351
|
-
|
|
478400
|
+
const newValue = !enableAgentReview;
|
|
478401
|
+
setEnableAgentReview(newValue);
|
|
478402
|
+
if (newValue) {
|
|
478403
|
+
setEnableReranking(false);
|
|
478404
|
+
}
|
|
478405
|
+
return;
|
|
478406
|
+
}
|
|
478407
|
+
if (key.return && currentField === "enableReranking") {
|
|
478408
|
+
if (!enableReranking) {
|
|
478409
|
+
if (!rerankingModelName.trim() || !rerankingBaseUrl.trim()) {
|
|
478410
|
+
showToast(t.codebaseConfig.rerankingNotConfigured);
|
|
478411
|
+
return;
|
|
478412
|
+
}
|
|
478413
|
+
}
|
|
478414
|
+
const newValue = !enableReranking;
|
|
478415
|
+
setEnableReranking(newValue);
|
|
478416
|
+
if (newValue) {
|
|
478417
|
+
setEnableAgentReview(false);
|
|
478418
|
+
}
|
|
478419
|
+
return;
|
|
478420
|
+
}
|
|
478421
|
+
if (key.return && currentField === "embeddingSettings") {
|
|
478422
|
+
setEmbeddingExpanded(!embeddingExpanded);
|
|
478423
|
+
return;
|
|
478424
|
+
}
|
|
478425
|
+
if (key.return && currentField === "batchSettings") {
|
|
478426
|
+
setBatchExpanded(!batchExpanded);
|
|
478427
|
+
return;
|
|
478428
|
+
}
|
|
478429
|
+
if (key.return && currentField === "rerankingSettings") {
|
|
478430
|
+
setRerankingExpanded(!rerankingExpanded);
|
|
477352
478431
|
return;
|
|
477353
478432
|
}
|
|
477354
478433
|
if (key.return && currentField === "embeddingType") {
|
|
477355
478434
|
setIsEditing(true);
|
|
477356
478435
|
return;
|
|
477357
478436
|
}
|
|
477358
|
-
if (key.return && currentField !== "enabled" && currentField !== "enableAgentReview") {
|
|
478437
|
+
if (key.return && currentField !== "enabled" && currentField !== "enableAgentReview" && currentField !== "enableReranking" && currentField !== "embeddingSettings" && currentField !== "batchSettings" && currentField !== "rerankingSettings") {
|
|
477359
478438
|
setIsEditing(true);
|
|
477360
478439
|
return;
|
|
477361
478440
|
}
|
|
@@ -477424,6 +478503,11 @@ function CodeBaseConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
477424
478503
|
error40
|
|
477425
478504
|
))
|
|
477426
478505
|
),
|
|
478506
|
+
toastMessage && import_react77.default.createElement(
|
|
478507
|
+
Box_default,
|
|
478508
|
+
{ marginTop: 1 },
|
|
478509
|
+
import_react77.default.createElement(Alert, { variant: "warning" }, toastMessage)
|
|
478510
|
+
),
|
|
477427
478511
|
import_react77.default.createElement(Box_default, { flexDirection: "column", marginTop: 1 }, isEditing ? import_react77.default.createElement(Alert, { variant: "info" }, t.codebaseConfig.editingHint) : import_react77.default.createElement(Alert, { variant: "info" }, t.codebaseConfig.navigationHint))
|
|
477428
478512
|
);
|
|
477429
478513
|
}
|
|
@@ -477828,7 +478912,7 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
477828
478912
|
import_react78.default.createElement(
|
|
477829
478913
|
Text,
|
|
477830
478914
|
{ color: index === selectedIndex ? theme14.colors.menuSelected : config3.active.includes(prompt.id) ? theme14.colors.menuInfo : theme14.colors.menuNormal },
|
|
477831
|
-
index === selectedIndex ? "
|
|
478915
|
+
index === selectedIndex ? "\u276F " : " ",
|
|
477832
478916
|
config3.active.includes(prompt.id) ? "[\u2713] " : "[ ] ",
|
|
477833
478917
|
prompt.name,
|
|
477834
478918
|
typeof prompt.content === "string" && prompt.content.length > 0 && import_react78.default.createElement(
|
|
@@ -553059,6 +554143,17 @@ function trimLines(lines) {
|
|
|
553059
554143
|
}
|
|
553060
554144
|
return result2;
|
|
553061
554145
|
}
|
|
554146
|
+
function renderMarkdownToLines(content) {
|
|
554147
|
+
try {
|
|
554148
|
+
const sanitized = sanitizeMarkdownContent(content);
|
|
554149
|
+
const rendered = marked.parse(sanitized);
|
|
554150
|
+
if (!rendered || typeof rendered !== "string")
|
|
554151
|
+
return content.split("\n");
|
|
554152
|
+
return trimLines(rendered.split("\n"));
|
|
554153
|
+
} catch {
|
|
554154
|
+
return content.split("\n");
|
|
554155
|
+
}
|
|
554156
|
+
}
|
|
553062
554157
|
function MarkdownRenderer({ content }) {
|
|
553063
554158
|
var _a20;
|
|
553064
554159
|
try {
|
|
@@ -561967,7 +563062,7 @@ function formatDate(isoDate) {
|
|
|
561967
563062
|
const match = isoDate.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
561968
563063
|
return (match == null ? void 0 : match[1]) ?? isoDate;
|
|
561969
563064
|
}
|
|
561970
|
-
function
|
|
563065
|
+
function truncateText2(text2, maxLen) {
|
|
561971
563066
|
if (maxLen <= 0)
|
|
561972
563067
|
return "";
|
|
561973
563068
|
if (text2.length <= maxLen)
|
|
@@ -562088,7 +563183,7 @@ var init_GitLinePickerPanel = __esm({
|
|
|
562088
563183
|
import_react110.default.createElement(Box_default, { marginTop: 1, flexDirection: "column" }, displayedCommits.map((commit, index) => {
|
|
562089
563184
|
const isSelected = index === displayedSelectedIndex;
|
|
562090
563185
|
const isChecked = selectedCommits.has(commit.sha);
|
|
562091
|
-
const title = commit.kind === "staged" ? `${t.reviewCommitPanel.stagedLabel} (${commit.fileCount ?? 0} ${t.reviewCommitPanel.filesLabel})` : `${formatShortSha(commit.sha)} ${
|
|
563186
|
+
const title = commit.kind === "staged" ? `${t.reviewCommitPanel.stagedLabel} (${commit.fileCount ?? 0} ${t.reviewCommitPanel.filesLabel})` : `${formatShortSha(commit.sha)} ${truncateText2(commit.subject, 72)}`;
|
|
562092
563187
|
const subtitle = commit.kind === "staged" ? "" : `${commit.authorName} \xB7 ${formatDate(commit.dateIso)}`;
|
|
562093
563188
|
return import_react110.default.createElement(
|
|
562094
563189
|
Box_default,
|
|
@@ -564555,7 +565650,7 @@ function formatDate2(isoDate) {
|
|
|
564555
565650
|
const match = isoDate.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
564556
565651
|
return (match == null ? void 0 : match[1]) ?? isoDate;
|
|
564557
565652
|
}
|
|
564558
|
-
function
|
|
565653
|
+
function truncateText3(text2, maxLen) {
|
|
564559
565654
|
if (maxLen <= 0)
|
|
564560
565655
|
return "";
|
|
564561
565656
|
if (text2.length <= maxLen)
|
|
@@ -564785,8 +565880,8 @@ function ReviewCommitPanel({ visible, onClose, onConfirm, maxHeight }) {
|
|
|
564785
565880
|
const isActive = absoluteIndex === selectedIndex;
|
|
564786
565881
|
const keyId = it.kind === "staged" ? "staged" : it.kind === "unstaged" ? "unstaged" : it.item.sha;
|
|
564787
565882
|
const isChecked = checked.has(keyId);
|
|
564788
|
-
const title = it.kind === "staged" ? `${t.reviewCommitPanel.stagedLabel} (${stagedFileCount} ${t.reviewCommitPanel.filesLabel})` : it.kind === "unstaged" ? `${t.reviewCommitPanel.unstagedLabel} (${unstagedFileCount} ${t.reviewCommitPanel.filesLabel})` : `${formatShortSha2(it.item.sha)} ${
|
|
564789
|
-
const subtitle = it.kind === "staged" || it.kind === "unstaged" ? "" : `${
|
|
565883
|
+
const title = it.kind === "staged" ? `${t.reviewCommitPanel.stagedLabel} (${stagedFileCount} ${t.reviewCommitPanel.filesLabel})` : it.kind === "unstaged" ? `${t.reviewCommitPanel.unstagedLabel} (${unstagedFileCount} ${t.reviewCommitPanel.filesLabel})` : `${formatShortSha2(it.item.sha)} ${truncateText3(it.item.subject, 72)}`;
|
|
565884
|
+
const subtitle = it.kind === "staged" || it.kind === "unstaged" ? "" : `${truncateText3(it.item.authorName, 24)} \xB7 ${formatDate2(it.item.dateIso)}`;
|
|
564790
565885
|
return import_react122.default.createElement(
|
|
564791
565886
|
Box_default,
|
|
564792
565887
|
{ key: keyId, flexDirection: "column", width: "100%" },
|
|
@@ -564966,34 +566061,6 @@ __export(BtwPanel_exports, {
|
|
|
564966
566061
|
BtwPanel: () => BtwPanel,
|
|
564967
566062
|
default: () => BtwPanel_default
|
|
564968
566063
|
});
|
|
564969
|
-
function toVisualLines(text2, maxWidth) {
|
|
564970
|
-
if (maxWidth <= 0)
|
|
564971
|
-
return text2.split("\n");
|
|
564972
|
-
const result2 = [];
|
|
564973
|
-
for (const logical of text2.split("\n")) {
|
|
564974
|
-
if (!logical || visualWidth(logical) <= maxWidth) {
|
|
564975
|
-
result2.push(logical);
|
|
564976
|
-
continue;
|
|
564977
|
-
}
|
|
564978
|
-
const chars = [...logical];
|
|
564979
|
-
let cur = "";
|
|
564980
|
-
let curW = 0;
|
|
564981
|
-
for (const ch of chars) {
|
|
564982
|
-
const w = visualWidth(ch);
|
|
564983
|
-
if (curW + w > maxWidth) {
|
|
564984
|
-
result2.push(cur);
|
|
564985
|
-
cur = ch;
|
|
564986
|
-
curW = w;
|
|
564987
|
-
} else {
|
|
564988
|
-
cur += ch;
|
|
564989
|
-
curW += w;
|
|
564990
|
-
}
|
|
564991
|
-
}
|
|
564992
|
-
if (cur)
|
|
564993
|
-
result2.push(cur);
|
|
564994
|
-
}
|
|
564995
|
-
return result2;
|
|
564996
|
-
}
|
|
564997
566064
|
var import_react123, VISIBLE_ROWS, DEBOUNCE_MS, BtwPanel, BtwPanel_default;
|
|
564998
566065
|
var init_BtwPanel = __esm({
|
|
564999
566066
|
async "dist/ui/components/panels/BtwPanel.js"() {
|
|
@@ -565005,6 +566072,7 @@ var init_BtwPanel = __esm({
|
|
|
565005
566072
|
init_useTerminalSize();
|
|
565006
566073
|
init_btwStream();
|
|
565007
566074
|
init_textUtils();
|
|
566075
|
+
await init_MarkdownRenderer();
|
|
565008
566076
|
VISIBLE_ROWS = 8;
|
|
565009
566077
|
DEBOUNCE_MS = 80;
|
|
565010
566078
|
BtwPanel = ({ prompt, onClose }) => {
|
|
@@ -565021,7 +566089,7 @@ var init_BtwPanel = __esm({
|
|
|
565021
566089
|
const debounceTimerRef = (0, import_react123.useRef)(null);
|
|
565022
566090
|
const btwText = t.btw || {};
|
|
565023
566091
|
const contentWidth = Math.max(1, columns - 4);
|
|
565024
|
-
const visualLines = (0, import_react123.useMemo)(() =>
|
|
566092
|
+
const visualLines = (0, import_react123.useMemo)(() => response ? renderMarkdownToLines(response) : [], [response]);
|
|
565025
566093
|
const flushPending = (0, import_react123.useCallback)(() => {
|
|
565026
566094
|
debounceTimerRef.current = null;
|
|
565027
566095
|
setResponse(pendingTextRef.current);
|
|
@@ -565363,22 +566431,6 @@ var init_ChatFooter = __esm({
|
|
|
565363
566431
|
import_react124.default.createElement(TodoTree, { todos })
|
|
565364
566432
|
),
|
|
565365
566433
|
import_react124.default.createElement(StatusLine, { yoloMode: props.yoloMode, planMode: props.planMode, vulnerabilityHuntingMode: props.vulnerabilityHuntingMode, toolSearchDisabled: props.toolSearchDisabled, hybridCompressEnabled: props.hybridCompressEnabled, teamMode: props.teamMode, vscodeConnectionStatus: props.vscodeConnectionStatus, editorContext: props.editorContext, connectionStatus, connectionInstanceName, contextUsage: props.contextUsage, codebaseIndexing: props.codebaseIndexing, codebaseProgress: props.codebaseProgress, watcherEnabled: props.watcherEnabled, fileUpdateNotification: props.fileUpdateNotification, copyStatusMessage, currentProfileName: props.currentProfileName, compressBlockToast: props.compressBlockToast }),
|
|
565366
|
-
props.isCompressing && import_react124.default.createElement(
|
|
565367
|
-
Box_default,
|
|
565368
|
-
{ marginTop: 1 },
|
|
565369
|
-
import_react124.default.createElement(
|
|
565370
|
-
Text,
|
|
565371
|
-
{ color: "cyan" },
|
|
565372
|
-
import_react124.default.createElement(build_default, { type: "dots" }),
|
|
565373
|
-
" ",
|
|
565374
|
-
t.chatScreen.compressionInProgress
|
|
565375
|
-
)
|
|
565376
|
-
),
|
|
565377
|
-
props.compressionError && import_react124.default.createElement(
|
|
565378
|
-
Box_default,
|
|
565379
|
-
{ marginTop: 1 },
|
|
565380
|
-
import_react124.default.createElement(Text, { color: "red" }, t.chatScreen.compressionFailed.replace("{error}", props.compressionError))
|
|
565381
|
-
),
|
|
565382
566434
|
props.showBackgroundPanel && import_react124.default.createElement(BackgroundProcessPanel, { processes: props.backgroundProcesses, selectedIndex: props.selectedProcessIndex, terminalWidth: props.terminalWidth })
|
|
565383
566435
|
),
|
|
565384
566436
|
props.showReviewCommitPanel && import_react124.default.createElement(
|
|
@@ -565485,14 +566537,14 @@ function getSnowDirPath2(workingDirectory) {
|
|
|
565485
566537
|
function getPermissionsFilePath(workingDirectory) {
|
|
565486
566538
|
return join39(getSnowDirPath2(workingDirectory), PERMISSIONS_FILE);
|
|
565487
566539
|
}
|
|
565488
|
-
function
|
|
566540
|
+
function ensureConfigDirectory7(workingDirectory) {
|
|
565489
566541
|
const snowDir = getSnowDirPath2(workingDirectory);
|
|
565490
566542
|
if (!existsSync37(snowDir)) {
|
|
565491
566543
|
mkdirSync21(snowDir, { recursive: true });
|
|
565492
566544
|
}
|
|
565493
566545
|
}
|
|
565494
566546
|
function loadPermissionsConfig(workingDirectory) {
|
|
565495
|
-
|
|
566547
|
+
ensureConfigDirectory7(workingDirectory);
|
|
565496
566548
|
const configPath = getPermissionsFilePath(workingDirectory);
|
|
565497
566549
|
if (!existsSync37(configPath)) {
|
|
565498
566550
|
return { ...DEFAULT_CONFIG5 };
|
|
@@ -565509,7 +566561,7 @@ function loadPermissionsConfig(workingDirectory) {
|
|
|
565509
566561
|
}
|
|
565510
566562
|
}
|
|
565511
566563
|
function savePermissionsConfig(workingDirectory, config3) {
|
|
565512
|
-
|
|
566564
|
+
ensureConfigDirectory7(workingDirectory);
|
|
565513
566565
|
const configPath = getPermissionsFilePath(workingDirectory);
|
|
565514
566566
|
try {
|
|
565515
566567
|
const configData = JSON.stringify(config3, null, 2);
|
|
@@ -565703,9 +566755,7 @@ function useMessageProcessing(props) {
|
|
|
565703
566755
|
setCompressionError(errorMsg);
|
|
565704
566756
|
const errorMessage = {
|
|
565705
566757
|
role: "assistant",
|
|
565706
|
-
content: `**Auto-compression Failed
|
|
565707
|
-
|
|
565708
|
-
${errorMsg}`,
|
|
566758
|
+
content: `**Auto-compression Failed**`,
|
|
565709
566759
|
streaming: false
|
|
565710
566760
|
};
|
|
565711
566761
|
setMessages((prev) => [...prev, errorMessage]);
|
|
@@ -569540,7 +570590,7 @@ var init_reindexCodebase = __esm({
|
|
|
569540
570590
|
function useChatHandlers(props, deps) {
|
|
569541
570591
|
const { stdout } = use_stdout_default();
|
|
569542
570592
|
const { t } = useI18n();
|
|
569543
|
-
const { setMessages, setPendingMessages, streamingState, snapshotState, clearSavedMessages, setRemountKey, pendingUserQuestion, setPendingUserQuestion, userInterruptedRef, initializeFromSession, setShowSessionPanel, setShowReviewCommitPanel, codebaseAgentRef, setCodebaseIndexing, setCodebaseProgress, setFileUpdateNotification, setWatcherEnabled,
|
|
570593
|
+
const { setMessages, setPendingMessages, streamingState, snapshotState, clearSavedMessages, setRemountKey, pendingUserQuestion, setPendingUserQuestion, userInterruptedRef, initializeFromSession, setShowSessionPanel, setShowReviewCommitPanel, codebaseAgentRef, setCodebaseIndexing, setCodebaseProgress, setFileUpdateNotification, setWatcherEnabled, setIsResumingSession } = props;
|
|
569544
570594
|
const { processMessage } = deps;
|
|
569545
570595
|
const handleUserQuestionAnswer = (result2) => {
|
|
569546
570596
|
if (pendingUserQuestion) {
|
|
@@ -569608,36 +570658,7 @@ function useChatHandlers(props, deps) {
|
|
|
569608
570658
|
}
|
|
569609
570659
|
};
|
|
569610
570660
|
const handleQuit = async () => {
|
|
569611
|
-
|
|
569612
|
-
...prev,
|
|
569613
|
-
{
|
|
569614
|
-
role: "command",
|
|
569615
|
-
content: exitingApplicationText
|
|
569616
|
-
}
|
|
569617
|
-
]);
|
|
569618
|
-
const quitTimeout = setTimeout(() => {
|
|
569619
|
-
process.exit(0);
|
|
569620
|
-
}, 3e3);
|
|
569621
|
-
try {
|
|
569622
|
-
if (codebaseAgentRef.current) {
|
|
569623
|
-
const agent = codebaseAgentRef.current;
|
|
569624
|
-
await Promise.race([
|
|
569625
|
-
(async () => {
|
|
569626
|
-
await agent.stop();
|
|
569627
|
-
agent.stopWatching();
|
|
569628
|
-
})(),
|
|
569629
|
-
new Promise((resolve13) => setTimeout(resolve13, 2e3))
|
|
569630
|
-
]);
|
|
569631
|
-
}
|
|
569632
|
-
if (vscodeConnection.isConnected() || vscodeConnection.isClientRunning()) {
|
|
569633
|
-
vscodeConnection.stop();
|
|
569634
|
-
}
|
|
569635
|
-
clearTimeout(quitTimeout);
|
|
569636
|
-
process.exit(0);
|
|
569637
|
-
} catch (error40) {
|
|
569638
|
-
clearTimeout(quitTimeout);
|
|
569639
|
-
process.exit(0);
|
|
569640
|
-
}
|
|
570661
|
+
navigateTo("exit");
|
|
569641
570662
|
};
|
|
569642
570663
|
const handleReindexCodebase = async (force) => {
|
|
569643
570664
|
const workingDirectory = process.cwd();
|
|
@@ -569829,8 +570850,8 @@ var init_useChatHandlers = __esm({
|
|
|
569829
570850
|
init_sessionManager();
|
|
569830
570851
|
init_hashBasedSnapshot();
|
|
569831
570852
|
init_sessionConverter();
|
|
569832
|
-
init_vscodeConnection();
|
|
569833
570853
|
init_reindexCodebase();
|
|
570854
|
+
init_useGlobalNavigation();
|
|
569834
570855
|
}
|
|
569835
570856
|
});
|
|
569836
570857
|
|
|
@@ -570007,15 +571028,24 @@ function useRemoteEvents(props, handlers) {
|
|
|
570007
571028
|
try {
|
|
570008
571029
|
await connectionManager.notifyCompactStarted();
|
|
570009
571030
|
const currentSession = sessionManager.getCurrentSession();
|
|
570010
|
-
|
|
570011
|
-
throw new Error("No active session to compress");
|
|
570012
|
-
}
|
|
570013
|
-
const compressionResult = await executeContextCompression(currentSession.id, (status) => {
|
|
571031
|
+
const compressionResult = await performAutoCompression(currentSession == null ? void 0 : currentSession.id, (status) => {
|
|
570014
571032
|
var _a21;
|
|
570015
571033
|
(_a21 = props.onCompressionStatus) == null ? void 0 : _a21.call(props, status);
|
|
570016
571034
|
});
|
|
571035
|
+
if (compressionResult && compressionResult.hookFailed) {
|
|
571036
|
+
setCompressionError("Blocked by beforeCompress hook");
|
|
571037
|
+
await connectionManager.notifyCompactCompleted({
|
|
571038
|
+
success: false,
|
|
571039
|
+
error: "Blocked by beforeCompress hook"
|
|
571040
|
+
});
|
|
571041
|
+
return;
|
|
571042
|
+
}
|
|
570017
571043
|
if (!compressionResult) {
|
|
570018
|
-
|
|
571044
|
+
await connectionManager.notifyCompactCompleted({
|
|
571045
|
+
success: false,
|
|
571046
|
+
error: "Compression failed after retries"
|
|
571047
|
+
});
|
|
571048
|
+
return;
|
|
570019
571049
|
}
|
|
570020
571050
|
(_a20 = props.onCompressionStatus) == null ? void 0 : _a20.call(props, null);
|
|
570021
571051
|
clearSavedMessages();
|
|
@@ -570032,6 +571062,10 @@ function useRemoteEvents(props, handlers) {
|
|
|
570032
571062
|
message: errorMsg
|
|
570033
571063
|
});
|
|
570034
571064
|
setCompressionError(errorMsg);
|
|
571065
|
+
setTimeout(() => {
|
|
571066
|
+
var _a21;
|
|
571067
|
+
(_a21 = props.onCompressionStatus) == null ? void 0 : _a21.call(props, null);
|
|
571068
|
+
}, 5e3);
|
|
570035
571069
|
await connectionManager.notifyCompactCompleted({
|
|
570036
571070
|
success: false,
|
|
570037
571071
|
error: errorMsg
|
|
@@ -570059,13 +571093,13 @@ var init_useRemoteEvents = __esm({
|
|
|
570059
571093
|
import_react129 = __toESM(require_react(), 1);
|
|
570060
571094
|
init_ConnectionManager();
|
|
570061
571095
|
init_sessionManager();
|
|
570062
|
-
await
|
|
571096
|
+
await init_autoCompress();
|
|
570063
571097
|
}
|
|
570064
571098
|
});
|
|
570065
571099
|
|
|
570066
571100
|
// dist/hooks/conversation/useChatLogic.js
|
|
570067
571101
|
function useChatLogic(props) {
|
|
570068
|
-
const { pendingMessages, streamingState, setMessages, setPendingMessages, setRestoreInputContent, userInterruptedRef, vscodeState, commandsLoaded, terminalExecutionState, backgroundProcesses, schedulerExecutionState, hasFocus } = props;
|
|
571102
|
+
const { pendingMessages, streamingState, setMessages, setPendingMessages, setRestoreInputContent, userInterruptedRef, isCompressing, vscodeState, commandsLoaded, terminalExecutionState, backgroundProcesses, schedulerExecutionState, hasFocus } = props;
|
|
570069
571103
|
const { t } = useI18n();
|
|
570070
571104
|
const { handleMessageSubmit, processMessage, processMessageRef, processPendingMessages } = useMessageProcessing(props);
|
|
570071
571105
|
const { handleHistorySelect, handleRollbackConfirm, rollbackViaSSE } = useRollback(props);
|
|
@@ -570183,6 +571217,10 @@ function useChatLogic(props) {
|
|
|
570183
571217
|
streamingState.setCompressBlockToast(t.chatScreen.compressionBlockToast);
|
|
570184
571218
|
return true;
|
|
570185
571219
|
}
|
|
571220
|
+
if (isCompressing) {
|
|
571221
|
+
streamingState.setCompressBlockToast(t.chatScreen.compressionBlockToast);
|
|
571222
|
+
return true;
|
|
571223
|
+
}
|
|
570186
571224
|
if (schedulerExecutionState == null ? void 0 : schedulerExecutionState.state.isRunning) {
|
|
570187
571225
|
schedulerExecutionState.resetTask();
|
|
570188
571226
|
if (streamingState.isStreaming && streamingState.abortController) {
|
|
@@ -570225,6 +571263,7 @@ function useChatLogic(props) {
|
|
|
570225
571263
|
backgroundProcesses,
|
|
570226
571264
|
terminalExecutionState,
|
|
570227
571265
|
streamingState,
|
|
571266
|
+
isCompressing,
|
|
570228
571267
|
hasFocus,
|
|
570229
571268
|
pendingMessages,
|
|
570230
571269
|
handleInterrupt,
|
|
@@ -571864,7 +572903,7 @@ Output: ${combinedOutput}`);
|
|
|
571864
572903
|
)
|
|
571865
572904
|
);
|
|
571866
572905
|
}
|
|
571867
|
-
function
|
|
572906
|
+
function truncateText4(text2, maxWidth = 80) {
|
|
571868
572907
|
const normalized2 = text2.trim().replace(/\\t/g, " ");
|
|
571869
572908
|
if (normalized2.length <= maxWidth) {
|
|
571870
572909
|
return normalized2;
|
|
@@ -571964,7 +573003,7 @@ function BashCommandExecutionStatus({ command, timeout: timeout2 = 3e4, terminal
|
|
|
571964
573003
|
{ paddingLeft: 2 },
|
|
571965
573004
|
import_react140.default.createElement(Text, { dimColor: true, wrap: "truncate" }, displayCommand)
|
|
571966
573005
|
),
|
|
571967
|
-
import_react140.default.createElement(Box_default, { flexDirection: "column", paddingLeft: 2, marginTop: 1, height: maxOutputLines2 }, processedOutput.map((line, index) => import_react140.default.createElement(Text, { key: index, wrap: "truncate", dimColor: true },
|
|
573006
|
+
import_react140.default.createElement(Box_default, { flexDirection: "column", paddingLeft: 2, marginTop: 1, height: maxOutputLines2 }, processedOutput.map((line, index) => import_react140.default.createElement(Text, { key: index, wrap: "truncate", dimColor: true }, truncateText4(line, maxCommandWidth)))),
|
|
571968
573007
|
needsInput && import_react140.default.createElement(
|
|
571969
573008
|
Box_default,
|
|
571970
573009
|
{ flexDirection: "column", marginTop: 1, paddingLeft: 2 },
|
|
@@ -572036,7 +573075,7 @@ var init_BashCommandConfirmation = __esm({
|
|
|
572036
573075
|
function sanitizePreviewLine2(text2) {
|
|
572037
573076
|
return text2.replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, "").replace(/\t/g, " ").replace(/[\s\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+$/g, "").trim();
|
|
572038
573077
|
}
|
|
572039
|
-
function
|
|
573078
|
+
function truncateText5(text2, maxWidth = 80) {
|
|
572040
573079
|
const normalized2 = text2.trim().replace(/\\t/g, " ");
|
|
572041
573080
|
if (normalized2.length <= maxWidth) {
|
|
572042
573081
|
return normalized2;
|
|
@@ -572135,7 +573174,7 @@ function CustomCommandExecutionDisplay({ command, commandName, isRunning, output
|
|
|
572135
573174
|
)
|
|
572136
573175
|
)
|
|
572137
573176
|
),
|
|
572138
|
-
import_react141.default.createElement(Box_default, { flexDirection: "column", paddingLeft: 2, height: maxOutputLines }, processedOutput.map((line, index) => import_react141.default.createElement(Text, { key: index, wrap: "truncate", dimColor: true },
|
|
573177
|
+
import_react141.default.createElement(Box_default, { flexDirection: "column", paddingLeft: 2, height: maxOutputLines }, processedOutput.map((line, index) => import_react141.default.createElement(Text, { key: index, wrap: "truncate", dimColor: true }, truncateText5(line, 100)))),
|
|
572139
573178
|
error40 && import_react141.default.createElement(
|
|
572140
573179
|
Box_default,
|
|
572141
573180
|
{ paddingLeft: 2 },
|
|
@@ -572376,17 +573415,20 @@ function CompressionStatus({ status, terminalWidth }) {
|
|
|
572376
573415
|
if (!status) {
|
|
572377
573416
|
return null;
|
|
572378
573417
|
}
|
|
572379
|
-
const { step, message, sessionId } = status;
|
|
573418
|
+
const { step, message, sessionId, retryAttempt, maxRetries } = status;
|
|
572380
573419
|
const isActive = step === "saving" || step === "loading" || step === "compressing";
|
|
573420
|
+
const isRetrying = step === "retrying";
|
|
572381
573421
|
const isCompleted = step === "completed";
|
|
572382
573422
|
const isFailed = step === "failed" || step === "skipped";
|
|
572383
573423
|
const stepInfo = stepIcons[step];
|
|
572384
|
-
const label = stepLabels[step];
|
|
573424
|
+
const label = isRetrying && retryAttempt && maxRetries ? `Retrying compression (${retryAttempt}/${maxRetries})` : stepLabels[step];
|
|
572385
573425
|
const getColor = () => {
|
|
572386
573426
|
if (isFailed)
|
|
572387
573427
|
return theme14.colors.error;
|
|
572388
573428
|
if (isCompleted)
|
|
572389
573429
|
return theme14.colors.success;
|
|
573430
|
+
if (isRetrying)
|
|
573431
|
+
return theme14.colors.warning;
|
|
572390
573432
|
return theme14.colors.menuInfo;
|
|
572391
573433
|
};
|
|
572392
573434
|
const color = getColor();
|
|
@@ -572396,7 +573438,7 @@ function CompressionStatus({ status, terminalWidth }) {
|
|
|
572396
573438
|
import_react144.default.createElement(
|
|
572397
573439
|
Box_default,
|
|
572398
573440
|
null,
|
|
572399
|
-
import_react144.default.createElement(Text, { bold: true, color }, isActive ? import_react144.default.createElement(
|
|
573441
|
+
import_react144.default.createElement(Text, { bold: true, color }, isActive || isRetrying ? import_react144.default.createElement(
|
|
572400
573442
|
import_react144.default.Fragment,
|
|
572401
573443
|
null,
|
|
572402
573444
|
import_react144.default.createElement(build_default, { type: "dots" }),
|
|
@@ -572412,14 +573454,14 @@ function CompressionStatus({ status, terminalWidth }) {
|
|
|
572412
573454
|
),
|
|
572413
573455
|
sessionId && import_react144.default.createElement(
|
|
572414
573456
|
Box_default,
|
|
572415
|
-
{ paddingLeft: 2, marginTop: isActive ? 0 : 1 },
|
|
573457
|
+
{ paddingLeft: 2, marginTop: isActive || isRetrying ? 0 : 1 },
|
|
572416
573458
|
import_react144.default.createElement(Text, { dimColor: true }, "Session: "),
|
|
572417
573459
|
import_react144.default.createElement(Text, { color: theme14.colors.menuSecondary }, sessionId)
|
|
572418
573460
|
),
|
|
572419
573461
|
message && import_react144.default.createElement(
|
|
572420
573462
|
Box_default,
|
|
572421
573463
|
{ paddingLeft: 2, marginTop: 1 },
|
|
572422
|
-
import_react144.default.createElement(Text, { dimColor:
|
|
573464
|
+
import_react144.default.createElement(Text, { dimColor: !isRetrying, color: isRetrying ? theme14.colors.warning : void 0, wrap: "truncate" }, message)
|
|
572423
573465
|
),
|
|
572424
573466
|
isActive && import_react144.default.createElement(
|
|
572425
573467
|
Box_default,
|
|
@@ -572446,6 +573488,7 @@ var init_CompressionStatus = __esm({
|
|
|
572446
573488
|
saving: { icon: "\u25C9", color: "yellow" },
|
|
572447
573489
|
loading: { icon: "\u25C9", color: "cyan" },
|
|
572448
573490
|
compressing: { icon: "\u25C9", color: "blue" },
|
|
573491
|
+
retrying: { icon: "\u27F3", color: "yellow" },
|
|
572449
573492
|
completed: { icon: "\u2713", color: "green" },
|
|
572450
573493
|
failed: { icon: "\u2717", color: "red" },
|
|
572451
573494
|
skipped: { icon: "\u25CB", color: "gray" }
|
|
@@ -572454,6 +573497,7 @@ var init_CompressionStatus = __esm({
|
|
|
572454
573497
|
saving: "Saving session",
|
|
572455
573498
|
loading: "Loading session",
|
|
572456
573499
|
compressing: "Compressing context",
|
|
573500
|
+
retrying: "Retrying compression",
|
|
572457
573501
|
completed: "Compression complete",
|
|
572458
573502
|
failed: "Compression failed",
|
|
572459
573503
|
skipped: "Compression skipped"
|
|
@@ -574988,6 +576032,7 @@ var init_ModelsPanel = __esm({
|
|
|
574988
576032
|
const [manualInputMode, setManualInputMode] = (0, import_react154.useState)(false);
|
|
574989
576033
|
const [manualInputValue, setManualInputValue] = (0, import_react154.useState)("");
|
|
574990
576034
|
const [hasStartedLoading, setHasStartedLoading] = (0, import_react154.useState)(false);
|
|
576035
|
+
const [highlightedModelIndex, setHighlightedModelIndex] = (0, import_react154.useState)(0);
|
|
574991
576036
|
const isSelectingRef = (0, import_react154.useRef)(false);
|
|
574992
576037
|
const manualInputModeRef = (0, import_react154.useRef)(false);
|
|
574993
576038
|
const [requestMethod, setRequestMethod] = (0, import_react154.useState)("chat");
|
|
@@ -575026,6 +576071,7 @@ var init_ModelsPanel = __esm({
|
|
|
575026
576071
|
manualInputModeRef.current = false;
|
|
575027
576072
|
setManualInputValue("");
|
|
575028
576073
|
setHasStartedLoading(false);
|
|
576074
|
+
setHighlightedModelIndex(0);
|
|
575029
576075
|
setThinkingFocusIndex(0);
|
|
575030
576076
|
setThinkingInputMode(null);
|
|
575031
576077
|
setThinkingInputValue("");
|
|
@@ -575092,13 +576138,22 @@ var init_ModelsPanel = __esm({
|
|
|
575092
576138
|
}
|
|
575093
576139
|
}, []);
|
|
575094
576140
|
const filteredModels = (0, import_react154.useMemo)(() => filterModels(models, searchTerm), [models, searchTerm]);
|
|
575095
|
-
const currentOptions = (0, import_react154.useMemo)(() =>
|
|
575096
|
-
|
|
575097
|
-
|
|
575098
|
-
|
|
575099
|
-
|
|
575100
|
-
|
|
575101
|
-
|
|
576141
|
+
const currentOptions = (0, import_react154.useMemo)(() => {
|
|
576142
|
+
const seen = /* @__PURE__ */ new Set();
|
|
576143
|
+
const uniqueModels = filteredModels.filter((model) => {
|
|
576144
|
+
if (seen.has(model.id))
|
|
576145
|
+
return false;
|
|
576146
|
+
seen.add(model.id);
|
|
576147
|
+
return true;
|
|
576148
|
+
});
|
|
576149
|
+
return [
|
|
576150
|
+
{ label: t.modelsPanel.manualInputOption, value: "__MANUAL_INPUT__" },
|
|
576151
|
+
...uniqueModels.map((model) => ({
|
|
576152
|
+
label: model.id,
|
|
576153
|
+
value: model.id
|
|
576154
|
+
}))
|
|
576155
|
+
];
|
|
576156
|
+
}, [filteredModels, t]);
|
|
575102
576157
|
const handleModelSelect = (0, import_react154.useCallback)((value) => {
|
|
575103
576158
|
if (value === "__MANUAL_INPUT__") {
|
|
575104
576159
|
isSelectingRef.current = false;
|
|
@@ -575795,14 +576850,34 @@ var init_ModelsPanel = __esm({
|
|
|
575795
576850
|
) : isSelecting ? import_react154.default.createElement(
|
|
575796
576851
|
Box_default,
|
|
575797
576852
|
{ flexDirection: "column", paddingX: 1, paddingY: 0 },
|
|
575798
|
-
|
|
575799
|
-
|
|
575800
|
-
|
|
575801
|
-
|
|
575802
|
-
|
|
575803
|
-
|
|
576853
|
+
import_react154.default.createElement(
|
|
576854
|
+
Box_default,
|
|
576855
|
+
null,
|
|
576856
|
+
searchTerm && import_react154.default.createElement(
|
|
576857
|
+
Text,
|
|
576858
|
+
{ color: theme14.colors.menuInfo },
|
|
576859
|
+
t.modelsPanel.filterLabel,
|
|
576860
|
+
" ",
|
|
576861
|
+
searchTerm,
|
|
576862
|
+
" "
|
|
576863
|
+
),
|
|
576864
|
+
import_react154.default.createElement(
|
|
576865
|
+
Text,
|
|
576866
|
+
{ color: theme14.colors.warning, bold: true },
|
|
576867
|
+
t.modelsPanel.modelCount.replace("{count}", (currentOptions.length - 1).toString()),
|
|
576868
|
+
currentOptions.length > 10 && ` (${highlightedModelIndex + 1}/${currentOptions.length})`
|
|
576869
|
+
)
|
|
575804
576870
|
),
|
|
575805
|
-
import_react154.default.createElement(ScrollableSelectInput, { items: currentOptions, limit: 10, disableNumberShortcuts: true, initialIndex: selectedIndex, isFocused: isSelecting, onSelect: (item) => handleModelSelect(item.value)
|
|
576871
|
+
import_react154.default.createElement(ScrollableSelectInput, { items: currentOptions, limit: 10, disableNumberShortcuts: true, initialIndex: selectedIndex, isFocused: isSelecting, onSelect: (item) => handleModelSelect(item.value), onHighlight: (item) => {
|
|
576872
|
+
const idx = currentOptions.findIndex((o) => o.value === item.value);
|
|
576873
|
+
if (idx >= 0)
|
|
576874
|
+
setHighlightedModelIndex(idx);
|
|
576875
|
+
} }),
|
|
576876
|
+
currentOptions.length > 10 && import_react154.default.createElement(
|
|
576877
|
+
Box_default,
|
|
576878
|
+
null,
|
|
576879
|
+
import_react154.default.createElement(Text, { dimColor: true, color: theme14.colors.menuSecondary }, t.modelsPanel.scrollHint)
|
|
576880
|
+
)
|
|
575806
576881
|
) : import_react154.default.createElement(
|
|
575807
576882
|
Box_default,
|
|
575808
576883
|
{ flexDirection: "column", paddingX: 1, paddingY: 0 },
|
|
@@ -579452,6 +580527,8 @@ var init_PanelsManager = __esm({
|
|
|
579452
580527
|
// dist/ui/components/tools/FileRollbackConfirmation.js
|
|
579453
580528
|
function FileRollbackConfirmation({ fileCount, filePaths, notebookCount, teamCount, previewSessionId, previewTargetMessageIndex, terminalWidth, onConfirm }) {
|
|
579454
580529
|
const { t } = useI18n();
|
|
580530
|
+
const { theme: theme14 } = useTheme();
|
|
580531
|
+
const colors = theme14.colors;
|
|
579455
580532
|
const [selectedIndex, setSelectedIndex] = (0, import_react164.useState)(0);
|
|
579456
580533
|
const [showFullList, setShowFullList] = (0, import_react164.useState)(false);
|
|
579457
580534
|
const [fileScrollIndex, setFileScrollIndex] = (0, import_react164.useState)(0);
|
|
@@ -579611,131 +580688,135 @@ function FileRollbackConfirmation({ fileCount, filePaths, notebookCount, teamCou
|
|
|
579611
580688
|
const hasFiles = fileCount > 0;
|
|
579612
580689
|
return import_react164.default.createElement(
|
|
579613
580690
|
Box_default,
|
|
579614
|
-
{ flexDirection: "column", marginX: 1, marginBottom: 1
|
|
580691
|
+
{ flexDirection: "column", marginX: 1, marginBottom: 1 },
|
|
579615
580692
|
import_react164.default.createElement(
|
|
579616
580693
|
Box_default,
|
|
579617
580694
|
{ height: 1 },
|
|
579618
|
-
import_react164.default.createElement(Text, { color:
|
|
580695
|
+
import_react164.default.createElement(Text, { color: colors.menuSecondary, dimColor: true }, "\u2500".repeat(terminalWidth - 2))
|
|
579619
580696
|
),
|
|
579620
580697
|
import_react164.default.createElement(
|
|
579621
580698
|
Box_default,
|
|
579622
|
-
{
|
|
579623
|
-
import_react164.default.createElement(
|
|
579624
|
-
Text,
|
|
579625
|
-
{ color: "yellow", bold: true },
|
|
579626
|
-
"\u26A0 ",
|
|
579627
|
-
t.fileRollback.title
|
|
579628
|
-
)
|
|
579629
|
-
),
|
|
579630
|
-
!hasFiles && import_react164.default.createElement(
|
|
579631
|
-
import_react164.default.Fragment,
|
|
579632
|
-
null,
|
|
579633
|
-
import_react164.default.createElement(
|
|
579634
|
-
Box_default,
|
|
579635
|
-
{ marginBottom: 1 },
|
|
579636
|
-
import_react164.default.createElement(Text, { color: "white" }, t.fileRollback.noFilesConfirm)
|
|
579637
|
-
),
|
|
579638
|
-
import_react164.default.createElement(
|
|
579639
|
-
Box_default,
|
|
579640
|
-
{ marginTop: 1 },
|
|
579641
|
-
import_react164.default.createElement(Text, { color: "gray", dimColor: true }, t.fileRollback.noFilesConfirmHint)
|
|
579642
|
-
)
|
|
579643
|
-
),
|
|
579644
|
-
hasFiles && import_react164.default.createElement(
|
|
579645
|
-
import_react164.default.Fragment,
|
|
579646
|
-
null,
|
|
580699
|
+
{ flexDirection: "column", paddingX: 1 },
|
|
579647
580700
|
import_react164.default.createElement(
|
|
579648
580701
|
Box_default,
|
|
579649
580702
|
{ marginBottom: 1 },
|
|
579650
580703
|
import_react164.default.createElement(
|
|
579651
580704
|
Text,
|
|
579652
|
-
{ color: "
|
|
579653
|
-
|
|
579654
|
-
|
|
580705
|
+
{ color: "yellow", bold: true },
|
|
580706
|
+
"\u26A0 ",
|
|
580707
|
+
t.fileRollback.title
|
|
579655
580708
|
)
|
|
579656
580709
|
),
|
|
579657
|
-
import_react164.default.createElement(
|
|
579658
|
-
|
|
579659
|
-
|
|
579660
|
-
|
|
579661
|
-
|
|
579662
|
-
{
|
|
579663
|
-
|
|
579664
|
-
" ",
|
|
579665
|
-
t.fileRollback.moreAbove
|
|
579666
|
-
),
|
|
579667
|
-
displayFiles.map((file2, index) => {
|
|
579668
|
-
const actualIndex = showFullList ? fileScrollIndex + index : index;
|
|
579669
|
-
const isSelected = selectedFiles.has(file2);
|
|
579670
|
-
const isHighlighted = showFullList && actualIndex === highlightedFileIndex;
|
|
579671
|
-
return import_react164.default.createElement(
|
|
579672
|
-
Box_default,
|
|
579673
|
-
{ key: index },
|
|
579674
|
-
import_react164.default.createElement(
|
|
579675
|
-
Text,
|
|
579676
|
-
{ color: isHighlighted ? "green" : isSelected ? "cyan" : "gray", dimColor: !isHighlighted && !isSelected, bold: isHighlighted },
|
|
579677
|
-
showFullList ? isSelected ? "[x] " : "[ ] " : "\u2022 ",
|
|
579678
|
-
file2
|
|
579679
|
-
)
|
|
579680
|
-
);
|
|
579681
|
-
}),
|
|
579682
|
-
hasMoreBelow && import_react164.default.createElement(
|
|
579683
|
-
Text,
|
|
579684
|
-
{ color: "gray", dimColor: true },
|
|
579685
|
-
filePaths.length - (fileScrollIndex + maxFilesToShowFull),
|
|
579686
|
-
" ",
|
|
579687
|
-
t.fileRollback.moreBelow
|
|
580710
|
+
!hasFiles && import_react164.default.createElement(
|
|
580711
|
+
import_react164.default.Fragment,
|
|
580712
|
+
null,
|
|
580713
|
+
import_react164.default.createElement(
|
|
580714
|
+
Box_default,
|
|
580715
|
+
{ marginBottom: 1 },
|
|
580716
|
+
import_react164.default.createElement(Text, { color: "white" }, t.fileRollback.noFilesConfirm)
|
|
579688
580717
|
),
|
|
579689
|
-
!showFullList && remainingCountCompact > 0 && import_react164.default.createElement(
|
|
579690
|
-
Text,
|
|
579691
|
-
{ color: "gray", dimColor: true },
|
|
579692
|
-
"... ",
|
|
579693
|
-
t.fileRollback.andMoreFiles,
|
|
579694
|
-
" ",
|
|
579695
|
-
remainingCountCompact,
|
|
579696
|
-
" more file",
|
|
579697
|
-
remainingCountCompact > 1 ? "s" : ""
|
|
579698
|
-
)
|
|
579699
|
-
),
|
|
579700
|
-
notebookCount !== void 0 && notebookCount > 0 && import_react164.default.createElement(
|
|
579701
|
-
Box_default,
|
|
579702
|
-
{ marginBottom: 1, marginLeft: 2 },
|
|
579703
|
-
import_react164.default.createElement(Text, { color: "magenta" }, t.fileRollback.notebookCount.replace("{count}", String(notebookCount)))
|
|
579704
|
-
),
|
|
579705
|
-
teamCount !== void 0 && teamCount > 0 && import_react164.default.createElement(
|
|
579706
|
-
Box_default,
|
|
579707
|
-
{ marginBottom: 1, marginLeft: 2 },
|
|
579708
580718
|
import_react164.default.createElement(
|
|
579709
|
-
|
|
579710
|
-
{
|
|
579711
|
-
"
|
|
579712
|
-
" ",
|
|
579713
|
-
t.fileRollback.teamCount.replace("{count}", String(teamCount))
|
|
580719
|
+
Box_default,
|
|
580720
|
+
{ marginTop: 1 },
|
|
580721
|
+
import_react164.default.createElement(Text, { color: "gray", dimColor: true }, t.fileRollback.noFilesConfirmHint)
|
|
579714
580722
|
)
|
|
579715
580723
|
),
|
|
579716
|
-
|
|
580724
|
+
hasFiles && import_react164.default.createElement(
|
|
579717
580725
|
import_react164.default.Fragment,
|
|
579718
580726
|
null,
|
|
579719
580727
|
import_react164.default.createElement(
|
|
579720
580728
|
Box_default,
|
|
579721
580729
|
{ marginBottom: 1 },
|
|
579722
|
-
import_react164.default.createElement(
|
|
580730
|
+
import_react164.default.createElement(
|
|
580731
|
+
Text,
|
|
580732
|
+
{ color: "white" },
|
|
580733
|
+
showFullList ? t.fileRollback.filesCountWithSelection.replace("{count}", String(fileCount)).replace("{selected}", String(selectedCount)).replace("{total}", String(fileCount)) : t.fileRollback.filesCount.replace("{count}", String(fileCount)),
|
|
580734
|
+
":"
|
|
580735
|
+
)
|
|
579723
580736
|
),
|
|
579724
|
-
import_react164.default.createElement(
|
|
580737
|
+
import_react164.default.createElement(
|
|
579725
580738
|
Box_default,
|
|
579726
|
-
{
|
|
580739
|
+
{ flexDirection: "column", marginBottom: 1, marginLeft: 2 },
|
|
580740
|
+
hasMoreAbove && import_react164.default.createElement(
|
|
580741
|
+
Text,
|
|
580742
|
+
{ color: "gray", dimColor: true },
|
|
580743
|
+
fileScrollIndex,
|
|
580744
|
+
" ",
|
|
580745
|
+
t.fileRollback.moreAbove
|
|
580746
|
+
),
|
|
580747
|
+
displayFiles.map((file2, index) => {
|
|
580748
|
+
const actualIndex = showFullList ? fileScrollIndex + index : index;
|
|
580749
|
+
const isSelected = selectedFiles.has(file2);
|
|
580750
|
+
const isHighlighted = showFullList && actualIndex === highlightedFileIndex;
|
|
580751
|
+
return import_react164.default.createElement(
|
|
580752
|
+
Box_default,
|
|
580753
|
+
{ key: index },
|
|
580754
|
+
import_react164.default.createElement(
|
|
580755
|
+
Text,
|
|
580756
|
+
{ color: isHighlighted ? "green" : isSelected ? "cyan" : "gray", dimColor: !isHighlighted && !isSelected, bold: isHighlighted },
|
|
580757
|
+
showFullList ? isSelected ? "[x] " : "[ ] " : "\u2022 ",
|
|
580758
|
+
file2
|
|
580759
|
+
)
|
|
580760
|
+
);
|
|
580761
|
+
}),
|
|
580762
|
+
hasMoreBelow && import_react164.default.createElement(
|
|
580763
|
+
Text,
|
|
580764
|
+
{ color: "gray", dimColor: true },
|
|
580765
|
+
filePaths.length - (fileScrollIndex + maxFilesToShowFull),
|
|
580766
|
+
" ",
|
|
580767
|
+
t.fileRollback.moreBelow
|
|
580768
|
+
),
|
|
580769
|
+
!showFullList && remainingCountCompact > 0 && import_react164.default.createElement(
|
|
580770
|
+
Text,
|
|
580771
|
+
{ color: "gray", dimColor: true },
|
|
580772
|
+
"... ",
|
|
580773
|
+
t.fileRollback.andMoreFiles,
|
|
580774
|
+
" ",
|
|
580775
|
+
remainingCountCompact,
|
|
580776
|
+
" more file",
|
|
580777
|
+
remainingCountCompact > 1 ? "s" : ""
|
|
580778
|
+
)
|
|
580779
|
+
),
|
|
580780
|
+
notebookCount !== void 0 && notebookCount > 0 && import_react164.default.createElement(
|
|
580781
|
+
Box_default,
|
|
580782
|
+
{ marginBottom: 1, marginLeft: 2 },
|
|
580783
|
+
import_react164.default.createElement(Text, { color: "magenta" }, t.fileRollback.notebookCount.replace("{count}", String(notebookCount)))
|
|
580784
|
+
),
|
|
580785
|
+
teamCount !== void 0 && teamCount > 0 && import_react164.default.createElement(
|
|
580786
|
+
Box_default,
|
|
580787
|
+
{ marginBottom: 1, marginLeft: 2 },
|
|
579727
580788
|
import_react164.default.createElement(
|
|
579728
580789
|
Text,
|
|
579729
|
-
{ color:
|
|
579730
|
-
|
|
579731
|
-
|
|
580790
|
+
{ color: "cyan" },
|
|
580791
|
+
"\u2691",
|
|
580792
|
+
" ",
|
|
580793
|
+
t.fileRollback.teamCount.replace("{count}", String(teamCount))
|
|
579732
580794
|
)
|
|
579733
|
-
)
|
|
579734
|
-
|
|
579735
|
-
|
|
579736
|
-
|
|
579737
|
-
|
|
579738
|
-
|
|
580795
|
+
),
|
|
580796
|
+
!showFullList && import_react164.default.createElement(
|
|
580797
|
+
import_react164.default.Fragment,
|
|
580798
|
+
null,
|
|
580799
|
+
import_react164.default.createElement(
|
|
580800
|
+
Box_default,
|
|
580801
|
+
{ marginBottom: 1 },
|
|
580802
|
+
import_react164.default.createElement(Text, { color: "gray", dimColor: true }, t.fileRollback.question)
|
|
580803
|
+
),
|
|
580804
|
+
import_react164.default.createElement(Box_default, { flexDirection: "column", marginBottom: 1 }, options3.map((option, index) => import_react164.default.createElement(
|
|
580805
|
+
Box_default,
|
|
580806
|
+
{ key: index },
|
|
580807
|
+
import_react164.default.createElement(
|
|
580808
|
+
Text,
|
|
580809
|
+
{ color: index === selectedIndex ? "green" : "white", bold: index === selectedIndex },
|
|
580810
|
+
index === selectedIndex ? "\u276F " : " ",
|
|
580811
|
+
option.label
|
|
580812
|
+
)
|
|
580813
|
+
)))
|
|
580814
|
+
),
|
|
580815
|
+
import_react164.default.createElement(
|
|
580816
|
+
Box_default,
|
|
580817
|
+
null,
|
|
580818
|
+
import_react164.default.createElement(Text, { color: "gray", dimColor: true }, showFullList ? `${t.fileRollback.navigateHint} \xB7 ${t.fileRollback.toggleHint} \xB7 ${t.fileRollback.confirmHint} \xB7 ${t.fileRollback.backHint}` : `${t.fileRollback.selectHint} \xB7 ${t.fileRollback.viewAllHint} \xB7 ${t.fileRollback.confirmHint} \xB7 ${t.fileRollback.cancelHint}`)
|
|
580819
|
+
)
|
|
579739
580820
|
)
|
|
579740
580821
|
)
|
|
579741
580822
|
);
|
|
@@ -579747,6 +580828,7 @@ var init_FileRollbackConfirmation = __esm({
|
|
|
579747
580828
|
import_react164 = __toESM(require_react(), 1);
|
|
579748
580829
|
await init_build2();
|
|
579749
580830
|
init_I18nContext();
|
|
580831
|
+
init_ThemeContext();
|
|
579750
580832
|
init_vscodeConnection();
|
|
579751
580833
|
init_hashBasedSnapshot();
|
|
579752
580834
|
}
|
|
@@ -581236,6 +582318,7 @@ function ChatScreen({ autoResume, enableYolo, enablePlan }) {
|
|
|
581236
582318
|
isToolAutoApproved,
|
|
581237
582319
|
addMultipleToAlwaysApproved,
|
|
581238
582320
|
setRestoreInputContent,
|
|
582321
|
+
isCompressing,
|
|
581239
582322
|
setIsCompressing,
|
|
581240
582323
|
setCompressionError,
|
|
581241
582324
|
currentContextPercentageRef,
|
|
@@ -582794,15 +583877,88 @@ var init_HelpScreen = __esm({
|
|
|
582794
583877
|
}
|
|
582795
583878
|
});
|
|
582796
583879
|
|
|
583880
|
+
// dist/ui/pages/ExitScreen.js
|
|
583881
|
+
var ExitScreen_exports = {};
|
|
583882
|
+
__export(ExitScreen_exports, {
|
|
583883
|
+
default: () => ExitScreen
|
|
583884
|
+
});
|
|
583885
|
+
function dotLine(width) {
|
|
583886
|
+
const count = Math.max(0, Math.floor(width / 3));
|
|
583887
|
+
return Array.from({ length: count }, () => "\xB7").join(" ");
|
|
583888
|
+
}
|
|
583889
|
+
function ExitScreen({ version: version4 = "1.0.0" }) {
|
|
583890
|
+
const { t } = useI18n();
|
|
583891
|
+
const { theme: theme14 } = useTheme();
|
|
583892
|
+
const { columns: terminalWidth } = useTerminalSize();
|
|
583893
|
+
(0, import_react180.useEffect)(() => {
|
|
583894
|
+
gracefulExit();
|
|
583895
|
+
}, []);
|
|
583896
|
+
const versionText = t.exitScreen.version.replace("{version}", version4);
|
|
583897
|
+
const dotWidth = Math.max(12, Math.min(terminalWidth - 8, 42));
|
|
583898
|
+
const dots = (0, import_react180.useMemo)(() => dotLine(dotWidth), [dotWidth]);
|
|
583899
|
+
const colors = theme14.colors;
|
|
583900
|
+
return import_react180.default.createElement(
|
|
583901
|
+
Box_default,
|
|
583902
|
+
{ flexDirection: "column", alignItems: "center", justifyContent: "center", paddingY: 1, width: terminalWidth },
|
|
583903
|
+
import_react180.default.createElement(
|
|
583904
|
+
Box_default,
|
|
583905
|
+
{ flexDirection: "column", alignItems: "center" },
|
|
583906
|
+
import_react180.default.createElement(Text, { color: colors.border, dimColor: true }, dots),
|
|
583907
|
+
import_react180.default.createElement(
|
|
583908
|
+
Box_default,
|
|
583909
|
+
{ marginTop: 1 },
|
|
583910
|
+
import_react180.default.createElement(
|
|
583911
|
+
Text,
|
|
583912
|
+
null,
|
|
583913
|
+
import_react180.default.createElement(Text, { color: colors.cyan }, "\u2746 "),
|
|
583914
|
+
import_react180.default.createElement(dist_default4, { colors: colors.logoGradient }, "SNOW CLI")
|
|
583915
|
+
)
|
|
583916
|
+
),
|
|
583917
|
+
import_react180.default.createElement(
|
|
583918
|
+
Box_default,
|
|
583919
|
+
{ marginTop: 1 },
|
|
583920
|
+
import_react180.default.createElement(Text, { color: colors.border, dimColor: true }, "\u2500\u2500 "),
|
|
583921
|
+
import_react180.default.createElement(Text, { color: colors.menuInfo, bold: true }, t.exitScreen.title),
|
|
583922
|
+
import_react180.default.createElement(Text, { color: colors.border, dimColor: true }, " \u2500\u2500")
|
|
583923
|
+
),
|
|
583924
|
+
import_react180.default.createElement(
|
|
583925
|
+
Box_default,
|
|
583926
|
+
{ marginTop: 1 },
|
|
583927
|
+
import_react180.default.createElement(Text, { color: colors.text }, t.exitScreen.goodbye)
|
|
583928
|
+
),
|
|
583929
|
+
import_react180.default.createElement(Text, { color: colors.menuSecondary }, t.exitScreen.thankYou),
|
|
583930
|
+
import_react180.default.createElement(
|
|
583931
|
+
Box_default,
|
|
583932
|
+
{ marginTop: 1 },
|
|
583933
|
+
import_react180.default.createElement(Text, { color: colors.border, dimColor: true }, dots)
|
|
583934
|
+
),
|
|
583935
|
+
import_react180.default.createElement(Text, { color: colors.menuSecondary, dimColor: true }, versionText)
|
|
583936
|
+
)
|
|
583937
|
+
);
|
|
583938
|
+
}
|
|
583939
|
+
var import_react180;
|
|
583940
|
+
var init_ExitScreen = __esm({
|
|
583941
|
+
async "dist/ui/pages/ExitScreen.js"() {
|
|
583942
|
+
"use strict";
|
|
583943
|
+
import_react180 = __toESM(require_react(), 1);
|
|
583944
|
+
await init_build2();
|
|
583945
|
+
await init_dist6();
|
|
583946
|
+
init_i18n();
|
|
583947
|
+
init_ThemeContext();
|
|
583948
|
+
init_useTerminalSize();
|
|
583949
|
+
init_processManager();
|
|
583950
|
+
}
|
|
583951
|
+
});
|
|
583952
|
+
|
|
582797
583953
|
// dist/app.js
|
|
582798
583954
|
var app_exports = {};
|
|
582799
583955
|
__export(app_exports, {
|
|
582800
583956
|
default: () => App2
|
|
582801
583957
|
});
|
|
582802
583958
|
function ShowTaskListWrapper() {
|
|
582803
|
-
const [currentView, setCurrentView] = (0,
|
|
582804
|
-
const [chatScreenKey, setChatScreenKey] = (0,
|
|
582805
|
-
const [exitNotification, setExitNotification] = (0,
|
|
583959
|
+
const [currentView, setCurrentView] = (0, import_react181.useState)("tasks");
|
|
583960
|
+
const [chatScreenKey, setChatScreenKey] = (0, import_react181.useState)(0);
|
|
583961
|
+
const [exitNotification, setExitNotification] = (0, import_react181.useState)({
|
|
582806
583962
|
show: false,
|
|
582807
583963
|
message: ""
|
|
582808
583964
|
});
|
|
@@ -582810,47 +583966,62 @@ function ShowTaskListWrapper() {
|
|
|
582810
583966
|
const loadingFallback = null;
|
|
582811
583967
|
useCursorHide();
|
|
582812
583968
|
useGlobalExit(setExitNotification);
|
|
583969
|
+
(0, import_react181.useEffect)(() => {
|
|
583970
|
+
const unsubscribe = onNavigate((event) => {
|
|
583971
|
+
if (event.destination === "exit" || event.destination === "tasks" || event.destination === "chat") {
|
|
583972
|
+
setCurrentView(event.destination);
|
|
583973
|
+
}
|
|
583974
|
+
});
|
|
583975
|
+
return unsubscribe;
|
|
583976
|
+
}, []);
|
|
582813
583977
|
const renderView = () => {
|
|
583978
|
+
if (currentView === "exit") {
|
|
583979
|
+
return import_react181.default.createElement(
|
|
583980
|
+
import_react181.Suspense,
|
|
583981
|
+
{ fallback: loadingFallback },
|
|
583982
|
+
import_react181.default.createElement(ExitScreen2, null)
|
|
583983
|
+
);
|
|
583984
|
+
}
|
|
582814
583985
|
if (currentView === "chat") {
|
|
582815
|
-
return
|
|
582816
|
-
|
|
583986
|
+
return import_react181.default.createElement(
|
|
583987
|
+
import_react181.Suspense,
|
|
582817
583988
|
{ fallback: loadingFallback },
|
|
582818
|
-
|
|
583989
|
+
import_react181.default.createElement(ChatScreen2, { key: chatScreenKey, autoResume: true, enableYolo: false })
|
|
582819
583990
|
);
|
|
582820
583991
|
}
|
|
582821
|
-
return
|
|
582822
|
-
|
|
583992
|
+
return import_react181.default.createElement(
|
|
583993
|
+
import_react181.Suspense,
|
|
582823
583994
|
{ fallback: loadingFallback },
|
|
582824
|
-
|
|
583995
|
+
import_react181.default.createElement(TaskManagerScreen2, { onBack: () => gracefulExit(), onResumeTask: () => {
|
|
582825
583996
|
setCurrentView("chat");
|
|
582826
583997
|
setChatScreenKey((prev) => prev + 1);
|
|
582827
583998
|
} })
|
|
582828
583999
|
);
|
|
582829
584000
|
};
|
|
582830
|
-
return
|
|
584001
|
+
return import_react181.default.createElement(
|
|
582831
584002
|
Box_default,
|
|
582832
584003
|
{ flexDirection: "column", width: terminalWidth },
|
|
582833
584004
|
renderView(),
|
|
582834
|
-
exitNotification.show &&
|
|
584005
|
+
exitNotification.show && currentView !== "exit" && import_react181.default.createElement(
|
|
582835
584006
|
Box_default,
|
|
582836
584007
|
{ paddingX: 1, flexShrink: 0 },
|
|
582837
|
-
|
|
584008
|
+
import_react181.default.createElement(Alert, { variant: "warning" }, exitNotification.message)
|
|
582838
584009
|
)
|
|
582839
584010
|
);
|
|
582840
584011
|
}
|
|
582841
584012
|
function AppContent({ version: version4, skipWelcome, autoResume, enableYolo, enablePlan }) {
|
|
582842
|
-
const [currentView, setCurrentView] = (0,
|
|
582843
|
-
const [chatScreenKey, setChatScreenKey] = (0,
|
|
582844
|
-
const [welcomeMenuIndex, setWelcomeMenuIndex] = (0,
|
|
582845
|
-
const [shouldAutoResume, setShouldAutoResume] = (0,
|
|
582846
|
-
const [exitNotification, setExitNotification] = (0,
|
|
584013
|
+
const [currentView, setCurrentView] = (0, import_react181.useState)(skipWelcome ? "chat" : "welcome");
|
|
584014
|
+
const [chatScreenKey, setChatScreenKey] = (0, import_react181.useState)(0);
|
|
584015
|
+
const [welcomeMenuIndex, setWelcomeMenuIndex] = (0, import_react181.useState)(0);
|
|
584016
|
+
const [shouldAutoResume, setShouldAutoResume] = (0, import_react181.useState)(false);
|
|
584017
|
+
const [exitNotification, setExitNotification] = (0, import_react181.useState)({
|
|
582847
584018
|
show: false,
|
|
582848
584019
|
message: ""
|
|
582849
584020
|
});
|
|
582850
584021
|
const { columns: terminalWidth } = useTerminalSize();
|
|
582851
584022
|
useCursorHide();
|
|
582852
584023
|
useGlobalExit(setExitNotification);
|
|
582853
|
-
(0,
|
|
584024
|
+
(0, import_react181.useEffect)(() => {
|
|
582854
584025
|
const unsubscribe = onNavigate((event) => {
|
|
582855
584026
|
if (event.destination === "welcome" && currentView === "chat") {
|
|
582856
584027
|
setChatScreenKey((prev) => prev + 1);
|
|
@@ -582871,120 +584042,126 @@ function AppContent({ version: version4, skipWelcome, autoResume, enableYolo, en
|
|
|
582871
584042
|
setShouldAutoResume(value === "resume-last");
|
|
582872
584043
|
setCurrentView(value === "resume-last" ? "chat" : value);
|
|
582873
584044
|
} else if (value === "exit") {
|
|
582874
|
-
|
|
584045
|
+
setCurrentView("exit");
|
|
582875
584046
|
}
|
|
582876
584047
|
};
|
|
582877
584048
|
const renderView = () => {
|
|
582878
584049
|
const loadingFallback = null;
|
|
582879
584050
|
switch (currentView) {
|
|
582880
584051
|
case "welcome":
|
|
582881
|
-
return
|
|
582882
|
-
|
|
584052
|
+
return import_react181.default.createElement(
|
|
584053
|
+
import_react181.Suspense,
|
|
582883
584054
|
{ fallback: loadingFallback },
|
|
582884
|
-
|
|
584055
|
+
import_react181.default.createElement(WelcomeScreen2, { version: version4, onMenuSelect: handleMenuSelect, defaultMenuIndex: welcomeMenuIndex, onMenuSelectionPersist: setWelcomeMenuIndex })
|
|
582885
584056
|
);
|
|
582886
584057
|
case "chat":
|
|
582887
|
-
return
|
|
582888
|
-
|
|
584058
|
+
return import_react181.default.createElement(
|
|
584059
|
+
import_react181.Suspense,
|
|
582889
584060
|
{ fallback: loadingFallback },
|
|
582890
|
-
|
|
584061
|
+
import_react181.default.createElement(ChatScreen2, { key: chatScreenKey, autoResume: autoResume || shouldAutoResume, enableYolo, enablePlan })
|
|
582891
584062
|
);
|
|
582892
584063
|
case "settings":
|
|
582893
|
-
return
|
|
584064
|
+
return import_react181.default.createElement(
|
|
582894
584065
|
Box_default,
|
|
582895
584066
|
{ flexDirection: "column" },
|
|
582896
|
-
|
|
582897
|
-
|
|
584067
|
+
import_react181.default.createElement(Text, { color: "blue" }, "Settings"),
|
|
584068
|
+
import_react181.default.createElement(Text, { color: "gray" }, "Settings interface would be implemented here")
|
|
582898
584069
|
);
|
|
582899
584070
|
case "systemprompt":
|
|
582900
|
-
return
|
|
582901
|
-
|
|
584071
|
+
return import_react181.default.createElement(
|
|
584072
|
+
import_react181.Suspense,
|
|
582902
584073
|
{ fallback: loadingFallback },
|
|
582903
|
-
|
|
584074
|
+
import_react181.default.createElement(SystemPromptConfigScreen3, { onBack: () => setCurrentView("welcome") })
|
|
582904
584075
|
);
|
|
582905
584076
|
case "help":
|
|
582906
|
-
return
|
|
582907
|
-
|
|
584077
|
+
return import_react181.default.createElement(
|
|
584078
|
+
import_react181.Suspense,
|
|
582908
584079
|
{ fallback: loadingFallback },
|
|
582909
|
-
|
|
584080
|
+
import_react181.default.createElement(HelpScreen2, { onBackDestination: "chat" })
|
|
582910
584081
|
);
|
|
582911
584082
|
case "customheaders":
|
|
582912
|
-
return
|
|
582913
|
-
|
|
584083
|
+
return import_react181.default.createElement(
|
|
584084
|
+
import_react181.Suspense,
|
|
582914
584085
|
{ fallback: loadingFallback },
|
|
582915
|
-
|
|
584086
|
+
import_react181.default.createElement(CustomHeadersScreen3, { onBack: () => setCurrentView("welcome") })
|
|
582916
584087
|
);
|
|
582917
584088
|
case "tasks":
|
|
582918
|
-
return
|
|
582919
|
-
|
|
584089
|
+
return import_react181.default.createElement(
|
|
584090
|
+
import_react181.Suspense,
|
|
582920
584091
|
{ fallback: loadingFallback },
|
|
582921
|
-
|
|
584092
|
+
import_react181.default.createElement(TaskManagerScreen2, { onBack: () => setCurrentView("chat"), onResumeTask: () => {
|
|
582922
584093
|
setCurrentView("chat");
|
|
582923
584094
|
setChatScreenKey((prev) => prev + 1);
|
|
582924
584095
|
} })
|
|
582925
584096
|
);
|
|
584097
|
+
case "exit":
|
|
584098
|
+
return import_react181.default.createElement(
|
|
584099
|
+
import_react181.Suspense,
|
|
584100
|
+
{ fallback: loadingFallback },
|
|
584101
|
+
import_react181.default.createElement(ExitScreen2, { version: version4 })
|
|
584102
|
+
);
|
|
582926
584103
|
default:
|
|
582927
|
-
return
|
|
582928
|
-
|
|
584104
|
+
return import_react181.default.createElement(
|
|
584105
|
+
import_react181.Suspense,
|
|
582929
584106
|
{ fallback: loadingFallback },
|
|
582930
|
-
|
|
584107
|
+
import_react181.default.createElement(WelcomeScreen2, { version: version4, onMenuSelect: handleMenuSelect, defaultMenuIndex: welcomeMenuIndex, onMenuSelectionPersist: setWelcomeMenuIndex })
|
|
582931
584108
|
);
|
|
582932
584109
|
}
|
|
582933
584110
|
};
|
|
582934
|
-
return
|
|
584111
|
+
return import_react181.default.createElement(
|
|
582935
584112
|
Box_default,
|
|
582936
584113
|
{ flexDirection: "column", width: terminalWidth },
|
|
582937
584114
|
renderView(),
|
|
582938
|
-
exitNotification.show &&
|
|
584115
|
+
exitNotification.show && currentView !== "exit" && import_react181.default.createElement(
|
|
582939
584116
|
Box_default,
|
|
582940
584117
|
{ paddingX: 1, flexShrink: 0 },
|
|
582941
|
-
|
|
584118
|
+
import_react181.default.createElement(Alert, { variant: "warning" }, exitNotification.message)
|
|
582942
584119
|
)
|
|
582943
584120
|
);
|
|
582944
584121
|
}
|
|
582945
584122
|
function App2({ version: version4, skipWelcome, autoResume, headlessPrompt, headlessSessionId, showTaskList, enableYolo, enablePlan }) {
|
|
582946
584123
|
if (headlessPrompt) {
|
|
582947
584124
|
const loadingFallback = null;
|
|
582948
|
-
return
|
|
584125
|
+
return import_react181.default.createElement(
|
|
582949
584126
|
I18nProvider,
|
|
582950
584127
|
null,
|
|
582951
|
-
|
|
584128
|
+
import_react181.default.createElement(
|
|
582952
584129
|
ThemeProvider,
|
|
582953
584130
|
null,
|
|
582954
|
-
|
|
582955
|
-
|
|
584131
|
+
import_react181.default.createElement(
|
|
584132
|
+
import_react181.Suspense,
|
|
582956
584133
|
{ fallback: loadingFallback },
|
|
582957
|
-
|
|
584134
|
+
import_react181.default.createElement(HeadlessModeScreen2, { prompt: headlessPrompt, sessionId: headlessSessionId, onComplete: () => gracefulExit() })
|
|
582958
584135
|
)
|
|
582959
584136
|
)
|
|
582960
584137
|
);
|
|
582961
584138
|
}
|
|
582962
584139
|
if (showTaskList) {
|
|
582963
|
-
return
|
|
584140
|
+
return import_react181.default.createElement(
|
|
582964
584141
|
I18nProvider,
|
|
582965
584142
|
null,
|
|
582966
|
-
|
|
584143
|
+
import_react181.default.createElement(
|
|
582967
584144
|
ThemeProvider,
|
|
582968
584145
|
null,
|
|
582969
|
-
|
|
584146
|
+
import_react181.default.createElement(ShowTaskListWrapper, null)
|
|
582970
584147
|
)
|
|
582971
584148
|
);
|
|
582972
584149
|
}
|
|
582973
|
-
return
|
|
584150
|
+
return import_react181.default.createElement(
|
|
582974
584151
|
I18nProvider,
|
|
582975
584152
|
null,
|
|
582976
|
-
|
|
584153
|
+
import_react181.default.createElement(
|
|
582977
584154
|
ThemeProvider,
|
|
582978
584155
|
null,
|
|
582979
|
-
|
|
584156
|
+
import_react181.default.createElement(AppContent, { version: version4, skipWelcome, autoResume, enableYolo, enablePlan })
|
|
582980
584157
|
)
|
|
582981
584158
|
);
|
|
582982
584159
|
}
|
|
582983
|
-
var
|
|
584160
|
+
var import_react181, WelcomeScreen2, ChatScreen2, HeadlessModeScreen2, TaskManagerScreen2, SystemPromptConfigScreen3, CustomHeadersScreen3, HelpScreen2, ExitScreen2;
|
|
582984
584161
|
var init_app = __esm({
|
|
582985
584162
|
async "dist/app.js"() {
|
|
582986
584163
|
"use strict";
|
|
582987
|
-
|
|
584164
|
+
import_react181 = __toESM(require_react(), 1);
|
|
582988
584165
|
await init_build2();
|
|
582989
584166
|
await init_build4();
|
|
582990
584167
|
await init_useCursorHide();
|
|
@@ -582995,13 +584172,14 @@ var init_app = __esm({
|
|
|
582995
584172
|
init_ThemeContext();
|
|
582996
584173
|
init_processManager();
|
|
582997
584174
|
init_apiConfig();
|
|
582998
|
-
WelcomeScreen2 =
|
|
582999
|
-
ChatScreen2 =
|
|
583000
|
-
HeadlessModeScreen2 =
|
|
583001
|
-
TaskManagerScreen2 =
|
|
583002
|
-
SystemPromptConfigScreen3 =
|
|
583003
|
-
CustomHeadersScreen3 =
|
|
583004
|
-
HelpScreen2 =
|
|
584175
|
+
WelcomeScreen2 = import_react181.default.lazy(() => init_WelcomeScreen().then(() => WelcomeScreen_exports));
|
|
584176
|
+
ChatScreen2 = import_react181.default.lazy(() => init_ChatScreen().then(() => ChatScreen_exports));
|
|
584177
|
+
HeadlessModeScreen2 = import_react181.default.lazy(() => init_HeadlessModeScreen().then(() => HeadlessModeScreen_exports));
|
|
584178
|
+
TaskManagerScreen2 = import_react181.default.lazy(() => init_TaskManagerScreen().then(() => TaskManagerScreen_exports));
|
|
584179
|
+
SystemPromptConfigScreen3 = import_react181.default.lazy(() => init_SystemPromptConfigScreen().then(() => SystemPromptConfigScreen_exports));
|
|
584180
|
+
CustomHeadersScreen3 = import_react181.default.lazy(() => init_CustomHeadersScreen().then(() => CustomHeadersScreen_exports));
|
|
584181
|
+
HelpScreen2 = import_react181.default.lazy(() => init_HelpScreen().then(() => HelpScreen_exports));
|
|
584182
|
+
ExitScreen2 = import_react181.default.lazy(() => init_ExitScreen().then(() => ExitScreen_exports));
|
|
583005
584183
|
}
|
|
583006
584184
|
});
|
|
583007
584185
|
|
|
@@ -584626,17 +585804,17 @@ var SSEServerStatus_exports = {};
|
|
|
584626
585804
|
__export(SSEServerStatus_exports, {
|
|
584627
585805
|
SSEServerStatus: () => SSEServerStatus
|
|
584628
585806
|
});
|
|
584629
|
-
var
|
|
585807
|
+
var import_react182, SSEServerStatus;
|
|
584630
585808
|
var init_SSEServerStatus = __esm({
|
|
584631
585809
|
async "dist/ui/components/sse/SSEServerStatus.js"() {
|
|
584632
585810
|
"use strict";
|
|
584633
|
-
|
|
585811
|
+
import_react182 = __toESM(require_react(), 1);
|
|
584634
585812
|
await init_build2();
|
|
584635
585813
|
init_I18nContext();
|
|
584636
585814
|
SSEServerStatus = ({ port, workingDir, onLogUpdate }) => {
|
|
584637
585815
|
const { t } = useI18n();
|
|
584638
|
-
const [logs, setLogs] = (0,
|
|
584639
|
-
(0,
|
|
585816
|
+
const [logs, setLogs] = (0, import_react182.useState)([]);
|
|
585817
|
+
(0, import_react182.useEffect)(() => {
|
|
584640
585818
|
if (onLogUpdate) {
|
|
584641
585819
|
onLogUpdate((message, level = "info") => {
|
|
584642
585820
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", {
|
|
@@ -584656,89 +585834,89 @@ var init_SSEServerStatus = __esm({
|
|
|
584656
585834
|
return "gray";
|
|
584657
585835
|
}
|
|
584658
585836
|
};
|
|
584659
|
-
return
|
|
585837
|
+
return import_react182.default.createElement(
|
|
584660
585838
|
Box_default,
|
|
584661
585839
|
{ flexDirection: "column" },
|
|
584662
|
-
|
|
585840
|
+
import_react182.default.createElement(
|
|
584663
585841
|
Box_default,
|
|
584664
585842
|
null,
|
|
584665
|
-
|
|
585843
|
+
import_react182.default.createElement(Text, { bold: true, color: "green" }, t.sseServer.started)
|
|
584666
585844
|
),
|
|
584667
|
-
|
|
585845
|
+
import_react182.default.createElement(
|
|
584668
585846
|
Box_default,
|
|
584669
585847
|
null,
|
|
584670
|
-
|
|
585848
|
+
import_react182.default.createElement(
|
|
584671
585849
|
Text,
|
|
584672
585850
|
null,
|
|
584673
585851
|
t.sseServer.port,
|
|
584674
585852
|
": "
|
|
584675
585853
|
),
|
|
584676
|
-
|
|
584677
|
-
workingDir &&
|
|
584678
|
-
|
|
585854
|
+
import_react182.default.createElement(Text, { color: "cyan" }, port),
|
|
585855
|
+
workingDir && import_react182.default.createElement(
|
|
585856
|
+
import_react182.default.Fragment,
|
|
584679
585857
|
null,
|
|
584680
|
-
|
|
585858
|
+
import_react182.default.createElement(
|
|
584681
585859
|
Text,
|
|
584682
585860
|
null,
|
|
584683
585861
|
" | ",
|
|
584684
585862
|
t.sseServer.workingDir,
|
|
584685
585863
|
": "
|
|
584686
585864
|
),
|
|
584687
|
-
|
|
585865
|
+
import_react182.default.createElement(Text, { color: "yellow" }, workingDir)
|
|
584688
585866
|
),
|
|
584689
|
-
|
|
584690
|
-
|
|
585867
|
+
import_react182.default.createElement(Text, null, " | "),
|
|
585868
|
+
import_react182.default.createElement(
|
|
584691
585869
|
Text,
|
|
584692
585870
|
{ color: "green" },
|
|
584693
585871
|
"\u25CF ",
|
|
584694
585872
|
t.sseServer.running
|
|
584695
585873
|
)
|
|
584696
585874
|
),
|
|
584697
|
-
|
|
585875
|
+
import_react182.default.createElement(
|
|
584698
585876
|
Box_default,
|
|
584699
585877
|
{ flexDirection: "column" },
|
|
584700
|
-
|
|
585878
|
+
import_react182.default.createElement(
|
|
584701
585879
|
Text,
|
|
584702
585880
|
{ dimColor: true },
|
|
584703
585881
|
t.sseServer.endpoints,
|
|
584704
585882
|
":"
|
|
584705
585883
|
),
|
|
584706
|
-
|
|
585884
|
+
import_react182.default.createElement(
|
|
584707
585885
|
Text,
|
|
584708
585886
|
{ color: "blue" },
|
|
584709
585887
|
" http://localhost:",
|
|
584710
585888
|
port,
|
|
584711
585889
|
"/events"
|
|
584712
585890
|
),
|
|
584713
|
-
|
|
585891
|
+
import_react182.default.createElement(
|
|
584714
585892
|
Text,
|
|
584715
585893
|
{ color: "blue" },
|
|
584716
585894
|
" POST http://localhost:",
|
|
584717
585895
|
port,
|
|
584718
585896
|
"/message"
|
|
584719
585897
|
),
|
|
584720
|
-
|
|
585898
|
+
import_react182.default.createElement(
|
|
584721
585899
|
Text,
|
|
584722
585900
|
{ color: "blue" },
|
|
584723
585901
|
" POST http://localhost:",
|
|
584724
585902
|
port,
|
|
584725
585903
|
"/session/create"
|
|
584726
585904
|
),
|
|
584727
|
-
|
|
585905
|
+
import_react182.default.createElement(
|
|
584728
585906
|
Text,
|
|
584729
585907
|
{ color: "blue" },
|
|
584730
585908
|
" POST http://localhost:",
|
|
584731
585909
|
port,
|
|
584732
585910
|
"/session/load"
|
|
584733
585911
|
),
|
|
584734
|
-
|
|
585912
|
+
import_react182.default.createElement(
|
|
584735
585913
|
Text,
|
|
584736
585914
|
{ color: "blue" },
|
|
584737
585915
|
" GET http://localhost:",
|
|
584738
585916
|
port,
|
|
584739
585917
|
"/session/list"
|
|
584740
585918
|
),
|
|
584741
|
-
|
|
585919
|
+
import_react182.default.createElement(
|
|
584742
585920
|
Text,
|
|
584743
585921
|
{ color: "blue" },
|
|
584744
585922
|
" ",
|
|
@@ -584746,7 +585924,7 @@ var init_SSEServerStatus = __esm({
|
|
|
584746
585924
|
port,
|
|
584747
585925
|
"/session/rollback-points?sessionId=:sessionId"
|
|
584748
585926
|
),
|
|
584749
|
-
|
|
585927
|
+
import_react182.default.createElement(
|
|
584750
585928
|
Text,
|
|
584751
585929
|
{ color: "blue" },
|
|
584752
585930
|
" ",
|
|
@@ -584754,14 +585932,14 @@ var init_SSEServerStatus = __esm({
|
|
|
584754
585932
|
port,
|
|
584755
585933
|
"/session/:sessionId"
|
|
584756
585934
|
),
|
|
584757
|
-
|
|
585935
|
+
import_react182.default.createElement(
|
|
584758
585936
|
Text,
|
|
584759
585937
|
{ color: "blue" },
|
|
584760
585938
|
" POST http://localhost:",
|
|
584761
585939
|
port,
|
|
584762
585940
|
"/context/compress"
|
|
584763
585941
|
),
|
|
584764
|
-
|
|
585942
|
+
import_react182.default.createElement(
|
|
584765
585943
|
Text,
|
|
584766
585944
|
{ color: "blue" },
|
|
584767
585945
|
" GET http://localhost:",
|
|
@@ -584769,10 +585947,10 @@ var init_SSEServerStatus = __esm({
|
|
|
584769
585947
|
"/health"
|
|
584770
585948
|
)
|
|
584771
585949
|
),
|
|
584772
|
-
|
|
585950
|
+
import_react182.default.createElement(
|
|
584773
585951
|
Box_default,
|
|
584774
585952
|
{ flexDirection: "column" },
|
|
584775
|
-
|
|
585953
|
+
import_react182.default.createElement(
|
|
584776
585954
|
Text,
|
|
584777
585955
|
{ dimColor: true },
|
|
584778
585956
|
t.sseServer.logs,
|
|
@@ -584780,23 +585958,23 @@ var init_SSEServerStatus = __esm({
|
|
|
584780
585958
|
logs.length,
|
|
584781
585959
|
"):"
|
|
584782
585960
|
),
|
|
584783
|
-
|
|
585961
|
+
import_react182.default.createElement(Box_default, { flexDirection: "column" }, logs.map((log, index) => import_react182.default.createElement(
|
|
584784
585962
|
Box_default,
|
|
584785
585963
|
{ key: index },
|
|
584786
|
-
|
|
585964
|
+
import_react182.default.createElement(
|
|
584787
585965
|
Text,
|
|
584788
585966
|
{ dimColor: true },
|
|
584789
585967
|
"[",
|
|
584790
585968
|
log.timestamp,
|
|
584791
585969
|
"] "
|
|
584792
585970
|
),
|
|
584793
|
-
|
|
585971
|
+
import_react182.default.createElement(Text, { color: getLevelColor(log.level) }, log.message)
|
|
584794
585972
|
)))
|
|
584795
585973
|
),
|
|
584796
|
-
|
|
585974
|
+
import_react182.default.createElement(
|
|
584797
585975
|
Box_default,
|
|
584798
585976
|
null,
|
|
584799
|
-
|
|
585977
|
+
import_react182.default.createElement(Text, { dimColor: true }, t.sseServer.stopHint)
|
|
584800
585978
|
)
|
|
584801
585979
|
);
|
|
584802
585980
|
};
|
|
@@ -597918,7 +599096,7 @@ var require_package3 = __commonJS({
|
|
|
597918
599096
|
"package.json"(exports2, module2) {
|
|
597919
599097
|
module2.exports = {
|
|
597920
599098
|
name: "snow-ai",
|
|
597921
|
-
version: "0.7.
|
|
599099
|
+
version: "0.7.8",
|
|
597922
599100
|
description: "Agentic coding in your terminal",
|
|
597923
599101
|
license: "MIT",
|
|
597924
599102
|
bin: {
|
|
@@ -598564,7 +599742,7 @@ var init_acpManager = __esm({
|
|
|
598564
599742
|
});
|
|
598565
599743
|
|
|
598566
599744
|
// dist/cli.js
|
|
598567
|
-
var
|
|
599745
|
+
var import_react183 = __toESM(require_react(), 1);
|
|
598568
599746
|
await init_build2();
|
|
598569
599747
|
init_updateNotice();
|
|
598570
599748
|
await init_build3();
|
|
@@ -599674,10 +600852,10 @@ if (cli.flags.sse) {
|
|
|
599674
600852
|
const { SSEServerStatus: SSEServerStatus2 } = await init_SSEServerStatus().then(() => SSEServerStatus_exports);
|
|
599675
600853
|
const { I18nProvider: I18nProvider2 } = await Promise.resolve().then(() => (init_I18nContext(), I18nContext_exports));
|
|
599676
600854
|
let logUpdater;
|
|
599677
|
-
const { unmount } = render_default(
|
|
600855
|
+
const { unmount } = render_default(import_react183.default.createElement(
|
|
599678
600856
|
I18nProvider2,
|
|
599679
600857
|
null,
|
|
599680
|
-
|
|
600858
|
+
import_react183.default.createElement(SSEServerStatus2, { port, workingDir: workDir || process.cwd(), onLogUpdate: (callback) => {
|
|
599681
600859
|
logUpdater = callback;
|
|
599682
600860
|
} })
|
|
599683
600861
|
));
|
|
@@ -599728,9 +600906,9 @@ if (cli.flags.taskExecute) {
|
|
|
599728
600906
|
process.exit(0);
|
|
599729
600907
|
}
|
|
599730
600908
|
var Startup = ({ version: version4, skipWelcome, autoResume, headlessPrompt, headlessSessionId, showTaskList, isDevMode: isDevMode2, enableYolo, enablePlan }) => {
|
|
599731
|
-
const [appReady, setAppReady] =
|
|
599732
|
-
const [AppComponent, setAppComponent] =
|
|
599733
|
-
|
|
600909
|
+
const [appReady, setAppReady] = import_react183.default.useState(false);
|
|
600910
|
+
const [AppComponent, setAppComponent] = import_react183.default.useState(null);
|
|
600911
|
+
import_react183.default.useEffect(() => {
|
|
599734
600912
|
let mounted = true;
|
|
599735
600913
|
const init = async () => {
|
|
599736
600914
|
const deps = await loadDependencies();
|
|
@@ -599776,22 +600954,22 @@ var Startup = ({ version: version4, skipWelcome, autoResume, headlessPrompt, hea
|
|
|
599776
600954
|
};
|
|
599777
600955
|
}, [version4, isDevMode2]);
|
|
599778
600956
|
if (!appReady || !AppComponent) {
|
|
599779
|
-
return
|
|
600957
|
+
return import_react183.default.createElement(
|
|
599780
600958
|
Box_default,
|
|
599781
600959
|
{ flexDirection: "column" },
|
|
599782
|
-
|
|
600960
|
+
import_react183.default.createElement(
|
|
599783
600961
|
Box_default,
|
|
599784
600962
|
null,
|
|
599785
|
-
|
|
600963
|
+
import_react183.default.createElement(
|
|
599786
600964
|
Text,
|
|
599787
600965
|
{ color: "cyan" },
|
|
599788
|
-
|
|
600966
|
+
import_react183.default.createElement(build_default, { type: "dots" })
|
|
599789
600967
|
),
|
|
599790
|
-
|
|
600968
|
+
import_react183.default.createElement(Text, null, " Loading...")
|
|
599791
600969
|
)
|
|
599792
600970
|
);
|
|
599793
600971
|
}
|
|
599794
|
-
return
|
|
600972
|
+
return import_react183.default.createElement(AppComponent, { version: version4, skipWelcome, autoResume, headlessPrompt, headlessSessionId, showTaskList, enableYolo, enablePlan });
|
|
599795
600973
|
};
|
|
599796
600974
|
process.stdout.write("\x1B[?2004l");
|
|
599797
600975
|
process.stdout.write("\x1B[2K\r");
|
|
@@ -599845,7 +601023,7 @@ process.on("SIGTERM", async () => {
|
|
|
599845
601023
|
await cleanupAsync();
|
|
599846
601024
|
process.exit(0);
|
|
599847
601025
|
});
|
|
599848
|
-
render_default(
|
|
601026
|
+
render_default(import_react183.default.createElement(Startup, { version: VERSION2, skipWelcome: Boolean(cli.flags.c || cli.flags.yolo || cli.flags.yoloP || cli.flags.cYolo), autoResume: Boolean(cli.flags.c || cli.flags.cYolo), headlessPrompt: typeof cli.flags["ask"] === "string" ? cli.flags["ask"] : void 0, headlessSessionId: cli.input[0], showTaskList: cli.flags.taskList, isDevMode: cli.flags.dev, enableYolo: cli.flags.yolo || cli.flags.yoloP || cli.flags.cYolo ? true : void 0, enablePlan: cli.flags.yoloP ? true : void 0 }), {
|
|
599849
601027
|
exitOnCtrlC: false,
|
|
599850
601028
|
patchConsole: true
|
|
599851
601029
|
});
|