snow-ai 0.6.52 → 0.6.54

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 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
  /**
@@ -566909,15 +566921,11 @@ function BashCommandExecutionStatus({ command, timeout: timeout2 = 3e4, terminal
566909
566921
  const totalCommittedLineCountRef = (0, import_react115.useRef)(0);
566910
566922
  const lastSeenInputLineCountRef = (0, import_react115.useRef)(0);
566911
566923
  const pendingLinesRef = (0, import_react115.useRef)([]);
566912
- const flushTimerRef = (0, import_react115.useRef)(null);
566924
+ const flushIntervalRef = (0, import_react115.useRef)(null);
566913
566925
  (0, import_react115.useEffect)(() => {
566914
566926
  lastSeenInputLineCountRef.current = 0;
566915
566927
  totalCommittedLineCountRef.current = 0;
566916
566928
  pendingLinesRef.current = [];
566917
- if (flushTimerRef.current) {
566918
- clearTimeout(flushTimerRef.current);
566919
- flushTimerRef.current = null;
566920
- }
566921
566929
  setDisplayOutputLines([]);
566922
566930
  }, [command]);
566923
566931
  (0, import_react115.useEffect)(() => {
@@ -566929,36 +566937,22 @@ function BashCommandExecutionStatus({ command, timeout: timeout2 = 3e4, terminal
566929
566937
  const newLines = incomingLines.slice(prevCount);
566930
566938
  lastSeenInputLineCountRef.current = incomingLines.length;
566931
566939
  pendingLinesRef.current.push(...newLines);
566932
- const fullBatchCount = pendingLinesRef.current.length - pendingLinesRef.current.length % 5;
566933
- if (fullBatchCount > 0) {
566934
- const toCommit = pendingLinesRef.current.splice(0, fullBatchCount);
566935
- totalCommittedLineCountRef.current += toCommit.length;
566936
- setDisplayOutputLines((prev) => {
566937
- const next = [...prev, ...toCommit];
566938
- return next.length > maxStoredOutputLines ? next.slice(-maxStoredOutputLines) : next;
566939
- });
566940
- }
566941
- if (flushTimerRef.current) {
566942
- clearTimeout(flushTimerRef.current);
566943
- }
566944
- flushTimerRef.current = setTimeout(() => {
566945
- flushTimerRef.current = null;
566940
+ }, [output2]);
566941
+ (0, import_react115.useEffect)(() => {
566942
+ flushIntervalRef.current = setInterval(() => {
566946
566943
  if (pendingLinesRef.current.length === 0) {
566947
566944
  return;
566948
566945
  }
566949
- const remainder = pendingLinesRef.current.splice(0, pendingLinesRef.current.length);
566950
- totalCommittedLineCountRef.current += remainder.length;
566946
+ const toCommit = pendingLinesRef.current.splice(0, pendingLinesRef.current.length);
566947
+ totalCommittedLineCountRef.current += toCommit.length;
566951
566948
  setDisplayOutputLines((prev) => {
566952
- const next = [...prev, ...remainder];
566949
+ const next = [...prev, ...toCommit];
566953
566950
  return next.length > maxStoredOutputLines ? next.slice(-maxStoredOutputLines) : next;
566954
566951
  });
566955
- }, 150);
566956
- }, [output2]);
566957
- (0, import_react115.useEffect)(() => {
566952
+ }, 200);
566958
566953
  return () => {
566959
- if (flushTimerRef.current) {
566960
- clearTimeout(flushTimerRef.current);
566961
- flushTimerRef.current = null;
566954
+ if (flushIntervalRef.current) {
566955
+ clearInterval(flushIntervalRef.current);
566962
566956
  }
566963
566957
  };
566964
566958
  }, []);
@@ -579305,6 +579299,7 @@ var init_codebaseIndexAgent = __esm({
579305
579299
  init_embedding();
579306
579300
  init_codebaseConfig();
579307
579301
  init_retryUtils();
579302
+ init_office_parser_utils();
579308
579303
  CodebaseIndexAgent = class _CodebaseIndexAgent {
579309
579304
  constructor(projectRoot) {
579310
579305
  Object.defineProperty(this, "db", {
@@ -579580,8 +579575,8 @@ var init_codebaseIndexAgent = __esm({
579580
579575
  persistent: true
579581
579576
  });
579582
579577
  this.fileWatcher.on("add", (filePath) => {
579583
- const ext = path55.extname(filePath);
579584
- if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
579578
+ const ext = path55.extname(filePath).toLowerCase();
579579
+ if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) && !_CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
579585
579580
  return;
579586
579581
  }
579587
579582
  const relativePath = path55.relative(this.projectRoot, filePath);
@@ -579589,8 +579584,8 @@ var init_codebaseIndexAgent = __esm({
579589
579584
  this.debounceFileChange(filePath, relativePath);
579590
579585
  });
579591
579586
  this.fileWatcher.on("change", (filePath) => {
579592
- const ext = path55.extname(filePath);
579593
- if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
579587
+ const ext = path55.extname(filePath).toLowerCase();
579588
+ if (!_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) && !_CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
579594
579589
  return;
579595
579590
  }
579596
579591
  const relativePath = path55.relative(this.projectRoot, filePath);
@@ -579598,8 +579593,8 @@ var init_codebaseIndexAgent = __esm({
579598
579593
  this.debounceFileChange(filePath, relativePath);
579599
579594
  });
579600
579595
  this.fileWatcher.on("unlink", (filePath) => {
579601
- const ext = path55.extname(filePath);
579602
- 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)) {
579603
579598
  return;
579604
579599
  }
579605
579600
  const relativePath = path55.relative(this.projectRoot, filePath);
@@ -579734,7 +579729,7 @@ var init_codebaseIndexAgent = __esm({
579734
579729
  scanDir(fullPath);
579735
579730
  } else if (entry.isFile()) {
579736
579731
  const ext = path55.extname(entry.name);
579737
- if (_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext)) {
579732
+ if (_CodebaseIndexAgent.CODE_EXTENSIONS.has(ext) || _CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext)) {
579738
579733
  files.push(fullPath);
579739
579734
  }
579740
579735
  }
@@ -579775,14 +579770,28 @@ var init_codebaseIndexAgent = __esm({
579775
579770
  currentFile: relativePath,
579776
579771
  status: "indexing"
579777
579772
  });
579778
- const content = fs49.readFileSync(filePath, "utf-8");
579779
- const fileHash = crypto6.createHash("sha256").update(content).digest("hex");
579773
+ const ext = path55.extname(filePath).toLowerCase();
579774
+ const isOfficeFile = _CodebaseIndexAgent.OFFICE_EXTENSIONS.has(ext);
579775
+ let content;
579776
+ let fileHash;
579777
+ if (isOfficeFile) {
579778
+ const docContent = await readOfficeDocument(filePath);
579779
+ if (!docContent) {
579780
+ logger.warn(`Failed to parse Office document: ${relativePath}`);
579781
+ return;
579782
+ }
579783
+ content = docContent.text;
579784
+ fileHash = crypto6.createHash("sha256").update(content).digest("hex");
579785
+ } else {
579786
+ content = fs49.readFileSync(filePath, "utf-8");
579787
+ fileHash = crypto6.createHash("sha256").update(content).digest("hex");
579788
+ }
579780
579789
  if (this.db.hasFileHash(fileHash)) {
579781
579790
  logger.debug(`File unchanged, skipping: ${relativePath}`);
579782
579791
  return;
579783
579792
  }
579784
579793
  this.db.deleteChunksByFile(relativePath);
579785
- const chunks = this.splitIntoChunks(content, relativePath);
579794
+ const chunks = isOfficeFile ? this.splitDocumentIntoChunks(content, relativePath) : this.splitIntoChunks(content, relativePath);
579786
579795
  if (chunks.length === 0) {
579787
579796
  logger.debug(`No chunks generated for: ${relativePath}`);
579788
579797
  return;
@@ -579897,6 +579906,73 @@ var init_codebaseIndexAgent = __esm({
579897
579906
  }
579898
579907
  return chunks;
579899
579908
  }
579909
+ /**
579910
+ * Split document content into chunks based on semantic boundaries
579911
+ * Documents (PDF, Word, etc.) need different chunking than code files
579912
+ * - Uses paragraph boundaries instead of fixed line counts
579913
+ * - Respects heading structures
579914
+ * - Maintains semantic coherence
579915
+ */
579916
+ splitDocumentIntoChunks(content, filePath) {
579917
+ const chunks = [];
579918
+ const MAX_CHUNK_CHARS = 3e3;
579919
+ const MIN_CHUNK_CHARS = 200;
579920
+ const paragraphs = content.split(/\n{2,}/).map((p) => p.trim()).filter((p) => p.length > 0);
579921
+ if (paragraphs.length === 0) {
579922
+ return chunks;
579923
+ }
579924
+ let currentChunk = [];
579925
+ let currentCharCount = 0;
579926
+ let startParagraph = 0;
579927
+ for (let i = 0; i < paragraphs.length; i++) {
579928
+ const paragraph3 = paragraphs[i];
579929
+ const paraLength = paragraph3.length;
579930
+ if (currentCharCount + paraLength > MAX_CHUNK_CHARS && currentChunk.length > 0) {
579931
+ const chunkContent = currentChunk.join("\n\n");
579932
+ if (chunkContent.length >= MIN_CHUNK_CHARS) {
579933
+ chunks.push({
579934
+ filePath,
579935
+ content: chunkContent,
579936
+ startLine: startParagraph + 1,
579937
+ // Use paragraph index (1-based)
579938
+ endLine: i,
579939
+ // End paragraph index
579940
+ embedding: [],
579941
+ fileHash: "",
579942
+ createdAt: 0,
579943
+ updatedAt: 0
579944
+ });
579945
+ }
579946
+ const overlapStart = Math.max(0, currentChunk.length - 1);
579947
+ currentChunk = currentChunk.slice(overlapStart);
579948
+ currentCharCount = currentChunk.reduce((sum, p) => sum + p.length, 0);
579949
+ startParagraph = i - currentChunk.length;
579950
+ }
579951
+ currentChunk.push(paragraph3);
579952
+ currentCharCount += paraLength;
579953
+ }
579954
+ if (currentChunk.length > 0) {
579955
+ const chunkContent = currentChunk.join("\n\n");
579956
+ if (chunkContent.length >= MIN_CHUNK_CHARS) {
579957
+ chunks.push({
579958
+ filePath,
579959
+ content: chunkContent,
579960
+ startLine: startParagraph + 1,
579961
+ endLine: paragraphs.length,
579962
+ embedding: [],
579963
+ fileHash: "",
579964
+ createdAt: 0,
579965
+ updatedAt: 0
579966
+ });
579967
+ } else if (chunks.length > 0) {
579968
+ const lastChunk = chunks[chunks.length - 1];
579969
+ lastChunk.content += "\n\n" + chunkContent;
579970
+ lastChunk.endLine = paragraphs.length;
579971
+ }
579972
+ }
579973
+ logger.debug(`Document split into ${chunks.length} semantic chunks for: ${filePath}`);
579974
+ return chunks;
579975
+ }
579900
579976
  /**
579901
579977
  * Notify progress to callback
579902
579978
  */
@@ -579935,6 +580011,7 @@ var init_codebaseIndexAgent = __esm({
579935
580011
  ".sh",
579936
580012
  ".bash",
579937
580013
  ".sql",
580014
+ ".txt",
579938
580015
  ".graphql",
579939
580016
  ".proto",
579940
580017
  ".json",
@@ -579950,6 +580027,20 @@ var init_codebaseIndexAgent = __esm({
579950
580027
  ".svelte"
579951
580028
  ])
579952
580029
  });
580030
+ Object.defineProperty(CodebaseIndexAgent, "OFFICE_EXTENSIONS", {
580031
+ enumerable: true,
580032
+ configurable: true,
580033
+ writable: true,
580034
+ value: /* @__PURE__ */ new Set([
580035
+ ".pdf",
580036
+ ".docx",
580037
+ ".doc",
580038
+ ".xlsx",
580039
+ ".xls",
580040
+ ".pptx",
580041
+ ".ppt"
580042
+ ])
580043
+ });
579953
580044
  }
579954
580045
  });
579955
580046
 
@@ -599829,7 +599920,7 @@ var require_package3 = __commonJS({
599829
599920
  "package.json"(exports2, module2) {
599830
599921
  module2.exports = {
599831
599922
  name: "snow-ai",
599832
- version: "0.6.52",
599923
+ version: "0.6.54",
599833
599924
  description: "Agentic coding in your terminal",
599834
599925
  license: "MIT",
599835
599926
  bin: {
@@ -599876,13 +599967,18 @@ var require_package3 = __commonJS({
599876
599967
  "scripts"
599877
599968
  ],
599878
599969
  dependencies: {
599970
+ "@microsoft/signalr": "^10.0.0",
599971
+ "abort-controller": "^3.0.0",
599972
+ eventsource: "^2.0.2",
599973
+ "fetch-cookie": "^3.0.1",
599974
+ "node-fetch": "^2.7.0",
599879
599975
  ssh2: "^1.17.0",
599976
+ "tough-cookie": "^4.1.3",
599880
599977
  ws: "^8.14.2"
599881
599978
  },
599882
599979
  devDependencies: {
599883
599980
  "@agentclientprotocol/sdk": "^0.14.1",
599884
599981
  "@inkjs/ui": "^2.0.0",
599885
- "@microsoft/signalr": "^10.0.0",
599886
599982
  "@modelcontextprotocol/sdk": "^1.17.3",
599887
599983
  "@sindresorhus/tsconfig": "^3.0.1",
599888
599984
  "@types/diff": "^7.0.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-ai",
3
- "version": "0.6.52",
3
+ "version": "0.6.54",
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.52",
3
+ "version": "0.6.54",
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",