snow-ai 0.6.52 → 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 +128 -14
- 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
|
/**
|
|
@@ -579305,6 +579317,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579305
579317
|
init_embedding();
|
|
579306
579318
|
init_codebaseConfig();
|
|
579307
579319
|
init_retryUtils();
|
|
579320
|
+
init_office_parser_utils();
|
|
579308
579321
|
CodebaseIndexAgent = class _CodebaseIndexAgent {
|
|
579309
579322
|
constructor(projectRoot) {
|
|
579310
579323
|
Object.defineProperty(this, "db", {
|
|
@@ -579580,8 +579593,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579580
579593
|
persistent: true
|
|
579581
579594
|
});
|
|
579582
579595
|
this.fileWatcher.on("add", (filePath) => {
|
|
579583
|
-
const ext = path55.extname(filePath);
|
|
579584
|
-
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)) {
|
|
579585
579598
|
return;
|
|
579586
579599
|
}
|
|
579587
579600
|
const relativePath = path55.relative(this.projectRoot, filePath);
|
|
@@ -579589,8 +579602,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579589
579602
|
this.debounceFileChange(filePath, relativePath);
|
|
579590
579603
|
});
|
|
579591
579604
|
this.fileWatcher.on("change", (filePath) => {
|
|
579592
|
-
const ext = path55.extname(filePath);
|
|
579593
|
-
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)) {
|
|
579594
579607
|
return;
|
|
579595
579608
|
}
|
|
579596
579609
|
const relativePath = path55.relative(this.projectRoot, filePath);
|
|
@@ -579598,8 +579611,8 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579598
579611
|
this.debounceFileChange(filePath, relativePath);
|
|
579599
579612
|
});
|
|
579600
579613
|
this.fileWatcher.on("unlink", (filePath) => {
|
|
579601
|
-
const ext = path55.extname(filePath);
|
|
579602
|
-
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)) {
|
|
579603
579616
|
return;
|
|
579604
579617
|
}
|
|
579605
579618
|
const relativePath = path55.relative(this.projectRoot, filePath);
|
|
@@ -579734,7 +579747,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579734
579747
|
scanDir(fullPath);
|
|
579735
579748
|
} else if (entry.isFile()) {
|
|
579736
579749
|
const ext = path55.extname(entry.name);
|
|
579737
|
-
if (_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
|
|
579750
|
+
if (_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) || _CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
|
|
579738
579751
|
files.push(fullPath);
|
|
579739
579752
|
}
|
|
579740
579753
|
}
|
|
@@ -579775,14 +579788,28 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579775
579788
|
currentFile: relativePath,
|
|
579776
579789
|
status: "indexing"
|
|
579777
579790
|
});
|
|
579778
|
-
const
|
|
579779
|
-
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
|
+
}
|
|
579780
579807
|
if (this.db.hasFileHash(fileHash)) {
|
|
579781
579808
|
logger.debug(`File unchanged, skipping: ${relativePath}`);
|
|
579782
579809
|
return;
|
|
579783
579810
|
}
|
|
579784
579811
|
this.db.deleteChunksByFile(relativePath);
|
|
579785
|
-
const chunks = this.splitIntoChunks(content, relativePath);
|
|
579812
|
+
const chunks = isOfficeFile ? this.splitDocumentIntoChunks(content, relativePath) : this.splitIntoChunks(content, relativePath);
|
|
579786
579813
|
if (chunks.length === 0) {
|
|
579787
579814
|
logger.debug(`No chunks generated for: ${relativePath}`);
|
|
579788
579815
|
return;
|
|
@@ -579897,6 +579924,73 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579897
579924
|
}
|
|
579898
579925
|
return chunks;
|
|
579899
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
|
+
}
|
|
579900
579994
|
/**
|
|
579901
579995
|
* Notify progress to callback
|
|
579902
579996
|
*/
|
|
@@ -579935,6 +580029,7 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579935
580029
|
".sh",
|
|
579936
580030
|
".bash",
|
|
579937
580031
|
".sql",
|
|
580032
|
+
".txt",
|
|
579938
580033
|
".graphql",
|
|
579939
580034
|
".proto",
|
|
579940
580035
|
".json",
|
|
@@ -579950,6 +580045,20 @@ var init_codebaseIndexAgent = __esm({
|
|
|
579950
580045
|
".svelte"
|
|
579951
580046
|
])
|
|
579952
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
|
+
});
|
|
579953
580062
|
}
|
|
579954
580063
|
});
|
|
579955
580064
|
|
|
@@ -599829,7 +599938,7 @@ var require_package3 = __commonJS({
|
|
|
599829
599938
|
"package.json"(exports2, module2) {
|
|
599830
599939
|
module2.exports = {
|
|
599831
599940
|
name: "snow-ai",
|
|
599832
|
-
version: "0.6.
|
|
599941
|
+
version: "0.6.53",
|
|
599833
599942
|
description: "Agentic coding in your terminal",
|
|
599834
599943
|
license: "MIT",
|
|
599835
599944
|
bin: {
|
|
@@ -599876,13 +599985,18 @@ var require_package3 = __commonJS({
|
|
|
599876
599985
|
"scripts"
|
|
599877
599986
|
],
|
|
599878
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",
|
|
599879
599993
|
ssh2: "^1.17.0",
|
|
599994
|
+
"tough-cookie": "^4.1.3",
|
|
599880
599995
|
ws: "^8.14.2"
|
|
599881
599996
|
},
|
|
599882
599997
|
devDependencies: {
|
|
599883
599998
|
"@agentclientprotocol/sdk": "^0.14.1",
|
|
599884
599999
|
"@inkjs/ui": "^2.0.0",
|
|
599885
|
-
"@microsoft/signalr": "^10.0.0",
|
|
599886
600000
|
"@modelcontextprotocol/sdk": "^1.17.3",
|
|
599887
600001
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
599888
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",
|