snow-ai 0.6.51 → 0.6.53
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 +209 -54
- package/bundle/package.json +7 -2
- package/package.json +7 -2
package/bundle/cli.mjs
CHANGED
|
@@ -12,6 +12,18 @@ const require = Object.assign((moduleName) => {
|
|
|
12
12
|
const __filename = _fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = _fileURLToPath(new URL('.', import.meta.url));
|
|
14
14
|
|
|
15
|
+
// Pre-load @microsoft/signalr runtime dependencies into require.cache
|
|
16
|
+
// SignalR uses dynamic require() which esbuild cannot bundle statically
|
|
17
|
+
// We load them here so they're available when SignalR tries to require() them
|
|
18
|
+
const __signalr_deps = {
|
|
19
|
+
'abort-controller': require('abort-controller'),
|
|
20
|
+
'eventsource': require('eventsource'),
|
|
21
|
+
'fetch-cookie': require('fetch-cookie'),
|
|
22
|
+
'node-fetch': require('node-fetch'),
|
|
23
|
+
'tough-cookie': require('tough-cookie'),
|
|
24
|
+
'ws': require('ws')
|
|
25
|
+
};
|
|
26
|
+
|
|
15
27
|
// Polyfill for @microsoft/signalr dynamic require
|
|
16
28
|
// SignalR uses: const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
|
|
17
29
|
// Keep __non_webpack_require__ aligned with our wrapped require for both branches.
|
|
@@ -64512,7 +64524,7 @@ var init_streamableHttp = __esm({
|
|
|
64512
64524
|
}
|
|
64513
64525
|
});
|
|
64514
64526
|
|
|
64515
|
-
// node_modules/eventsource/dist/index.js
|
|
64527
|
+
// node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/dist/index.js
|
|
64516
64528
|
function syntaxError(message) {
|
|
64517
64529
|
const DomException = globalThis.DOMException;
|
|
64518
64530
|
return typeof DomException == "function" ? new DomException(message, "SyntaxError") : new SyntaxError(message);
|
|
@@ -64536,7 +64548,7 @@ function getBaseURL() {
|
|
|
64536
64548
|
}
|
|
64537
64549
|
var ErrorEvent2, __typeError2, __accessCheck2, __privateGet2, __privateAdd2, __privateSet2, __privateMethod2, _readyState, _url, _redirectUrl, _withCredentials, _fetch, _reconnectInterval, _reconnectTimer, _lastEventId, _controller, _parser, _onError, _onMessage, _onOpen, _EventSource_instances, connect_fn, _onFetchResponse, _onFetchError, getRequestOptions_fn, _onEvent, _onRetryChange, failConnection_fn, scheduleReconnect_fn, _reconnect, EventSource2;
|
|
64538
64550
|
var init_dist5 = __esm({
|
|
64539
|
-
"node_modules/eventsource/dist/index.js"() {
|
|
64551
|
+
"node_modules/@modelcontextprotocol/sdk/node_modules/eventsource/dist/index.js"() {
|
|
64540
64552
|
init_dist4();
|
|
64541
64553
|
ErrorEvent2 = class extends Event {
|
|
64542
64554
|
/**
|
|
@@ -90502,8 +90514,8 @@ async function* createStreamingResponse(options3, abortSignal, onRetry) {
|
|
|
90502
90514
|
tools: convertToolsForResponses(options3.tools),
|
|
90503
90515
|
tool_choice: options3.tool_choice,
|
|
90504
90516
|
parallel_tool_calls: true,
|
|
90505
|
-
// 只有当 reasoning
|
|
90506
|
-
...configuredReasoning && {
|
|
90517
|
+
// 只有当 reasoning 启用且未禁用思考功能时才添加 reasoning 字段
|
|
90518
|
+
...configuredReasoning && !options3.disableThinking && {
|
|
90507
90519
|
reasoning: configuredReasoning
|
|
90508
90520
|
},
|
|
90509
90521
|
store: false,
|
|
@@ -90949,7 +90961,7 @@ async function* createStreamingGeminiCompletion(options3, abortSignal, onRetry)
|
|
|
90949
90961
|
contents,
|
|
90950
90962
|
systemInstruction: systemInstruction ? { parts: systemInstruction.map((text3) => ({ text: text3 })) } : void 0
|
|
90951
90963
|
};
|
|
90952
|
-
if ((_a21 = config4.geminiThinking) == null ? void 0 : _a21.enabled) {
|
|
90964
|
+
if (((_a21 = config4.geminiThinking) == null ? void 0 : _a21.enabled) && !options3.disableThinking) {
|
|
90953
90965
|
requestBody.generationConfig = {
|
|
90954
90966
|
thinkingConfig: {
|
|
90955
90967
|
thinkingBudget: config4.geminiThinking.budget
|
|
@@ -92023,7 +92035,9 @@ var init_codebaseReviewAgent = __esm({
|
|
|
92023
92035
|
model: this.modelName,
|
|
92024
92036
|
messages,
|
|
92025
92037
|
tools: [this.REVIEW_TOOL],
|
|
92026
|
-
includeBuiltinSystemPrompt: false
|
|
92038
|
+
includeBuiltinSystemPrompt: false,
|
|
92039
|
+
disableThinking: true
|
|
92040
|
+
// Agents 不使用思考功能
|
|
92027
92041
|
}, abortSignal);
|
|
92028
92042
|
break;
|
|
92029
92043
|
case "responses":
|
|
@@ -92032,7 +92046,9 @@ var init_codebaseReviewAgent = __esm({
|
|
|
92032
92046
|
messages,
|
|
92033
92047
|
tools: [this.REVIEW_TOOL],
|
|
92034
92048
|
stream: true,
|
|
92035
|
-
includeBuiltinSystemPrompt: false
|
|
92049
|
+
includeBuiltinSystemPrompt: false,
|
|
92050
|
+
disableThinking: true
|
|
92051
|
+
// Agents 不使用思考功能
|
|
92036
92052
|
}, abortSignal);
|
|
92037
92053
|
break;
|
|
92038
92054
|
case "chat":
|
|
@@ -92042,7 +92058,9 @@ var init_codebaseReviewAgent = __esm({
|
|
|
92042
92058
|
messages,
|
|
92043
92059
|
tools: [this.REVIEW_TOOL],
|
|
92044
92060
|
stream: true,
|
|
92045
|
-
includeBuiltinSystemPrompt: false
|
|
92061
|
+
includeBuiltinSystemPrompt: false,
|
|
92062
|
+
disableThinking: true
|
|
92063
|
+
// Agents 不使用思考功能
|
|
92046
92064
|
}, abortSignal);
|
|
92047
92065
|
break;
|
|
92048
92066
|
}
|
|
@@ -92789,8 +92807,10 @@ var init_summaryAgent = __esm({
|
|
|
92789
92807
|
streamGenerator = createStreamingGeminiCompletion({
|
|
92790
92808
|
model: this.modelName,
|
|
92791
92809
|
messages,
|
|
92792
|
-
includeBuiltinSystemPrompt: false
|
|
92810
|
+
includeBuiltinSystemPrompt: false,
|
|
92793
92811
|
// 不需要内置系统提示词
|
|
92812
|
+
disableThinking: true
|
|
92813
|
+
// Agents 不使用思考功能
|
|
92794
92814
|
}, abortSignal);
|
|
92795
92815
|
break;
|
|
92796
92816
|
case "responses":
|
|
@@ -92798,8 +92818,10 @@ var init_summaryAgent = __esm({
|
|
|
92798
92818
|
model: this.modelName,
|
|
92799
92819
|
messages,
|
|
92800
92820
|
stream: true,
|
|
92801
|
-
includeBuiltinSystemPrompt: false
|
|
92821
|
+
includeBuiltinSystemPrompt: false,
|
|
92802
92822
|
// 不需要内置系统提示词
|
|
92823
|
+
disableThinking: true
|
|
92824
|
+
// Agents 不使用思考功能
|
|
92803
92825
|
}, abortSignal);
|
|
92804
92826
|
break;
|
|
92805
92827
|
case "chat":
|
|
@@ -92808,8 +92830,10 @@ var init_summaryAgent = __esm({
|
|
|
92808
92830
|
model: this.modelName,
|
|
92809
92831
|
messages,
|
|
92810
92832
|
stream: true,
|
|
92811
|
-
includeBuiltinSystemPrompt: false
|
|
92833
|
+
includeBuiltinSystemPrompt: false,
|
|
92812
92834
|
// 不需要内置系统提示词
|
|
92835
|
+
disableThinking: true
|
|
92836
|
+
// Agents 不使用思考功能
|
|
92813
92837
|
}, abortSignal);
|
|
92814
92838
|
break;
|
|
92815
92839
|
}
|
|
@@ -354651,8 +354675,10 @@ var init_aceCodeSearch = __esm({
|
|
|
354651
354675
|
}
|
|
354652
354676
|
/**
|
|
354653
354677
|
* Strategy 1: Use git grep for fast searching in Git repositories
|
|
354678
|
+
* Enhanced with timeout protection to prevent hanging
|
|
354654
354679
|
*/
|
|
354655
354680
|
async gitGrepSearch(pattern, fileGlob, maxResults = 100, isRegex = true) {
|
|
354681
|
+
const timeoutMs = 15e3;
|
|
354656
354682
|
return new Promise((resolve12, reject2) => {
|
|
354657
354683
|
const args2 = ["grep", "--untracked", "-n", "--ignore-case"];
|
|
354658
354684
|
if (isRegex) {
|
|
@@ -354662,7 +354688,7 @@ var init_aceCodeSearch = __esm({
|
|
|
354662
354688
|
}
|
|
354663
354689
|
args2.push(pattern);
|
|
354664
354690
|
if (fileGlob) {
|
|
354665
|
-
let gitGlob = fileGlob.replace(
|
|
354691
|
+
let gitGlob = fileGlob.replace(/\\\\/g, "/");
|
|
354666
354692
|
gitGlob = gitGlob.replace(/\*\*/g, "*");
|
|
354667
354693
|
const expandedGlobs = expandGlobBraces(gitGlob);
|
|
354668
354694
|
args2.push("--", ...expandedGlobs);
|
|
@@ -354674,21 +354700,38 @@ var init_aceCodeSearch = __esm({
|
|
|
354674
354700
|
processManager.register(child);
|
|
354675
354701
|
const stdoutChunks = [];
|
|
354676
354702
|
const stderrChunks = [];
|
|
354703
|
+
let isCompleted = false;
|
|
354704
|
+
const timeoutId = setTimeout(() => {
|
|
354705
|
+
if (!isCompleted) {
|
|
354706
|
+
isCompleted = true;
|
|
354707
|
+
child.kill("SIGTERM");
|
|
354708
|
+
logger.warn(`git grep timed out after ${timeoutMs}ms, killing process`);
|
|
354709
|
+
reject2(new Error(`git grep timed out after ${timeoutMs}ms`));
|
|
354710
|
+
}
|
|
354711
|
+
}, timeoutMs);
|
|
354677
354712
|
child.stdout.on("data", (chunk2) => stdoutChunks.push(chunk2));
|
|
354678
354713
|
child.stderr.on("data", (chunk2) => stderrChunks.push(chunk2));
|
|
354679
354714
|
child.on("error", (err) => {
|
|
354680
|
-
|
|
354715
|
+
if (!isCompleted) {
|
|
354716
|
+
isCompleted = true;
|
|
354717
|
+
clearTimeout(timeoutId);
|
|
354718
|
+
reject2(new Error(`Failed to start git grep: ${err.message}`));
|
|
354719
|
+
}
|
|
354681
354720
|
});
|
|
354682
354721
|
child.on("close", (code2) => {
|
|
354683
|
-
|
|
354684
|
-
|
|
354685
|
-
|
|
354686
|
-
const
|
|
354687
|
-
|
|
354688
|
-
|
|
354689
|
-
|
|
354690
|
-
|
|
354691
|
-
|
|
354722
|
+
if (!isCompleted) {
|
|
354723
|
+
isCompleted = true;
|
|
354724
|
+
clearTimeout(timeoutId);
|
|
354725
|
+
const stdoutData = Buffer.concat(stdoutChunks).toString("utf8");
|
|
354726
|
+
const stderrData = Buffer.concat(stderrChunks).toString("utf8").trim();
|
|
354727
|
+
if (code2 === 0) {
|
|
354728
|
+
const results = parseGrepOutput(stdoutData, this.basePath);
|
|
354729
|
+
resolve12(results.slice(0, maxResults));
|
|
354730
|
+
} else if (code2 === 1) {
|
|
354731
|
+
resolve12([]);
|
|
354732
|
+
} else {
|
|
354733
|
+
reject2(new Error(`git grep exited with code ${code2}: ${stderrData}`));
|
|
354734
|
+
}
|
|
354692
354735
|
}
|
|
354693
354736
|
});
|
|
354694
354737
|
});
|
|
@@ -354699,10 +354742,9 @@ var init_aceCodeSearch = __esm({
|
|
|
354699
354742
|
*/
|
|
354700
354743
|
async systemGrepSearch(pattern, fileGlob, maxResults = 100, grepCommand = "grep") {
|
|
354701
354744
|
const isRipgrep = grepCommand === "rg";
|
|
354702
|
-
const
|
|
354703
|
-
const timeoutMs = isWindows4 && isRipgrep ? 1e4 : 15e3;
|
|
354745
|
+
const timeoutMs = 15e3;
|
|
354704
354746
|
return new Promise((resolve12, reject2) => {
|
|
354705
|
-
const args2 = isRipgrep ? ["-n", "-i", "--no-heading"
|
|
354747
|
+
const args2 = isRipgrep ? ["-n", "-i", "--no-heading"] : ["-r", "-n", "-H", "-E", "-i"];
|
|
354706
354748
|
const excludeDirs = [
|
|
354707
354749
|
"node_modules",
|
|
354708
354750
|
".git",
|
|
@@ -354728,11 +354770,12 @@ var init_aceCodeSearch = __esm({
|
|
|
354728
354770
|
const expandedGlobs = expandGlobBraces(normalizedGlob);
|
|
354729
354771
|
expandedGlobs.forEach((glob) => args2.push(`--include=${glob}`));
|
|
354730
354772
|
}
|
|
354731
|
-
args2.push(pattern, ".");
|
|
354732
354773
|
}
|
|
354774
|
+
args2.push(pattern, ".");
|
|
354733
354775
|
const child = spawn4(grepCommand, args2, {
|
|
354734
354776
|
cwd: this.basePath,
|
|
354735
|
-
windowsHide: true
|
|
354777
|
+
windowsHide: true,
|
|
354778
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
354736
354779
|
});
|
|
354737
354780
|
processManager.register(child);
|
|
354738
354781
|
const stdoutChunks = [];
|
|
@@ -354992,21 +355035,20 @@ var init_aceCodeSearch = __esm({
|
|
|
354992
355035
|
} catch (error40) {
|
|
354993
355036
|
}
|
|
354994
355037
|
}
|
|
354995
|
-
|
|
354996
|
-
if (grepAvailable) {
|
|
355038
|
+
if (rgAvailable) {
|
|
354997
355039
|
try {
|
|
354998
|
-
const results2 = await this.systemGrepSearch(pattern, fileGlob, maxResults, "
|
|
355040
|
+
const results2 = await this.systemGrepSearch(pattern, fileGlob, maxResults, "rg");
|
|
354999
355041
|
return await this.sortResultsByRecency(results2);
|
|
355000
355042
|
} catch (error40) {
|
|
355001
|
-
logger.info("
|
|
355043
|
+
logger.info("Ripgrep failed, trying next strategy");
|
|
355002
355044
|
}
|
|
355003
355045
|
}
|
|
355004
|
-
if (
|
|
355046
|
+
if (grepAvailable) {
|
|
355005
355047
|
try {
|
|
355006
|
-
const results2 = await this.systemGrepSearch(pattern, fileGlob, maxResults, "
|
|
355048
|
+
const results2 = await this.systemGrepSearch(pattern, fileGlob, maxResults, "grep");
|
|
355007
355049
|
return await this.sortResultsByRecency(results2);
|
|
355008
355050
|
} catch (error40) {
|
|
355009
|
-
logger.info("
|
|
355051
|
+
logger.info("System grep failed, falling back to JavaScript search");
|
|
355010
355052
|
}
|
|
355011
355053
|
}
|
|
355012
355054
|
logger.info("Using JavaScript fallback for text search");
|
|
@@ -426786,8 +426828,10 @@ var init_compactAgent = __esm({
|
|
|
426786
426828
|
streamGenerator = createStreamingGeminiCompletion({
|
|
426787
426829
|
model: this.modelName,
|
|
426788
426830
|
messages,
|
|
426789
|
-
includeBuiltinSystemPrompt: false
|
|
426831
|
+
includeBuiltinSystemPrompt: false,
|
|
426790
426832
|
// 不需要内置系统提示词
|
|
426833
|
+
disableThinking: true
|
|
426834
|
+
// Agents 不使用思考功能
|
|
426791
426835
|
}, abortSignal);
|
|
426792
426836
|
break;
|
|
426793
426837
|
case "responses":
|
|
@@ -426795,8 +426839,10 @@ var init_compactAgent = __esm({
|
|
|
426795
426839
|
model: this.modelName,
|
|
426796
426840
|
messages,
|
|
426797
426841
|
stream: true,
|
|
426798
|
-
includeBuiltinSystemPrompt: false
|
|
426842
|
+
includeBuiltinSystemPrompt: false,
|
|
426799
426843
|
// 不需要内置系统提示词
|
|
426844
|
+
disableThinking: true
|
|
426845
|
+
// Agents 不使用思考功能
|
|
426800
426846
|
}, abortSignal);
|
|
426801
426847
|
break;
|
|
426802
426848
|
case "chat":
|
|
@@ -426805,8 +426851,10 @@ var init_compactAgent = __esm({
|
|
|
426805
426851
|
model: this.modelName,
|
|
426806
426852
|
messages,
|
|
426807
426853
|
stream: true,
|
|
426808
|
-
includeBuiltinSystemPrompt: false
|
|
426854
|
+
includeBuiltinSystemPrompt: false,
|
|
426809
426855
|
// 不需要内置系统提示词
|
|
426856
|
+
disableThinking: true
|
|
426857
|
+
// Agents 不使用思考功能
|
|
426810
426858
|
}, abortSignal);
|
|
426811
426859
|
break;
|
|
426812
426860
|
}
|
|
@@ -443392,7 +443440,7 @@ var init_LSPServerRegistry = __esm({
|
|
|
443392
443440
|
}
|
|
443393
443441
|
try {
|
|
443394
443442
|
const { command } = config4;
|
|
443395
|
-
const testCommand = process.platform === "win32" ? `where ${command}` : `which ${command}`;
|
|
443443
|
+
const testCommand = process.platform === "win32" ? `where.exe ${command}` : `which ${command}`;
|
|
443396
443444
|
await execAsync(testCommand);
|
|
443397
443445
|
this.installedServers.set(language, true);
|
|
443398
443446
|
return true;
|
|
@@ -461979,7 +462027,7 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
461979
462027
|
setManualInputValue("");
|
|
461980
462028
|
} else if (key.backspace || key.delete) {
|
|
461981
462029
|
setManualInputValue((prev) => prev.slice(0, -1));
|
|
461982
|
-
} else if (input2
|
|
462030
|
+
} else if (input2) {
|
|
461983
462031
|
setManualInputValue((prev) => prev + stripFocusArtifacts(input2));
|
|
461984
462032
|
}
|
|
461985
462033
|
return;
|
|
@@ -569776,7 +569824,7 @@ var init_ModelsPanel = __esm({
|
|
|
569776
569824
|
setManualInputValue((prev) => prev.slice(0, -1));
|
|
569777
569825
|
return;
|
|
569778
569826
|
}
|
|
569779
|
-
if (input2
|
|
569827
|
+
if (input2) {
|
|
569780
569828
|
setManualInputValue((prev) => prev + input2);
|
|
569781
569829
|
}
|
|
569782
569830
|
return;
|
|
@@ -573508,7 +573556,13 @@ ${injectedSummary}`
|
|
|
573508
573556
|
if (onUserInteractionNeeded) {
|
|
573509
573557
|
const response = await onUserInteractionNeeded(error40.question, error40.options, error40.multiSelect);
|
|
573510
573558
|
if (response.cancelled) {
|
|
573511
|
-
|
|
573559
|
+
result2 = {
|
|
573560
|
+
tool_call_id: toolCall.id,
|
|
573561
|
+
role: "tool",
|
|
573562
|
+
content: "Error: User cancelled the question interaction",
|
|
573563
|
+
messageStatus: "error"
|
|
573564
|
+
};
|
|
573565
|
+
return result2;
|
|
573512
573566
|
}
|
|
573513
573567
|
const answerText = response.customInput ? `${Array.isArray(response.selected) ? response.selected.join(", ") : response.selected}: ${response.customInput}` : Array.isArray(response.selected) ? response.selected.join(", ") : response.selected;
|
|
573514
573568
|
result2 = {
|
|
@@ -579263,6 +579317,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579263
579317
|
init_embedding();
|
|
579264
579318
|
init_codebaseConfig();
|
|
579265
579319
|
init_retryUtils();
|
|
579320
|
+
init_office_parser_utils();
|
|
579266
579321
|
CodebaseIndexAgent = class _CodebaseIndexAgent {
|
|
579267
579322
|
constructor(projectRoot) {
|
|
579268
579323
|
Object.defineProperty(this, "db", {
|
|
@@ -579538,8 +579593,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579538
579593
|
persistent: true
|
|
579539
579594
|
});
|
|
579540
579595
|
this.fileWatcher.on("add", (filePath) => {
|
|
579541
|
-
const ext = path55.extname(filePath);
|
|
579542
|
-
if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
|
|
579596
|
+
const ext = path55.extname(filePath).toLowerCase();
|
|
579597
|
+
if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) && !_CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
|
|
579543
579598
|
return;
|
|
579544
579599
|
}
|
|
579545
579600
|
const relativePath = path55.relative(this.projectRoot, filePath);
|
|
@@ -579547,8 +579602,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579547
579602
|
this.debounceFileChange(filePath, relativePath);
|
|
579548
579603
|
});
|
|
579549
579604
|
this.fileWatcher.on("change", (filePath) => {
|
|
579550
|
-
const ext = path55.extname(filePath);
|
|
579551
|
-
if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
|
|
579605
|
+
const ext = path55.extname(filePath).toLowerCase();
|
|
579606
|
+
if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) && !_CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
|
|
579552
579607
|
return;
|
|
579553
579608
|
}
|
|
579554
579609
|
const relativePath = path55.relative(this.projectRoot, filePath);
|
|
@@ -579556,8 +579611,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579556
579611
|
this.debounceFileChange(filePath, relativePath);
|
|
579557
579612
|
});
|
|
579558
579613
|
this.fileWatcher.on("unlink", (filePath) => {
|
|
579559
|
-
const ext = path55.extname(filePath);
|
|
579560
|
-
if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
|
|
579614
|
+
const ext = path55.extname(filePath).toLowerCase();
|
|
579615
|
+
if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) && !_CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
|
|
579561
579616
|
return;
|
|
579562
579617
|
}
|
|
579563
579618
|
const relativePath = path55.relative(this.projectRoot, filePath);
|
|
@@ -579692,7 +579747,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579692
579747
|
scanDir(fullPath);
|
|
579693
579748
|
} else if (entry.isFile()) {
|
|
579694
579749
|
const ext = path55.extname(entry.name);
|
|
579695
|
-
if (_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
|
|
579750
|
+
if (_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) || _CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
|
|
579696
579751
|
files.push(fullPath);
|
|
579697
579752
|
}
|
|
579698
579753
|
}
|
|
@@ -579733,14 +579788,28 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579733
579788
|
currentFile: relativePath,
|
|
579734
579789
|
status: "indexing"
|
|
579735
579790
|
});
|
|
579736
|
-
const
|
|
579737
|
-
const
|
|
579791
|
+
const ext = path55.extname(filePath).toLowerCase();
|
|
579792
|
+
const isOfficeFile = _CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext);
|
|
579793
|
+
let content;
|
|
579794
|
+
let fileHash;
|
|
579795
|
+
if (isOfficeFile) {
|
|
579796
|
+
const docContent = await readOfficeDocument(filePath);
|
|
579797
|
+
if (!docContent) {
|
|
579798
|
+
logger.warn(`Failed to parse Office document: ${relativePath}`);
|
|
579799
|
+
return;
|
|
579800
|
+
}
|
|
579801
|
+
content = docContent.text;
|
|
579802
|
+
fileHash = crypto6.createHash("sha256").update(content).digest("hex");
|
|
579803
|
+
} else {
|
|
579804
|
+
content = fs49.readFileSync(filePath, "utf-8");
|
|
579805
|
+
fileHash = crypto6.createHash("sha256").update(content).digest("hex");
|
|
579806
|
+
}
|
|
579738
579807
|
if (this.db.hasFileHash(fileHash)) {
|
|
579739
579808
|
logger.debug(`File unchanged, skipping: ${relativePath}`);
|
|
579740
579809
|
return;
|
|
579741
579810
|
}
|
|
579742
579811
|
this.db.deleteChunksByFile(relativePath);
|
|
579743
|
-
const chunks = this.splitIntoChunks(content, relativePath);
|
|
579812
|
+
const chunks = isOfficeFile ? this.splitDocumentIntoChunks(content, relativePath) : this.splitIntoChunks(content, relativePath);
|
|
579744
579813
|
if (chunks.length === 0) {
|
|
579745
579814
|
logger.debug(`No chunks generated for: ${relativePath}`);
|
|
579746
579815
|
return;
|
|
@@ -579855,6 +579924,73 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579855
579924
|
}
|
|
579856
579925
|
return chunks;
|
|
579857
579926
|
}
|
|
579927
|
+
/**
|
|
579928
|
+
* Split document content into chunks based on semantic boundaries
|
|
579929
|
+
* Documents (PDF, Word, etc.) need different chunking than code files
|
|
579930
|
+
* - Uses paragraph boundaries instead of fixed line counts
|
|
579931
|
+
* - Respects heading structures
|
|
579932
|
+
* - Maintains semantic coherence
|
|
579933
|
+
*/
|
|
579934
|
+
splitDocumentIntoChunks(content, filePath) {
|
|
579935
|
+
const chunks = [];
|
|
579936
|
+
const MAX_CHUNK_CHARS = 3e3;
|
|
579937
|
+
const MIN_CHUNK_CHARS = 200;
|
|
579938
|
+
const paragraphs = content.split(/\n{2,}/).map((p) => p.trim()).filter((p) => p.length > 0);
|
|
579939
|
+
if (paragraphs.length === 0) {
|
|
579940
|
+
return chunks;
|
|
579941
|
+
}
|
|
579942
|
+
let currentChunk = [];
|
|
579943
|
+
let currentCharCount = 0;
|
|
579944
|
+
let startParagraph = 0;
|
|
579945
|
+
for (let i = 0; i < paragraphs.length; i++) {
|
|
579946
|
+
const paragraph3 = paragraphs[i];
|
|
579947
|
+
const paraLength = paragraph3.length;
|
|
579948
|
+
if (currentCharCount + paraLength > MAX_CHUNK_CHARS && currentChunk.length > 0) {
|
|
579949
|
+
const chunkContent = currentChunk.join("\n\n");
|
|
579950
|
+
if (chunkContent.length >= MIN_CHUNK_CHARS) {
|
|
579951
|
+
chunks.push({
|
|
579952
|
+
filePath,
|
|
579953
|
+
content: chunkContent,
|
|
579954
|
+
startLine: startParagraph + 1,
|
|
579955
|
+
// Use paragraph index (1-based)
|
|
579956
|
+
endLine: i,
|
|
579957
|
+
// End paragraph index
|
|
579958
|
+
embedding: [],
|
|
579959
|
+
fileHash: "",
|
|
579960
|
+
createdAt: 0,
|
|
579961
|
+
updatedAt: 0
|
|
579962
|
+
});
|
|
579963
|
+
}
|
|
579964
|
+
const overlapStart = Math.max(0, currentChunk.length - 1);
|
|
579965
|
+
currentChunk = currentChunk.slice(overlapStart);
|
|
579966
|
+
currentCharCount = currentChunk.reduce((sum, p) => sum + p.length, 0);
|
|
579967
|
+
startParagraph = i - currentChunk.length;
|
|
579968
|
+
}
|
|
579969
|
+
currentChunk.push(paragraph3);
|
|
579970
|
+
currentCharCount += paraLength;
|
|
579971
|
+
}
|
|
579972
|
+
if (currentChunk.length > 0) {
|
|
579973
|
+
const chunkContent = currentChunk.join("\n\n");
|
|
579974
|
+
if (chunkContent.length >= MIN_CHUNK_CHARS) {
|
|
579975
|
+
chunks.push({
|
|
579976
|
+
filePath,
|
|
579977
|
+
content: chunkContent,
|
|
579978
|
+
startLine: startParagraph + 1,
|
|
579979
|
+
endLine: paragraphs.length,
|
|
579980
|
+
embedding: [],
|
|
579981
|
+
fileHash: "",
|
|
579982
|
+
createdAt: 0,
|
|
579983
|
+
updatedAt: 0
|
|
579984
|
+
});
|
|
579985
|
+
} else if (chunks.length > 0) {
|
|
579986
|
+
const lastChunk = chunks[chunks.length - 1];
|
|
579987
|
+
lastChunk.content += "\n\n" + chunkContent;
|
|
579988
|
+
lastChunk.endLine = paragraphs.length;
|
|
579989
|
+
}
|
|
579990
|
+
}
|
|
579991
|
+
logger.debug(`Document split into ${chunks.length} semantic chunks for: ${filePath}`);
|
|
579992
|
+
return chunks;
|
|
579993
|
+
}
|
|
579858
579994
|
/**
|
|
579859
579995
|
* Notify progress to callback
|
|
579860
579996
|
*/
|
|
@@ -579893,6 +580029,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579893
580029
|
".sh",
|
|
579894
580030
|
".bash",
|
|
579895
580031
|
".sql",
|
|
580032
|
+
".txt",
|
|
579896
580033
|
".graphql",
|
|
579897
580034
|
".proto",
|
|
579898
580035
|
".json",
|
|
@@ -579908,6 +580045,20 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579908
580045
|
".svelte"
|
|
579909
580046
|
])
|
|
579910
580047
|
});
|
|
580048
|
+
Object.defineProperty(CodebaseIndexAgent, "OFFICE_EXTENSIONS", {
|
|
580049
|
+
enumerable: true,
|
|
580050
|
+
configurable: true,
|
|
580051
|
+
writable: true,
|
|
580052
|
+
value: /* @__PURE__ */ new Set([
|
|
580053
|
+
".pdf",
|
|
580054
|
+
".docx",
|
|
580055
|
+
".doc",
|
|
580056
|
+
".xlsx",
|
|
580057
|
+
".xls",
|
|
580058
|
+
".pptx",
|
|
580059
|
+
".ppt"
|
|
580060
|
+
])
|
|
580061
|
+
});
|
|
579911
580062
|
}
|
|
579912
580063
|
});
|
|
579913
580064
|
|
|
@@ -580212,7 +580363,6 @@ function useChatLogic(props) {
|
|
|
580212
580363
|
if (streamingState.abortController) {
|
|
580213
580364
|
streamingState.abortController.abort();
|
|
580214
580365
|
}
|
|
580215
|
-
setMessages((prev) => prev.filter((msg) => !msg.toolPending));
|
|
580216
580366
|
setPendingMessages([]);
|
|
580217
580367
|
return;
|
|
580218
580368
|
}
|
|
@@ -599788,7 +599938,7 @@ var require_package3 = __commonJS({
|
|
|
599788
599938
|
"package.json"(exports2, module2) {
|
|
599789
599939
|
module2.exports = {
|
|
599790
599940
|
name: "snow-ai",
|
|
599791
|
-
version: "0.6.
|
|
599941
|
+
version: "0.6.53",
|
|
599792
599942
|
description: "Agentic coding in your terminal",
|
|
599793
599943
|
license: "MIT",
|
|
599794
599944
|
bin: {
|
|
@@ -599835,13 +599985,18 @@ var require_package3 = __commonJS({
|
|
|
599835
599985
|
"scripts"
|
|
599836
599986
|
],
|
|
599837
599987
|
dependencies: {
|
|
599988
|
+
"@microsoft/signalr": "^10.0.0",
|
|
599989
|
+
"abort-controller": "^3.0.0",
|
|
599990
|
+
eventsource: "^2.0.2",
|
|
599991
|
+
"fetch-cookie": "^3.0.1",
|
|
599992
|
+
"node-fetch": "^2.7.0",
|
|
599838
599993
|
ssh2: "^1.17.0",
|
|
599994
|
+
"tough-cookie": "^4.1.3",
|
|
599839
599995
|
ws: "^8.14.2"
|
|
599840
599996
|
},
|
|
599841
599997
|
devDependencies: {
|
|
599842
599998
|
"@agentclientprotocol/sdk": "^0.14.1",
|
|
599843
599999
|
"@inkjs/ui": "^2.0.0",
|
|
599844
|
-
"@microsoft/signalr": "^10.0.0",
|
|
599845
600000
|
"@modelcontextprotocol/sdk": "^1.17.3",
|
|
599846
600001
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
599847
600002
|
"@types/diff": "^7.0.2",
|
package/bundle/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-ai",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.53",
|
|
4
4
|
"description": "Agentic coding in your terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -47,13 +47,18 @@
|
|
|
47
47
|
"scripts"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@microsoft/signalr": "^10.0.0",
|
|
51
|
+
"abort-controller": "^3.0.0",
|
|
52
|
+
"eventsource": "^2.0.2",
|
|
53
|
+
"fetch-cookie": "^3.0.1",
|
|
54
|
+
"node-fetch": "^2.7.0",
|
|
50
55
|
"ssh2": "^1.17.0",
|
|
56
|
+
"tough-cookie": "^4.1.3",
|
|
51
57
|
"ws": "^8.14.2"
|
|
52
58
|
},
|
|
53
59
|
"devDependencies": {
|
|
54
60
|
"@agentclientprotocol/sdk": "^0.14.1",
|
|
55
61
|
"@inkjs/ui": "^2.0.0",
|
|
56
|
-
"@microsoft/signalr": "^10.0.0",
|
|
57
62
|
"@modelcontextprotocol/sdk": "^1.17.3",
|
|
58
63
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
59
64
|
"@types/diff": "^7.0.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-ai",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.53",
|
|
4
4
|
"description": "Agentic coding in your terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -47,13 +47,18 @@
|
|
|
47
47
|
"scripts"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@microsoft/signalr": "^10.0.0",
|
|
51
|
+
"abort-controller": "^3.0.0",
|
|
52
|
+
"eventsource": "^2.0.2",
|
|
53
|
+
"fetch-cookie": "^3.0.1",
|
|
54
|
+
"node-fetch": "^2.7.0",
|
|
50
55
|
"ssh2": "^1.17.0",
|
|
56
|
+
"tough-cookie": "^4.1.3",
|
|
51
57
|
"ws": "^8.14.2"
|
|
52
58
|
},
|
|
53
59
|
"devDependencies": {
|
|
54
60
|
"@agentclientprotocol/sdk": "^0.14.1",
|
|
55
61
|
"@inkjs/ui": "^2.0.0",
|
|
56
|
-
"@microsoft/signalr": "^10.0.0",
|
|
57
62
|
"@modelcontextprotocol/sdk": "^1.17.3",
|
|
58
63
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
59
64
|
"@types/diff": "^7.0.2",
|