snow-ai 0.8.12 → 0.8.13
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 +421 -270
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -509646,6 +509646,222 @@ var init_toolDisplayConfig = __esm({
|
|
|
509646
509646
|
}
|
|
509647
509647
|
});
|
|
509648
509648
|
|
|
509649
|
+
// dist/utils/ui/diffPreview.js
|
|
509650
|
+
import fs38 from "fs";
|
|
509651
|
+
function readOriginalFile(filePath) {
|
|
509652
|
+
try {
|
|
509653
|
+
if (!filePath || !fs38.existsSync(filePath))
|
|
509654
|
+
return null;
|
|
509655
|
+
return fs38.readFileSync(filePath, "utf-8");
|
|
509656
|
+
} catch {
|
|
509657
|
+
return null;
|
|
509658
|
+
}
|
|
509659
|
+
}
|
|
509660
|
+
function computeHashlinePreview(originalContent, operations) {
|
|
509661
|
+
if (!Array.isArray(operations) || operations.length === 0) {
|
|
509662
|
+
return originalContent;
|
|
509663
|
+
}
|
|
509664
|
+
const mutableLines = originalContent.split("\n");
|
|
509665
|
+
const parsed = operations.map((op2) => {
|
|
509666
|
+
const startMatch = String(op2.startAnchor ?? "").match(/^(\d+):/);
|
|
509667
|
+
const endMatch = String(op2.endAnchor ?? "").match(/^(\d+):/);
|
|
509668
|
+
return {
|
|
509669
|
+
type: op2.type,
|
|
509670
|
+
content: op2.content ?? "",
|
|
509671
|
+
startLine: startMatch ? parseInt(startMatch[1], 10) : 0,
|
|
509672
|
+
endLine: endMatch ? parseInt(endMatch[1], 10) : 0
|
|
509673
|
+
};
|
|
509674
|
+
}).filter((op2) => op2.startLine > 0 && op2.endLine > 0).sort((a, b) => b.startLine - a.startLine);
|
|
509675
|
+
for (const op2 of parsed) {
|
|
509676
|
+
const newLines = op2.content.split("\n");
|
|
509677
|
+
switch (op2.type) {
|
|
509678
|
+
case "replace":
|
|
509679
|
+
mutableLines.splice(op2.startLine - 1, op2.endLine - op2.startLine + 1, ...newLines);
|
|
509680
|
+
break;
|
|
509681
|
+
case "insert_after":
|
|
509682
|
+
mutableLines.splice(op2.startLine, 0, ...newLines);
|
|
509683
|
+
break;
|
|
509684
|
+
case "delete":
|
|
509685
|
+
mutableLines.splice(op2.startLine - 1, op2.endLine - op2.startLine + 1);
|
|
509686
|
+
break;
|
|
509687
|
+
}
|
|
509688
|
+
}
|
|
509689
|
+
return mutableLines.join("\n");
|
|
509690
|
+
}
|
|
509691
|
+
function computeReplaceEditPreview(originalContent, searchContent, replaceContent) {
|
|
509692
|
+
const idx = originalContent.indexOf(searchContent);
|
|
509693
|
+
if (idx !== -1) {
|
|
509694
|
+
return originalContent.substring(0, idx) + replaceContent + originalContent.substring(idx + searchContent.length);
|
|
509695
|
+
}
|
|
509696
|
+
return originalContent;
|
|
509697
|
+
}
|
|
509698
|
+
function collectDiffPreviewEntries(toolName, toolArgs) {
|
|
509699
|
+
const entries = [];
|
|
509700
|
+
try {
|
|
509701
|
+
const parsed = JSON.parse(toolArgs);
|
|
509702
|
+
if (typeof parsed.filePath === "string" && parsed.filePath.trimStart().startsWith("[")) {
|
|
509703
|
+
try {
|
|
509704
|
+
parsed.filePath = JSON.parse(parsed.filePath);
|
|
509705
|
+
} catch {
|
|
509706
|
+
}
|
|
509707
|
+
}
|
|
509708
|
+
if (toolName === "filesystem-edit" && parsed.filePath) {
|
|
509709
|
+
if (typeof parsed.filePath === "string") {
|
|
509710
|
+
const originalContent = readOriginalFile(parsed.filePath);
|
|
509711
|
+
if (originalContent !== null) {
|
|
509712
|
+
const newContent = computeHashlinePreview(originalContent, parsed.operations);
|
|
509713
|
+
entries.push({
|
|
509714
|
+
filePath: parsed.filePath,
|
|
509715
|
+
oldContent: originalContent,
|
|
509716
|
+
newContent
|
|
509717
|
+
});
|
|
509718
|
+
}
|
|
509719
|
+
} else if (Array.isArray(parsed.filePath)) {
|
|
509720
|
+
for (const item of parsed.filePath) {
|
|
509721
|
+
if (item && typeof item === "object" && typeof item.path === "string") {
|
|
509722
|
+
const originalContent = readOriginalFile(item.path);
|
|
509723
|
+
if (originalContent !== null) {
|
|
509724
|
+
const newContent = computeHashlinePreview(originalContent, item.operations);
|
|
509725
|
+
entries.push({
|
|
509726
|
+
filePath: item.path,
|
|
509727
|
+
oldContent: originalContent,
|
|
509728
|
+
newContent
|
|
509729
|
+
});
|
|
509730
|
+
}
|
|
509731
|
+
}
|
|
509732
|
+
}
|
|
509733
|
+
}
|
|
509734
|
+
}
|
|
509735
|
+
if (toolName === "filesystem-replaceedit" && parsed.filePath) {
|
|
509736
|
+
if (typeof parsed.filePath === "string") {
|
|
509737
|
+
const originalContent = readOriginalFile(parsed.filePath);
|
|
509738
|
+
if (originalContent !== null) {
|
|
509739
|
+
const newContent = parsed.searchContent && parsed.replaceContent !== void 0 ? computeReplaceEditPreview(originalContent, parsed.searchContent, parsed.replaceContent) : originalContent;
|
|
509740
|
+
entries.push({
|
|
509741
|
+
filePath: parsed.filePath,
|
|
509742
|
+
oldContent: originalContent,
|
|
509743
|
+
newContent
|
|
509744
|
+
});
|
|
509745
|
+
}
|
|
509746
|
+
} else if (Array.isArray(parsed.filePath)) {
|
|
509747
|
+
for (const item of parsed.filePath) {
|
|
509748
|
+
if (typeof item === "string") {
|
|
509749
|
+
const originalContent = readOriginalFile(item);
|
|
509750
|
+
if (originalContent !== null) {
|
|
509751
|
+
const newContent = parsed.searchContent && parsed.replaceContent !== void 0 ? computeReplaceEditPreview(originalContent, parsed.searchContent, parsed.replaceContent) : originalContent;
|
|
509752
|
+
entries.push({
|
|
509753
|
+
filePath: item,
|
|
509754
|
+
oldContent: originalContent,
|
|
509755
|
+
newContent
|
|
509756
|
+
});
|
|
509757
|
+
}
|
|
509758
|
+
} else if (item && typeof item === "object" && typeof item.path === "string") {
|
|
509759
|
+
const originalContent = readOriginalFile(item.path);
|
|
509760
|
+
if (originalContent !== null) {
|
|
509761
|
+
const search = item.searchContent ?? parsed.searchContent;
|
|
509762
|
+
const replace = item.replaceContent ?? parsed.replaceContent;
|
|
509763
|
+
const newContent = search && replace !== void 0 ? computeReplaceEditPreview(originalContent, search, replace) : originalContent;
|
|
509764
|
+
entries.push({
|
|
509765
|
+
filePath: item.path,
|
|
509766
|
+
oldContent: originalContent,
|
|
509767
|
+
newContent
|
|
509768
|
+
});
|
|
509769
|
+
}
|
|
509770
|
+
}
|
|
509771
|
+
}
|
|
509772
|
+
}
|
|
509773
|
+
}
|
|
509774
|
+
if (toolName === "filesystem-create" && parsed.filePath) {
|
|
509775
|
+
if (typeof parsed.filePath === "string" && parsed.content) {
|
|
509776
|
+
const originalContent = readOriginalFile(parsed.filePath) ?? "";
|
|
509777
|
+
entries.push({
|
|
509778
|
+
filePath: parsed.filePath,
|
|
509779
|
+
oldContent: originalContent,
|
|
509780
|
+
newContent: parsed.content
|
|
509781
|
+
});
|
|
509782
|
+
} else if (Array.isArray(parsed.filePath)) {
|
|
509783
|
+
for (const item of parsed.filePath) {
|
|
509784
|
+
if (item && typeof item === "object" && typeof item.path === "string" && typeof item.content === "string") {
|
|
509785
|
+
const originalContent = readOriginalFile(item.path) ?? "";
|
|
509786
|
+
entries.push({
|
|
509787
|
+
filePath: item.path,
|
|
509788
|
+
oldContent: originalContent,
|
|
509789
|
+
newContent: item.content
|
|
509790
|
+
});
|
|
509791
|
+
}
|
|
509792
|
+
}
|
|
509793
|
+
}
|
|
509794
|
+
}
|
|
509795
|
+
} catch {
|
|
509796
|
+
}
|
|
509797
|
+
return entries;
|
|
509798
|
+
}
|
|
509799
|
+
function enrichPendingEditArgs(toolName, toolArgs) {
|
|
509800
|
+
if (toolName !== "filesystem-edit" && toolName !== "filesystem-replaceedit" && toolName !== "filesystem-create") {
|
|
509801
|
+
return toolArgs;
|
|
509802
|
+
}
|
|
509803
|
+
const rawFilePath = toolArgs["filePath"];
|
|
509804
|
+
if (typeof rawFilePath === "string" && rawFilePath.trimStart().startsWith("[")) {
|
|
509805
|
+
try {
|
|
509806
|
+
toolArgs = { ...toolArgs, filePath: JSON.parse(rawFilePath) };
|
|
509807
|
+
} catch {
|
|
509808
|
+
}
|
|
509809
|
+
}
|
|
509810
|
+
const isBatch = toolArgs["isBatch"] || Array.isArray(toolArgs["filePath"]);
|
|
509811
|
+
if (!isBatch) {
|
|
509812
|
+
const entries2 = collectDiffPreviewEntries(toolName, JSON.stringify(toolArgs));
|
|
509813
|
+
if (entries2.length === 1) {
|
|
509814
|
+
const entry = entries2[0];
|
|
509815
|
+
if (toolName === "filesystem-create") {
|
|
509816
|
+
return {
|
|
509817
|
+
...toolArgs,
|
|
509818
|
+
content: entry.newContent,
|
|
509819
|
+
path: entry.filePath
|
|
509820
|
+
};
|
|
509821
|
+
}
|
|
509822
|
+
return {
|
|
509823
|
+
...toolArgs,
|
|
509824
|
+
oldContent: entry.oldContent,
|
|
509825
|
+
newContent: entry.newContent,
|
|
509826
|
+
filename: entry.filePath
|
|
509827
|
+
};
|
|
509828
|
+
}
|
|
509829
|
+
return toolArgs;
|
|
509830
|
+
}
|
|
509831
|
+
const entries = collectDiffPreviewEntries(toolName, JSON.stringify(toolArgs));
|
|
509832
|
+
if (entries.length === 0) {
|
|
509833
|
+
return toolArgs;
|
|
509834
|
+
}
|
|
509835
|
+
if (toolName === "filesystem-create") {
|
|
509836
|
+
const batchResults2 = entries.map((entry) => ({
|
|
509837
|
+
success: true,
|
|
509838
|
+
path: entry.filePath,
|
|
509839
|
+
content: entry.newContent
|
|
509840
|
+
}));
|
|
509841
|
+
return {
|
|
509842
|
+
...toolArgs,
|
|
509843
|
+
isBatch: true,
|
|
509844
|
+
batchResults: batchResults2
|
|
509845
|
+
};
|
|
509846
|
+
}
|
|
509847
|
+
const batchResults = entries.map((entry) => ({
|
|
509848
|
+
success: true,
|
|
509849
|
+
path: entry.filePath,
|
|
509850
|
+
oldContent: entry.oldContent,
|
|
509851
|
+
newContent: entry.newContent
|
|
509852
|
+
}));
|
|
509853
|
+
return {
|
|
509854
|
+
...toolArgs,
|
|
509855
|
+
isBatch: true,
|
|
509856
|
+
batchResults
|
|
509857
|
+
};
|
|
509858
|
+
}
|
|
509859
|
+
var init_diffPreview = __esm({
|
|
509860
|
+
"dist/utils/ui/diffPreview.js"() {
|
|
509861
|
+
"use strict";
|
|
509862
|
+
}
|
|
509863
|
+
});
|
|
509864
|
+
|
|
509649
509865
|
// dist/hooks/conversation/core/subAgentMessageHandler.js
|
|
509650
509866
|
var subAgentMessageHandler_exports = {};
|
|
509651
509867
|
__export(subAgentMessageHandler_exports, {
|
|
@@ -509781,6 +509997,7 @@ var init_subAgentMessageHandler = __esm({
|
|
|
509781
509997
|
"use strict";
|
|
509782
509998
|
init_messageFormatter();
|
|
509783
509999
|
init_toolDisplayConfig();
|
|
510000
|
+
init_diffPreview();
|
|
509784
510001
|
_teammateStreamMap = /* @__PURE__ */ new Map();
|
|
509785
510002
|
_teammateStreamListeners = /* @__PURE__ */ new Set();
|
|
509786
510003
|
_teammateStreamSnapshot = [];
|
|
@@ -510369,6 +510586,7 @@ var init_subAgentMessageHandler = __esm({
|
|
|
510369
510586
|
} catch {
|
|
510370
510587
|
toolArgs = {};
|
|
510371
510588
|
}
|
|
510589
|
+
const enrichedArgs = enrichPendingEditArgs(toolCall.function.name, toolArgs);
|
|
510372
510590
|
let paramDisplay = "";
|
|
510373
510591
|
if (toolCall.function.name === "terminal-execute" && toolArgs.command) {
|
|
510374
510592
|
paramDisplay = ` "${toolArgs.command}"`;
|
|
@@ -510380,7 +510598,7 @@ var init_subAgentMessageHandler = __esm({
|
|
|
510380
510598
|
role: "subagent",
|
|
510381
510599
|
content: `\x1B[38;2;184;122;206m\u2687\u26A1 ${toolDisplay.toolName}${paramDisplay}\x1B[0m`,
|
|
510382
510600
|
streaming: false,
|
|
510383
|
-
toolCall: { name: toolCall.function.name, arguments:
|
|
510601
|
+
toolCall: { name: toolCall.function.name, arguments: enrichedArgs },
|
|
510384
510602
|
toolCallId: toolCall.id,
|
|
510385
510603
|
toolPending: true,
|
|
510386
510604
|
messageStatus: "pending",
|
|
@@ -510621,7 +510839,7 @@ var init_subAgentMessageHandler = __esm({
|
|
|
510621
510839
|
});
|
|
510622
510840
|
|
|
510623
510841
|
// dist/utils/team/teamSnapshot.js
|
|
510624
|
-
import * as
|
|
510842
|
+
import * as fs39 from "fs";
|
|
510625
510843
|
import * as path44 from "path";
|
|
510626
510844
|
import * as os23 from "os";
|
|
510627
510845
|
function getTeamSnapshotDir() {
|
|
@@ -510633,16 +510851,16 @@ function getTeamSnapshotFilePath() {
|
|
|
510633
510851
|
}
|
|
510634
510852
|
function ensureDir5() {
|
|
510635
510853
|
const dir = getTeamSnapshotDir();
|
|
510636
|
-
if (!
|
|
510637
|
-
|
|
510854
|
+
if (!fs39.existsSync(dir)) {
|
|
510855
|
+
fs39.mkdirSync(dir, { recursive: true });
|
|
510638
510856
|
}
|
|
510639
510857
|
}
|
|
510640
510858
|
function readSnapshotData() {
|
|
510641
510859
|
const filePath = getTeamSnapshotFilePath();
|
|
510642
|
-
if (!
|
|
510860
|
+
if (!fs39.existsSync(filePath))
|
|
510643
510861
|
return {};
|
|
510644
510862
|
try {
|
|
510645
|
-
return JSON.parse(
|
|
510863
|
+
return JSON.parse(fs39.readFileSync(filePath, "utf-8"));
|
|
510646
510864
|
} catch {
|
|
510647
510865
|
return {};
|
|
510648
510866
|
}
|
|
@@ -510650,7 +510868,7 @@ function readSnapshotData() {
|
|
|
510650
510868
|
function saveSnapshotData(data) {
|
|
510651
510869
|
ensureDir5();
|
|
510652
510870
|
try {
|
|
510653
|
-
|
|
510871
|
+
fs39.writeFileSync(getTeamSnapshotFilePath(), JSON.stringify(data, null, 2), "utf-8");
|
|
510654
510872
|
} catch (error42) {
|
|
510655
510873
|
console.error("Failed to save team snapshot data:", error42);
|
|
510656
510874
|
}
|
|
@@ -519217,7 +519435,7 @@ var require_node17 = __commonJS({
|
|
|
519217
519435
|
|
|
519218
519436
|
// dist/mcp/lsp/LSPClient.js
|
|
519219
519437
|
import { spawn as spawn9 } from "child_process";
|
|
519220
|
-
import { promises as
|
|
519438
|
+
import { promises as fs40 } from "fs";
|
|
519221
519439
|
import * as path45 from "path";
|
|
519222
519440
|
var import_node, LSPClient;
|
|
519223
519441
|
var init_LSPClient = __esm({
|
|
@@ -519323,7 +519541,7 @@ var init_LSPClient = __esm({
|
|
|
519323
519541
|
return rootPath;
|
|
519324
519542
|
}
|
|
519325
519543
|
try {
|
|
519326
|
-
const entries = await
|
|
519544
|
+
const entries = await fs40.readdir(rootPath, { withFileTypes: true });
|
|
519327
519545
|
const solutions = entries.filter((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".sln")).map((entry) => entry.name).sort((a, b) => a.localeCompare(b));
|
|
519328
519546
|
if (solutions.length === 0)
|
|
519329
519547
|
return null;
|
|
@@ -519905,7 +520123,7 @@ var init_LSPServerRegistry = __esm({
|
|
|
519905
520123
|
});
|
|
519906
520124
|
|
|
519907
520125
|
// dist/mcp/lsp/LSPManager.js
|
|
519908
|
-
import { promises as
|
|
520126
|
+
import { promises as fs41 } from "fs";
|
|
519909
520127
|
import * as path46 from "path";
|
|
519910
520128
|
var LSPManager;
|
|
519911
520129
|
var init_LSPManager = __esm({
|
|
@@ -520112,7 +520330,7 @@ var init_LSPManager = __esm({
|
|
|
520112
520330
|
return this.documentCache.get(fullPath);
|
|
520113
520331
|
}
|
|
520114
520332
|
try {
|
|
520115
|
-
const content = await
|
|
520333
|
+
const content = await fs41.readFile(fullPath, "utf-8");
|
|
520116
520334
|
this.documentCache.set(fullPath, content);
|
|
520117
520335
|
return content;
|
|
520118
520336
|
} catch (error42) {
|
|
@@ -522205,7 +522423,7 @@ __export(roleSubagent_exports, {
|
|
|
522205
522423
|
listRoleSubagents: () => listRoleSubagents,
|
|
522206
522424
|
loadSubAgentCustomRole: () => loadSubAgentCustomRole
|
|
522207
522425
|
});
|
|
522208
|
-
import
|
|
522426
|
+
import fs42 from "fs/promises";
|
|
522209
522427
|
import path49 from "path";
|
|
522210
522428
|
import { homedir as homedir15 } from "os";
|
|
522211
522429
|
import { existsSync as existsSync27, readdirSync as readdirSync5, readFileSync as readFileSync22 } from "fs";
|
|
@@ -522240,8 +522458,8 @@ async function createRoleSubagentFile(agentName, location, projectRoot) {
|
|
|
522240
522458
|
};
|
|
522241
522459
|
}
|
|
522242
522460
|
const dir = path49.dirname(filePath);
|
|
522243
|
-
await
|
|
522244
|
-
await
|
|
522461
|
+
await fs42.mkdir(dir, { recursive: true });
|
|
522462
|
+
await fs42.writeFile(filePath, "", "utf-8");
|
|
522245
522463
|
return { success: true, path: filePath };
|
|
522246
522464
|
} catch (error42) {
|
|
522247
522465
|
return {
|
|
@@ -522261,7 +522479,7 @@ async function deleteRoleSubagentFile(agentName, location, projectRoot) {
|
|
|
522261
522479
|
error: `Role file for "${agentName}" does not exist at this location`
|
|
522262
522480
|
};
|
|
522263
522481
|
}
|
|
522264
|
-
await
|
|
522482
|
+
await fs42.unlink(filePath);
|
|
522265
522483
|
return { success: true, path: filePath };
|
|
522266
522484
|
} catch (error42) {
|
|
522267
522485
|
return {
|
|
@@ -527153,7 +527371,7 @@ var init_stateManager = __esm({
|
|
|
527153
527371
|
});
|
|
527154
527372
|
|
|
527155
527373
|
// dist/utils/connection/instanceLock.js
|
|
527156
|
-
import * as
|
|
527374
|
+
import * as fs43 from "fs";
|
|
527157
527375
|
import * as path50 from "path";
|
|
527158
527376
|
var InstanceLockManager;
|
|
527159
527377
|
var init_instanceLock = __esm({
|
|
@@ -527171,8 +527389,8 @@ var init_instanceLock = __esm({
|
|
|
527171
527389
|
}
|
|
527172
527390
|
// Ensure .snow/locks directory exists
|
|
527173
527391
|
ensureLocksDir() {
|
|
527174
|
-
if (!
|
|
527175
|
-
|
|
527392
|
+
if (!fs43.existsSync(this.locksDir)) {
|
|
527393
|
+
fs43.mkdirSync(this.locksDir, { recursive: true });
|
|
527176
527394
|
}
|
|
527177
527395
|
}
|
|
527178
527396
|
// Get instance lock file path
|
|
@@ -527183,16 +527401,16 @@ var init_instanceLock = __esm({
|
|
|
527183
527401
|
isLocked(instanceId) {
|
|
527184
527402
|
try {
|
|
527185
527403
|
const lockPath = this.getLockPath(instanceId);
|
|
527186
|
-
if (!
|
|
527404
|
+
if (!fs43.existsSync(lockPath)) {
|
|
527187
527405
|
return false;
|
|
527188
527406
|
}
|
|
527189
|
-
const lockContent =
|
|
527407
|
+
const lockContent = fs43.readFileSync(lockPath, "utf-8");
|
|
527190
527408
|
const lockData = JSON.parse(lockContent);
|
|
527191
527409
|
try {
|
|
527192
527410
|
process.kill(lockData.pid, 0);
|
|
527193
527411
|
return true;
|
|
527194
527412
|
} catch {
|
|
527195
|
-
|
|
527413
|
+
fs43.unlinkSync(lockPath);
|
|
527196
527414
|
return false;
|
|
527197
527415
|
}
|
|
527198
527416
|
} catch {
|
|
@@ -527211,7 +527429,7 @@ var init_instanceLock = __esm({
|
|
|
527211
527429
|
pid: process.pid,
|
|
527212
527430
|
timestamp: Date.now()
|
|
527213
527431
|
};
|
|
527214
|
-
|
|
527432
|
+
fs43.writeFileSync(lockPath, JSON.stringify(lockData), "utf-8");
|
|
527215
527433
|
return true;
|
|
527216
527434
|
} catch {
|
|
527217
527435
|
return false;
|
|
@@ -527221,8 +527439,8 @@ var init_instanceLock = __esm({
|
|
|
527221
527439
|
unlock(instanceId) {
|
|
527222
527440
|
try {
|
|
527223
527441
|
const lockPath = this.getLockPath(instanceId);
|
|
527224
|
-
if (
|
|
527225
|
-
|
|
527442
|
+
if (fs43.existsSync(lockPath)) {
|
|
527443
|
+
fs43.unlinkSync(lockPath);
|
|
527226
527444
|
}
|
|
527227
527445
|
} catch {
|
|
527228
527446
|
}
|
|
@@ -527533,7 +527751,7 @@ var init_interactionManager = __esm({
|
|
|
527533
527751
|
});
|
|
527534
527752
|
|
|
527535
527753
|
// dist/utils/connection/projectData.js
|
|
527536
|
-
import * as
|
|
527754
|
+
import * as fs44 from "fs";
|
|
527537
527755
|
import * as path51 from "path";
|
|
527538
527756
|
var ProjectDataManager;
|
|
527539
527757
|
var init_projectData = __esm({
|
|
@@ -527561,7 +527779,7 @@ var init_projectData = __esm({
|
|
|
527561
527779
|
if (result2.length >= maxFiles) {
|
|
527562
527780
|
return;
|
|
527563
527781
|
}
|
|
527564
|
-
const entries = await
|
|
527782
|
+
const entries = await fs44.promises.readdir(dir, { withFileTypes: true });
|
|
527565
527783
|
for (const entry of entries) {
|
|
527566
527784
|
if (result2.length >= maxFiles) {
|
|
527567
527785
|
return;
|
|
@@ -534152,7 +534370,7 @@ var init_esm6 = __esm({
|
|
|
534152
534370
|
|
|
534153
534371
|
// dist/agents/codebaseIndexAgent.js
|
|
534154
534372
|
import path52 from "node:path";
|
|
534155
|
-
import
|
|
534373
|
+
import fs45 from "node:fs";
|
|
534156
534374
|
import crypto5 from "node:crypto";
|
|
534157
534375
|
var import_ignore, CodebaseIndexAgent;
|
|
534158
534376
|
var init_codebaseIndexAgent = __esm({
|
|
@@ -534261,7 +534479,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
534261
534479
|
return;
|
|
534262
534480
|
}
|
|
534263
534481
|
const gitignorePath = path52.join(this.projectRoot, ".gitignore");
|
|
534264
|
-
if (!
|
|
534482
|
+
if (!fs45.existsSync(gitignorePath)) {
|
|
534265
534483
|
const { getCurrentLanguage: getCurrentLanguage2 } = await Promise.resolve().then(() => (init_languageConfig(), languageConfig_exports));
|
|
534266
534484
|
const { translations: translations2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
534267
534485
|
const currentLanguage = getCurrentLanguage2();
|
|
@@ -534559,8 +534777,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
534559
534777
|
*/
|
|
534560
534778
|
loadGitignore() {
|
|
534561
534779
|
const gitignorePath = path52.join(this.projectRoot, ".gitignore");
|
|
534562
|
-
if (
|
|
534563
|
-
const content =
|
|
534780
|
+
if (fs45.existsSync(gitignorePath)) {
|
|
534781
|
+
const content = fs45.readFileSync(gitignorePath, "utf-8");
|
|
534564
534782
|
this.ignoreFilter.add(content);
|
|
534565
534783
|
}
|
|
534566
534784
|
}
|
|
@@ -534595,7 +534813,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
534595
534813
|
const scanDir = (dir) => {
|
|
534596
534814
|
let entries;
|
|
534597
534815
|
try {
|
|
534598
|
-
entries =
|
|
534816
|
+
entries = fs45.readdirSync(dir, { withFileTypes: true });
|
|
534599
534817
|
} catch (error42) {
|
|
534600
534818
|
if (error42.code === "EPERM" || error42.code === "EACCES") {
|
|
534601
534819
|
logger.warn(`\u8DF3\u8FC7\u65E0\u6743\u9650\u8BBF\u95EE\u7684\u76EE\u5F55: ${dir}`);
|
|
@@ -534677,7 +534895,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
534677
534895
|
content = docContent.text;
|
|
534678
534896
|
fileHash = crypto5.createHash("sha256").update(content).digest("hex");
|
|
534679
534897
|
} else {
|
|
534680
|
-
content =
|
|
534898
|
+
content = fs45.readFileSync(filePath, "utf-8");
|
|
534681
534899
|
fileHash = crypto5.createHash("sha256").update(content).digest("hex");
|
|
534682
534900
|
}
|
|
534683
534901
|
if (this.db.hasFileHash(fileHash)) {
|
|
@@ -536475,7 +536693,7 @@ var taskManager_exports = {};
|
|
|
536475
536693
|
__export(taskManager_exports, {
|
|
536476
536694
|
taskManager: () => taskManager
|
|
536477
536695
|
});
|
|
536478
|
-
import
|
|
536696
|
+
import fs46 from "fs/promises";
|
|
536479
536697
|
import path53 from "path";
|
|
536480
536698
|
import os25 from "os";
|
|
536481
536699
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
@@ -536516,7 +536734,7 @@ var init_taskManager = __esm({
|
|
|
536516
536734
|
}
|
|
536517
536735
|
async ensureTasksDir() {
|
|
536518
536736
|
try {
|
|
536519
|
-
await
|
|
536737
|
+
await fs46.mkdir(this.tasksDir, { recursive: true });
|
|
536520
536738
|
} catch (error42) {
|
|
536521
536739
|
}
|
|
536522
536740
|
}
|
|
@@ -536542,12 +536760,12 @@ var init_taskManager = __esm({
|
|
|
536542
536760
|
async saveTask(task) {
|
|
536543
536761
|
await this.ensureTasksDir();
|
|
536544
536762
|
const taskPath = this.getTaskPath(task.id);
|
|
536545
|
-
await
|
|
536763
|
+
await fs46.writeFile(taskPath, JSON.stringify(task, null, 2));
|
|
536546
536764
|
}
|
|
536547
536765
|
async loadTask(taskId) {
|
|
536548
536766
|
try {
|
|
536549
536767
|
const taskPath = this.getTaskPath(taskId);
|
|
536550
|
-
const data = await
|
|
536768
|
+
const data = await fs46.readFile(taskPath, "utf-8");
|
|
536551
536769
|
return JSON.parse(data);
|
|
536552
536770
|
} catch (error42) {
|
|
536553
536771
|
return null;
|
|
@@ -536557,12 +536775,12 @@ var init_taskManager = __esm({
|
|
|
536557
536775
|
await this.ensureTasksDir();
|
|
536558
536776
|
const tasks = [];
|
|
536559
536777
|
try {
|
|
536560
|
-
const files = await
|
|
536778
|
+
const files = await fs46.readdir(this.tasksDir);
|
|
536561
536779
|
for (const file2 of files) {
|
|
536562
536780
|
if (file2.endsWith(".json")) {
|
|
536563
536781
|
try {
|
|
536564
536782
|
const taskPath = path53.join(this.tasksDir, file2);
|
|
536565
|
-
const data = await
|
|
536783
|
+
const data = await fs46.readFile(taskPath, "utf-8");
|
|
536566
536784
|
const task = JSON.parse(data);
|
|
536567
536785
|
tasks.push({
|
|
536568
536786
|
id: task.id,
|
|
@@ -536597,7 +536815,7 @@ var init_taskManager = __esm({
|
|
|
536597
536815
|
}
|
|
536598
536816
|
}
|
|
536599
536817
|
const taskPath = this.getTaskPath(taskId);
|
|
536600
|
-
await
|
|
536818
|
+
await fs46.unlink(taskPath);
|
|
536601
536819
|
return true;
|
|
536602
536820
|
} catch (error42) {
|
|
536603
536821
|
return false;
|
|
@@ -536893,16 +537111,16 @@ __export(fileUtils_exports, {
|
|
|
536893
537111
|
getFileLineCount: () => getFileLineCount,
|
|
536894
537112
|
parseAndValidateFileReferences: () => parseAndValidateFileReferences
|
|
536895
537113
|
});
|
|
536896
|
-
import
|
|
537114
|
+
import fs47 from "fs";
|
|
536897
537115
|
import path54 from "path";
|
|
536898
537116
|
function getFileLineCount(filePath) {
|
|
536899
537117
|
return new Promise((resolve15) => {
|
|
536900
537118
|
try {
|
|
536901
|
-
if (!
|
|
537119
|
+
if (!fs47.existsSync(filePath)) {
|
|
536902
537120
|
resolve15(0);
|
|
536903
537121
|
return;
|
|
536904
537122
|
}
|
|
536905
|
-
const content =
|
|
537123
|
+
const content = fs47.readFileSync(filePath, "utf-8");
|
|
536906
537124
|
const lines = content.split("\n").length;
|
|
536907
537125
|
resolve15(lines);
|
|
536908
537126
|
} catch (error42) {
|
|
@@ -536950,7 +537168,7 @@ async function getFileInfo(filePath) {
|
|
|
536950
537168
|
let actualPath = filePath;
|
|
536951
537169
|
let exists = false;
|
|
536952
537170
|
for (const tryPath of uniquePaths) {
|
|
536953
|
-
if (
|
|
537171
|
+
if (fs47.existsSync(tryPath)) {
|
|
536954
537172
|
actualPath = tryPath;
|
|
536955
537173
|
exists = true;
|
|
536956
537174
|
break;
|
|
@@ -536962,7 +537180,7 @@ async function getFileInfo(filePath) {
|
|
|
536962
537180
|
let lineCount = 0;
|
|
536963
537181
|
if (exists) {
|
|
536964
537182
|
if (isImage) {
|
|
536965
|
-
const buffer =
|
|
537183
|
+
const buffer = fs47.readFileSync(actualPath);
|
|
536966
537184
|
const base643 = buffer.toString("base64");
|
|
536967
537185
|
mimeType = getMimeType(actualPath);
|
|
536968
537186
|
imageData = `data:${mimeType};base64,${base643}`;
|
|
@@ -537253,223 +537471,36 @@ var init_sessionInitializer = __esm({
|
|
|
537253
537471
|
}
|
|
537254
537472
|
});
|
|
537255
537473
|
|
|
537256
|
-
// dist/utils/
|
|
537257
|
-
|
|
537258
|
-
|
|
537259
|
-
|
|
537260
|
-
if (!
|
|
537261
|
-
|
|
537262
|
-
|
|
537263
|
-
|
|
537264
|
-
|
|
537265
|
-
|
|
537266
|
-
}
|
|
537267
|
-
function computeHashlinePreview(originalContent, operations) {
|
|
537268
|
-
if (!Array.isArray(operations) || operations.length === 0) {
|
|
537269
|
-
return originalContent;
|
|
537270
|
-
}
|
|
537271
|
-
const mutableLines = originalContent.split("\n");
|
|
537272
|
-
const parsed = operations.map((op2) => {
|
|
537273
|
-
const startMatch = String(op2.startAnchor ?? "").match(/^(\d+):/);
|
|
537274
|
-
const endMatch = String(op2.endAnchor ?? "").match(/^(\d+):/);
|
|
537275
|
-
return {
|
|
537276
|
-
type: op2.type,
|
|
537277
|
-
content: op2.content ?? "",
|
|
537278
|
-
startLine: startMatch ? parseInt(startMatch[1], 10) : 0,
|
|
537279
|
-
endLine: endMatch ? parseInt(endMatch[1], 10) : 0
|
|
537280
|
-
};
|
|
537281
|
-
}).filter((op2) => op2.startLine > 0 && op2.endLine > 0).sort((a, b) => b.startLine - a.startLine);
|
|
537282
|
-
for (const op2 of parsed) {
|
|
537283
|
-
const newLines = op2.content.split("\n");
|
|
537284
|
-
switch (op2.type) {
|
|
537285
|
-
case "replace":
|
|
537286
|
-
mutableLines.splice(op2.startLine - 1, op2.endLine - op2.startLine + 1, ...newLines);
|
|
537287
|
-
break;
|
|
537288
|
-
case "insert_after":
|
|
537289
|
-
mutableLines.splice(op2.startLine, 0, ...newLines);
|
|
537290
|
-
break;
|
|
537291
|
-
case "delete":
|
|
537292
|
-
mutableLines.splice(op2.startLine - 1, op2.endLine - op2.startLine + 1);
|
|
537293
|
-
break;
|
|
537294
|
-
}
|
|
537295
|
-
}
|
|
537296
|
-
return mutableLines.join("\n");
|
|
537297
|
-
}
|
|
537298
|
-
function computeReplaceEditPreview(originalContent, searchContent, replaceContent) {
|
|
537299
|
-
const idx = originalContent.indexOf(searchContent);
|
|
537300
|
-
if (idx !== -1) {
|
|
537301
|
-
return originalContent.substring(0, idx) + replaceContent + originalContent.substring(idx + searchContent.length);
|
|
537302
|
-
}
|
|
537303
|
-
return originalContent;
|
|
537304
|
-
}
|
|
537305
|
-
function collectDiffPreviewEntries(toolName, toolArgs) {
|
|
537306
|
-
const entries = [];
|
|
537307
|
-
try {
|
|
537308
|
-
const parsed = JSON.parse(toolArgs);
|
|
537309
|
-
if (typeof parsed.filePath === "string" && parsed.filePath.trimStart().startsWith("[")) {
|
|
537310
|
-
try {
|
|
537311
|
-
parsed.filePath = JSON.parse(parsed.filePath);
|
|
537312
|
-
} catch {
|
|
537313
|
-
}
|
|
537314
|
-
}
|
|
537315
|
-
if (toolName === "filesystem-edit" && parsed.filePath) {
|
|
537316
|
-
if (typeof parsed.filePath === "string") {
|
|
537317
|
-
const originalContent = readOriginalFile(parsed.filePath);
|
|
537318
|
-
if (originalContent !== null) {
|
|
537319
|
-
const newContent = computeHashlinePreview(originalContent, parsed.operations);
|
|
537320
|
-
entries.push({
|
|
537321
|
-
filePath: parsed.filePath,
|
|
537322
|
-
oldContent: originalContent,
|
|
537323
|
-
newContent
|
|
537324
|
-
});
|
|
537325
|
-
}
|
|
537326
|
-
} else if (Array.isArray(parsed.filePath)) {
|
|
537327
|
-
for (const item of parsed.filePath) {
|
|
537328
|
-
if (item && typeof item === "object" && typeof item.path === "string") {
|
|
537329
|
-
const originalContent = readOriginalFile(item.path);
|
|
537330
|
-
if (originalContent !== null) {
|
|
537331
|
-
const newContent = computeHashlinePreview(originalContent, item.operations);
|
|
537332
|
-
entries.push({
|
|
537333
|
-
filePath: item.path,
|
|
537334
|
-
oldContent: originalContent,
|
|
537335
|
-
newContent
|
|
537336
|
-
});
|
|
537337
|
-
}
|
|
537338
|
-
}
|
|
537339
|
-
}
|
|
537474
|
+
// dist/utils/session/sessionConverter.js
|
|
537475
|
+
function findToolResultDiffData(sessionMessages, startIndex, toolCallId) {
|
|
537476
|
+
for (let j = startIndex + 1; j < sessionMessages.length; j++) {
|
|
537477
|
+
const nextMsg = sessionMessages[j];
|
|
537478
|
+
if (!nextMsg)
|
|
537479
|
+
break;
|
|
537480
|
+
if (nextMsg.role === "tool" && nextMsg.tool_call_id === toolCallId) {
|
|
537481
|
+
const savedEditDiffData = nextMsg.editDiffData;
|
|
537482
|
+
if (savedEditDiffData && (typeof savedEditDiffData.oldContent === "string" || typeof savedEditDiffData.content === "string" || Array.isArray(savedEditDiffData.batchResults))) {
|
|
537483
|
+
return savedEditDiffData;
|
|
537340
537484
|
}
|
|
537341
|
-
|
|
537342
|
-
|
|
537343
|
-
|
|
537344
|
-
const originalContent = readOriginalFile(parsed.filePath);
|
|
537345
|
-
if (originalContent !== null) {
|
|
537346
|
-
const newContent = parsed.searchContent && parsed.replaceContent !== void 0 ? computeReplaceEditPreview(originalContent, parsed.searchContent, parsed.replaceContent) : originalContent;
|
|
537347
|
-
entries.push({
|
|
537348
|
-
filePath: parsed.filePath,
|
|
537349
|
-
oldContent: originalContent,
|
|
537350
|
-
newContent
|
|
537351
|
-
});
|
|
537352
|
-
}
|
|
537353
|
-
} else if (Array.isArray(parsed.filePath)) {
|
|
537354
|
-
for (const item of parsed.filePath) {
|
|
537355
|
-
if (typeof item === "string") {
|
|
537356
|
-
const originalContent = readOriginalFile(item);
|
|
537357
|
-
if (originalContent !== null) {
|
|
537358
|
-
const newContent = parsed.searchContent && parsed.replaceContent !== void 0 ? computeReplaceEditPreview(originalContent, parsed.searchContent, parsed.replaceContent) : originalContent;
|
|
537359
|
-
entries.push({
|
|
537360
|
-
filePath: item,
|
|
537361
|
-
oldContent: originalContent,
|
|
537362
|
-
newContent
|
|
537363
|
-
});
|
|
537364
|
-
}
|
|
537365
|
-
} else if (item && typeof item === "object" && typeof item.path === "string") {
|
|
537366
|
-
const originalContent = readOriginalFile(item.path);
|
|
537367
|
-
if (originalContent !== null) {
|
|
537368
|
-
const search = item.searchContent ?? parsed.searchContent;
|
|
537369
|
-
const replace = item.replaceContent ?? parsed.replaceContent;
|
|
537370
|
-
const newContent = search && replace !== void 0 ? computeReplaceEditPreview(originalContent, search, replace) : originalContent;
|
|
537371
|
-
entries.push({
|
|
537372
|
-
filePath: item.path,
|
|
537373
|
-
oldContent: originalContent,
|
|
537374
|
-
newContent
|
|
537375
|
-
});
|
|
537376
|
-
}
|
|
537377
|
-
}
|
|
537378
|
-
}
|
|
537485
|
+
const toolName = findToolNameForToolCall(sessionMessages, startIndex, toolCallId);
|
|
537486
|
+
if (toolName) {
|
|
537487
|
+
return extractFilesystemEditDiffDataForPersistence(toolName, nextMsg.content);
|
|
537379
537488
|
}
|
|
537489
|
+
return void 0;
|
|
537380
537490
|
}
|
|
537381
|
-
if (
|
|
537382
|
-
|
|
537383
|
-
const originalContent = readOriginalFile(parsed.filePath) ?? "";
|
|
537384
|
-
entries.push({
|
|
537385
|
-
filePath: parsed.filePath,
|
|
537386
|
-
oldContent: originalContent,
|
|
537387
|
-
newContent: parsed.content
|
|
537388
|
-
});
|
|
537389
|
-
} else if (Array.isArray(parsed.filePath)) {
|
|
537390
|
-
for (const item of parsed.filePath) {
|
|
537391
|
-
if (item && typeof item === "object" && typeof item.path === "string" && typeof item.content === "string") {
|
|
537392
|
-
const originalContent = readOriginalFile(item.path) ?? "";
|
|
537393
|
-
entries.push({
|
|
537394
|
-
filePath: item.path,
|
|
537395
|
-
oldContent: originalContent,
|
|
537396
|
-
newContent: item.content
|
|
537397
|
-
});
|
|
537398
|
-
}
|
|
537399
|
-
}
|
|
537400
|
-
}
|
|
537491
|
+
if (nextMsg.role === "assistant" && !nextMsg.subAgentInternal) {
|
|
537492
|
+
break;
|
|
537401
537493
|
}
|
|
537402
|
-
} catch {
|
|
537403
537494
|
}
|
|
537404
|
-
return
|
|
537495
|
+
return void 0;
|
|
537405
537496
|
}
|
|
537406
|
-
function
|
|
537407
|
-
|
|
537408
|
-
|
|
537409
|
-
|
|
537410
|
-
const
|
|
537411
|
-
|
|
537412
|
-
try {
|
|
537413
|
-
toolArgs = { ...toolArgs, filePath: JSON.parse(rawFilePath) };
|
|
537414
|
-
} catch {
|
|
537415
|
-
}
|
|
537416
|
-
}
|
|
537417
|
-
const isBatch = toolArgs["isBatch"] || Array.isArray(toolArgs["filePath"]);
|
|
537418
|
-
if (!isBatch) {
|
|
537419
|
-
const entries2 = collectDiffPreviewEntries(toolName, JSON.stringify(toolArgs));
|
|
537420
|
-
if (entries2.length === 1) {
|
|
537421
|
-
const entry = entries2[0];
|
|
537422
|
-
if (toolName === "filesystem-create") {
|
|
537423
|
-
return {
|
|
537424
|
-
...toolArgs,
|
|
537425
|
-
content: entry.newContent,
|
|
537426
|
-
path: entry.filePath
|
|
537427
|
-
};
|
|
537428
|
-
}
|
|
537429
|
-
return {
|
|
537430
|
-
...toolArgs,
|
|
537431
|
-
oldContent: entry.oldContent,
|
|
537432
|
-
newContent: entry.newContent,
|
|
537433
|
-
filename: entry.filePath
|
|
537434
|
-
};
|
|
537435
|
-
}
|
|
537436
|
-
return toolArgs;
|
|
537437
|
-
}
|
|
537438
|
-
const entries = collectDiffPreviewEntries(toolName, JSON.stringify(toolArgs));
|
|
537439
|
-
if (entries.length === 0) {
|
|
537440
|
-
return toolArgs;
|
|
537441
|
-
}
|
|
537442
|
-
if (toolName === "filesystem-create") {
|
|
537443
|
-
const batchResults2 = entries.map((entry) => ({
|
|
537444
|
-
success: true,
|
|
537445
|
-
path: entry.filePath,
|
|
537446
|
-
content: entry.newContent
|
|
537447
|
-
}));
|
|
537448
|
-
return {
|
|
537449
|
-
...toolArgs,
|
|
537450
|
-
isBatch: true,
|
|
537451
|
-
batchResults: batchResults2
|
|
537452
|
-
};
|
|
537453
|
-
}
|
|
537454
|
-
const batchResults = entries.map((entry) => ({
|
|
537455
|
-
success: true,
|
|
537456
|
-
path: entry.filePath,
|
|
537457
|
-
oldContent: entry.oldContent,
|
|
537458
|
-
newContent: entry.newContent
|
|
537459
|
-
}));
|
|
537460
|
-
return {
|
|
537461
|
-
...toolArgs,
|
|
537462
|
-
isBatch: true,
|
|
537463
|
-
batchResults
|
|
537464
|
-
};
|
|
537497
|
+
function findToolNameForToolCall(sessionMessages, assistantIndex, toolCallId) {
|
|
537498
|
+
const msg = sessionMessages[assistantIndex];
|
|
537499
|
+
if (!msg || !msg.tool_calls)
|
|
537500
|
+
return void 0;
|
|
537501
|
+
const tc = msg.tool_calls.find((t) => t.id === toolCallId);
|
|
537502
|
+
return tc == null ? void 0 : tc.function.name;
|
|
537465
537503
|
}
|
|
537466
|
-
var init_diffPreview = __esm({
|
|
537467
|
-
"dist/utils/ui/diffPreview.js"() {
|
|
537468
|
-
"use strict";
|
|
537469
|
-
}
|
|
537470
|
-
});
|
|
537471
|
-
|
|
537472
|
-
// dist/utils/session/sessionConverter.js
|
|
537473
537504
|
function cleanThinkingContent3(content) {
|
|
537474
537505
|
return content.replace(/\s*<\/?think(?:ing)?>\s*/gi, "").trim();
|
|
537475
537506
|
}
|
|
@@ -537538,13 +537569,15 @@ function convertSessionMessagesToUI(sessionMessages) {
|
|
|
537538
537569
|
const params = toolDisplay.args.map((arg) => `${arg.key}: ${arg.value}`).join(", ");
|
|
537539
537570
|
paramDisplay = ` (${params})`;
|
|
537540
537571
|
}
|
|
537572
|
+
const subAgentSavedDiffData = findToolResultDiffData(sessionMessages, i, toolCall.id);
|
|
537573
|
+
const subAgentEnrichedArgs = subAgentSavedDiffData ? { ...toolArgs, ...subAgentSavedDiffData } : enrichPendingEditArgs(toolCall.function.name, toolArgs);
|
|
537541
537574
|
uiMessages.push({
|
|
537542
537575
|
role: "subagent",
|
|
537543
537576
|
content: `\x1B[38;2;184;122;206m\u2687\u26A1 ${toolDisplay.toolName}${paramDisplay}\x1B[0m`,
|
|
537544
537577
|
streaming: false,
|
|
537545
537578
|
toolCall: {
|
|
537546
537579
|
name: toolCall.function.name,
|
|
537547
|
-
arguments:
|
|
537580
|
+
arguments: subAgentEnrichedArgs
|
|
537548
537581
|
},
|
|
537549
537582
|
toolCallId: toolCall.id,
|
|
537550
537583
|
toolPending: false,
|
|
@@ -537712,7 +537745,8 @@ function convertSessionMessagesToUI(sessionMessages) {
|
|
|
537712
537745
|
}
|
|
537713
537746
|
const needTwoSteps = isToolNeedTwoStepDisplay(toolCall.function.name);
|
|
537714
537747
|
if (needTwoSteps) {
|
|
537715
|
-
const
|
|
537748
|
+
const savedDiffData = findToolResultDiffData(sessionMessages, i, toolCall.id);
|
|
537749
|
+
const enrichedArgs = savedDiffData ? { ...toolArgs, ...savedDiffData } : enrichPendingEditArgs(toolCall.function.name, toolArgs);
|
|
537716
537750
|
uiMessages.push({
|
|
537717
537751
|
role: "assistant",
|
|
537718
537752
|
content: `\u26A1 ${toolDisplay.toolName}`,
|
|
@@ -560131,6 +560165,10 @@ function useConfigInput(state, callbacks) {
|
|
|
560131
560165
|
setRetryDelayMs,
|
|
560132
560166
|
thinkingBudgetTokens,
|
|
560133
560167
|
setThinkingBudgetTokens,
|
|
560168
|
+
setThinkingEffort,
|
|
560169
|
+
setGeminiThinkingLevel,
|
|
560170
|
+
setResponsesReasoningEffort,
|
|
560171
|
+
setChatReasoningEffort,
|
|
560134
560172
|
autoCompressThreshold,
|
|
560135
560173
|
setAutoCompressThreshold,
|
|
560136
560174
|
setAdvancedModel,
|
|
@@ -560241,6 +560279,14 @@ function useConfigInput(state, callbacks) {
|
|
|
560241
560279
|
setBasicModel(cleaned);
|
|
560242
560280
|
} else if (currentField === "visionModel") {
|
|
560243
560281
|
setVisionModel(cleaned);
|
|
560282
|
+
} else if (currentField === "thinkingEffort") {
|
|
560283
|
+
setThinkingEffort(cleaned);
|
|
560284
|
+
} else if (currentField === "geminiThinkingLevel") {
|
|
560285
|
+
setGeminiThinkingLevel(cleaned);
|
|
560286
|
+
} else if (currentField === "responsesReasoningEffort") {
|
|
560287
|
+
setResponsesReasoningEffort(cleaned);
|
|
560288
|
+
} else if (currentField === "chatReasoningEffort") {
|
|
560289
|
+
setChatReasoningEffort(cleaned);
|
|
560244
560290
|
}
|
|
560245
560291
|
}
|
|
560246
560292
|
setManualInputMode(false);
|
|
@@ -561913,20 +561959,40 @@ function ConfigSelectPanel({ state }) {
|
|
|
561913
561959
|
setIsEditing(false);
|
|
561914
561960
|
} }),
|
|
561915
561961
|
currentField === "thinkingEffort" && import_react73.default.createElement(ScrollableSelectInput, { items: [
|
|
561962
|
+
{
|
|
561963
|
+
label: t.configScreen.manualInputOption,
|
|
561964
|
+
value: "__MANUAL_INPUT__"
|
|
561965
|
+
},
|
|
561916
561966
|
{ label: "low", value: "low" },
|
|
561917
561967
|
{ label: "medium", value: "medium" },
|
|
561918
561968
|
{ label: "high", value: "high" },
|
|
561919
561969
|
{ label: "max", value: "max" }
|
|
561920
|
-
], initialIndex:
|
|
561970
|
+
], initialIndex: Math.max(0, ["__MANUAL_INPUT__", "low", "medium", "high", "max"].indexOf(thinkingEffort)), isFocused: true, onSelect: (item) => {
|
|
561971
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
561972
|
+
setIsEditing(false);
|
|
561973
|
+
state.setManualInputMode(true);
|
|
561974
|
+
state.setManualInputValue(thinkingEffort);
|
|
561975
|
+
return;
|
|
561976
|
+
}
|
|
561921
561977
|
setThinkingEffort(item.value);
|
|
561922
561978
|
setIsEditing(false);
|
|
561923
561979
|
} }),
|
|
561924
561980
|
currentField === "geminiThinkingLevel" && import_react73.default.createElement(ScrollableSelectInput, { items: [
|
|
561981
|
+
{
|
|
561982
|
+
label: t.configScreen.manualInputOption,
|
|
561983
|
+
value: "__MANUAL_INPUT__"
|
|
561984
|
+
},
|
|
561925
561985
|
{ label: "MINIMAL", value: "minimal" },
|
|
561926
561986
|
{ label: "LOW", value: "low" },
|
|
561927
561987
|
{ label: "MEDIUM", value: "medium" },
|
|
561928
561988
|
{ label: "HIGH", value: "high" }
|
|
561929
|
-
], initialIndex: Math.max(0, ["minimal", "low", "medium", "high"].indexOf(geminiThinkingLevel)), isFocused: true, onSelect: (item) => {
|
|
561989
|
+
], initialIndex: Math.max(0, ["__MANUAL_INPUT__", "minimal", "low", "medium", "high"].indexOf(geminiThinkingLevel)), isFocused: true, onSelect: (item) => {
|
|
561990
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
561991
|
+
setIsEditing(false);
|
|
561992
|
+
state.setManualInputMode(true);
|
|
561993
|
+
state.setManualInputValue(geminiThinkingLevel);
|
|
561994
|
+
return;
|
|
561995
|
+
}
|
|
561930
561996
|
setGeminiThinkingLevel(item.value);
|
|
561931
561997
|
setIsEditing(false);
|
|
561932
561998
|
} }),
|
|
@@ -561944,11 +562010,21 @@ function ConfigSelectPanel({ state }) {
|
|
|
561944
562010
|
setIsEditing(false);
|
|
561945
562011
|
} }),
|
|
561946
562012
|
currentField === "chatReasoningEffort" && import_react73.default.createElement(ScrollableSelectInput, { items: [
|
|
562013
|
+
{
|
|
562014
|
+
label: t.configScreen.manualInputOption,
|
|
562015
|
+
value: "__MANUAL_INPUT__"
|
|
562016
|
+
},
|
|
561947
562017
|
{ label: "LOW", value: "low" },
|
|
561948
562018
|
{ label: "MEDIUM", value: "medium" },
|
|
561949
562019
|
{ label: "HIGH", value: "high" },
|
|
561950
562020
|
{ label: "MAX", value: "max" }
|
|
561951
|
-
], initialIndex: Math.max(0, ["low", "medium", "high", "max"].indexOf(chatReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
562021
|
+
], initialIndex: Math.max(0, ["__MANUAL_INPUT__", "low", "medium", "high", "max"].indexOf(chatReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
562022
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
562023
|
+
setIsEditing(false);
|
|
562024
|
+
state.setManualInputMode(true);
|
|
562025
|
+
state.setManualInputValue(chatReasoningEffort);
|
|
562026
|
+
return;
|
|
562027
|
+
}
|
|
561952
562028
|
setChatReasoningEffort(item.value);
|
|
561953
562029
|
setIsEditing(false);
|
|
561954
562030
|
} }),
|
|
@@ -562137,8 +562213,9 @@ function ModelSelect({ state }) {
|
|
|
562137
562213
|
);
|
|
562138
562214
|
}
|
|
562139
562215
|
function ReasoningEffortSelect({ state }) {
|
|
562140
|
-
const { supportsXHigh, responsesReasoningEffort, setResponsesReasoningEffort, setIsEditing } = state;
|
|
562216
|
+
const { t, supportsXHigh, responsesReasoningEffort, setResponsesReasoningEffort, setIsEditing } = state;
|
|
562141
562217
|
const effortOptions = [
|
|
562218
|
+
{ label: t.configScreen.manualInputOption, value: "__MANUAL_INPUT__" },
|
|
562142
562219
|
{ label: "NONE", value: "none" },
|
|
562143
562220
|
{ label: "LOW", value: "low" },
|
|
562144
562221
|
{ label: "MEDIUM", value: "medium" },
|
|
@@ -562146,8 +562223,13 @@ function ReasoningEffortSelect({ state }) {
|
|
|
562146
562223
|
...supportsXHigh ? [{ label: "XHIGH", value: "xhigh" }] : []
|
|
562147
562224
|
];
|
|
562148
562225
|
return import_react73.default.createElement(ScrollableSelectInput, { items: effortOptions, initialIndex: Math.max(0, effortOptions.findIndex((opt) => opt.value === responsesReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
562149
|
-
|
|
562150
|
-
|
|
562226
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
562227
|
+
setIsEditing(false);
|
|
562228
|
+
state.setManualInputMode(true);
|
|
562229
|
+
state.setManualInputValue(responsesReasoningEffort);
|
|
562230
|
+
return;
|
|
562231
|
+
}
|
|
562232
|
+
setResponsesReasoningEffort(item.value);
|
|
562151
562233
|
setIsEditing(false);
|
|
562152
562234
|
} });
|
|
562153
562235
|
}
|
|
@@ -562320,7 +562402,11 @@ function ManualInputView({ state, inlineMode }) {
|
|
|
562320
562402
|
{ color: theme14.colors.menuInfo },
|
|
562321
562403
|
currentField === "advancedModel" && t.configScreen.advancedModel,
|
|
562322
562404
|
currentField === "basicModel" && t.configScreen.basicModel,
|
|
562323
|
-
currentField === "visionModel" && t.configScreen.visionModel
|
|
562405
|
+
currentField === "visionModel" && t.configScreen.visionModel,
|
|
562406
|
+
currentField === "thinkingEffort" && t.configScreen.thinkingEffort,
|
|
562407
|
+
currentField === "geminiThinkingLevel" && t.configScreen.geminiThinkingLevel,
|
|
562408
|
+
currentField === "responsesReasoningEffort" && t.configScreen.responsesReasoningEffort,
|
|
562409
|
+
currentField === "chatReasoningEffort" && t.configScreen.chatReasoningEffort
|
|
562324
562410
|
),
|
|
562325
562411
|
import_react74.default.createElement(
|
|
562326
562412
|
Box_default,
|
|
@@ -675602,12 +675688,37 @@ var init_ModelsPanel = __esm({
|
|
|
675602
675688
|
return;
|
|
675603
675689
|
}
|
|
675604
675690
|
if (thinkingInputMode) {
|
|
675605
|
-
if (
|
|
675606
|
-
|
|
675607
|
-
|
|
675608
|
-
if (
|
|
675691
|
+
if (thinkingInputMode === "anthropicBudgetTokens") {
|
|
675692
|
+
if (key.return) {
|
|
675693
|
+
const parsed = Number.parseInt(thinkingInputValue.trim(), 10);
|
|
675694
|
+
if (!Number.isNaN(parsed) && parsed >= 0) {
|
|
675609
675695
|
void applyAnthropicBudgetTokens(parsed);
|
|
675610
675696
|
}
|
|
675697
|
+
setThinkingInputMode(null);
|
|
675698
|
+
setThinkingInputValue("");
|
|
675699
|
+
return;
|
|
675700
|
+
}
|
|
675701
|
+
if (key.backspace || key.delete) {
|
|
675702
|
+
setThinkingInputValue((prev) => prev.slice(0, -1));
|
|
675703
|
+
return;
|
|
675704
|
+
}
|
|
675705
|
+
if (input2 && /[0-9]/.test(input2)) {
|
|
675706
|
+
setThinkingInputValue((prev) => prev + input2);
|
|
675707
|
+
}
|
|
675708
|
+
return;
|
|
675709
|
+
}
|
|
675710
|
+
if (key.return) {
|
|
675711
|
+
const cleaned = thinkingInputValue.trim();
|
|
675712
|
+
if (cleaned) {
|
|
675713
|
+
if (thinkingInputMode === "thinkingEffort") {
|
|
675714
|
+
void applyThinkingEffort(cleaned);
|
|
675715
|
+
} else if (thinkingInputMode === "geminiThinkingLevel") {
|
|
675716
|
+
void applyGeminiLevel(cleaned);
|
|
675717
|
+
} else if (thinkingInputMode === "responsesReasoningEffort") {
|
|
675718
|
+
void applyResponsesEffort(cleaned);
|
|
675719
|
+
} else if (thinkingInputMode === "chatReasoningEffort") {
|
|
675720
|
+
void applyChatReasoningEffort(cleaned);
|
|
675721
|
+
}
|
|
675611
675722
|
}
|
|
675612
675723
|
setThinkingInputMode(null);
|
|
675613
675724
|
setThinkingInputValue("");
|
|
@@ -675617,7 +675728,7 @@ var init_ModelsPanel = __esm({
|
|
|
675617
675728
|
setThinkingInputValue((prev) => prev.slice(0, -1));
|
|
675618
675729
|
return;
|
|
675619
675730
|
}
|
|
675620
|
-
if (input2 && /[
|
|
675731
|
+
if (input2 && /[a-zA-Z0-9_-]/.test(input2)) {
|
|
675621
675732
|
setThinkingInputValue((prev) => prev + input2);
|
|
675622
675733
|
}
|
|
675623
675734
|
return;
|
|
@@ -675881,7 +675992,7 @@ var init_ModelsPanel = __esm({
|
|
|
675881
675992
|
thinkingInputMode && import_react187.default.createElement(
|
|
675882
675993
|
Box_default,
|
|
675883
675994
|
{ flexDirection: "column", marginTop: 1 },
|
|
675884
|
-
import_react187.default.createElement(Text, { color: theme14.colors.menuInfo }, t.modelsPanel.inputNumberHint),
|
|
675995
|
+
import_react187.default.createElement(Text, { color: theme14.colors.menuInfo }, thinkingInputMode === "anthropicBudgetTokens" ? t.modelsPanel.inputNumberHint : t.modelsPanel.manualInputHint),
|
|
675885
675996
|
import_react187.default.createElement(
|
|
675886
675997
|
Box_default,
|
|
675887
675998
|
{ marginLeft: 1 },
|
|
@@ -675916,11 +676027,19 @@ var init_ModelsPanel = __esm({
|
|
|
675916
676027
|
Box_default,
|
|
675917
676028
|
{ marginTop: 1 },
|
|
675918
676029
|
import_react187.default.createElement(ScrollableSelectInput, { items: (requestMethod === "anthropic" ? [
|
|
676030
|
+
{
|
|
676031
|
+
label: t.modelsPanel.manualInputOption,
|
|
676032
|
+
value: "__MANUAL_INPUT__"
|
|
676033
|
+
},
|
|
675919
676034
|
{ label: "low", value: "low" },
|
|
675920
676035
|
{ label: "medium", value: "medium" },
|
|
675921
676036
|
{ label: "high", value: "high" },
|
|
675922
676037
|
{ label: "max", value: "max" }
|
|
675923
676038
|
] : [
|
|
676039
|
+
{
|
|
676040
|
+
label: t.modelsPanel.manualInputOption,
|
|
676041
|
+
value: "__MANUAL_INPUT__"
|
|
676042
|
+
},
|
|
675924
676043
|
{ label: "none", value: "none" },
|
|
675925
676044
|
{ label: "low", value: "low" },
|
|
675926
676045
|
{ label: "medium", value: "medium" },
|
|
@@ -675930,6 +676049,18 @@ var init_ModelsPanel = __esm({
|
|
|
675930
676049
|
label: i.label,
|
|
675931
676050
|
value: i.value
|
|
675932
676051
|
})), limit: 6, disableNumberShortcuts: true, initialIndex: Math.max(0, requestMethod === "anthropic" ? ["low", "medium", "high", "max"].indexOf(thinkingEffort) : ["none", "low", "medium", "high", "xhigh"].indexOf(responsesReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
676052
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
676053
|
+
if (requestMethod === "anthropic") {
|
|
676054
|
+
setIsThinkingEffortSelecting(false);
|
|
676055
|
+
setThinkingInputMode("thinkingEffort");
|
|
676056
|
+
setThinkingInputValue(thinkingEffort);
|
|
676057
|
+
} else {
|
|
676058
|
+
setIsThinkingEffortSelecting(false);
|
|
676059
|
+
setThinkingInputMode("responsesReasoningEffort");
|
|
676060
|
+
setThinkingInputValue(responsesReasoningEffort);
|
|
676061
|
+
}
|
|
676062
|
+
return;
|
|
676063
|
+
}
|
|
675933
676064
|
if (requestMethod === "anthropic") {
|
|
675934
676065
|
void applyThinkingEffort(item.value);
|
|
675935
676066
|
} else {
|
|
@@ -675954,11 +676085,21 @@ var init_ModelsPanel = __esm({
|
|
|
675954
676085
|
Box_default,
|
|
675955
676086
|
{ marginTop: 1 },
|
|
675956
676087
|
import_react187.default.createElement(ScrollableSelectInput, { items: [
|
|
676088
|
+
{
|
|
676089
|
+
label: t.modelsPanel.manualInputOption,
|
|
676090
|
+
value: "__MANUAL_INPUT__"
|
|
676091
|
+
},
|
|
675957
676092
|
{ label: "MINIMAL", value: "minimal" },
|
|
675958
676093
|
{ label: "LOW", value: "low" },
|
|
675959
676094
|
{ label: "MEDIUM", value: "medium" },
|
|
675960
676095
|
{ label: "HIGH", value: "high" }
|
|
675961
676096
|
], limit: 6, disableNumberShortcuts: true, initialIndex: Math.max(0, ["minimal", "low", "medium", "high"].indexOf(geminiThinkingLevel)), isFocused: true, onSelect: (item) => {
|
|
676097
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
676098
|
+
setIsGeminiLevelSelecting(false);
|
|
676099
|
+
setThinkingInputMode("geminiThinkingLevel");
|
|
676100
|
+
setThinkingInputValue(geminiThinkingLevel);
|
|
676101
|
+
return;
|
|
676102
|
+
}
|
|
675962
676103
|
void applyGeminiLevel(item.value);
|
|
675963
676104
|
setIsGeminiLevelSelecting(false);
|
|
675964
676105
|
} })
|
|
@@ -675985,11 +676126,21 @@ var init_ModelsPanel = __esm({
|
|
|
675985
676126
|
Box_default,
|
|
675986
676127
|
{ marginTop: 1 },
|
|
675987
676128
|
import_react187.default.createElement(ScrollableSelectInput, { items: [
|
|
676129
|
+
{
|
|
676130
|
+
label: t.modelsPanel.manualInputOption,
|
|
676131
|
+
value: "__MANUAL_INPUT__"
|
|
676132
|
+
},
|
|
675988
676133
|
{ label: "LOW", value: "low" },
|
|
675989
676134
|
{ label: "MEDIUM", value: "medium" },
|
|
675990
676135
|
{ label: "HIGH", value: "high" },
|
|
675991
676136
|
{ label: "MAX", value: "max" }
|
|
675992
676137
|
], limit: 6, disableNumberShortcuts: true, initialIndex: Math.max(0, ["low", "medium", "high", "max"].indexOf(chatReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
676138
|
+
if (item.value === "__MANUAL_INPUT__") {
|
|
676139
|
+
setIsChatEffortSelecting(false);
|
|
676140
|
+
setThinkingInputMode("chatReasoningEffort");
|
|
676141
|
+
setThinkingInputValue(chatReasoningEffort);
|
|
676142
|
+
return;
|
|
676143
|
+
}
|
|
675993
676144
|
void applyChatReasoningEffort(item.value);
|
|
675994
676145
|
setIsChatEffortSelecting(false);
|
|
675995
676146
|
} })
|
|
@@ -693541,7 +693692,7 @@ var require_package4 = __commonJS({
|
|
|
693541
693692
|
"package.json"(exports2, module2) {
|
|
693542
693693
|
module2.exports = {
|
|
693543
693694
|
name: "snow-ai",
|
|
693544
|
-
version: "0.8.
|
|
693695
|
+
version: "0.8.13",
|
|
693545
693696
|
description: "Agentic coding in your terminal",
|
|
693546
693697
|
license: "MIT",
|
|
693547
693698
|
bin: {
|
package/bundle/package.json
CHANGED