cocoindex-code 0.2.2__tar.gz → 0.2.4__tar.gz

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.
Files changed (20) hide show
  1. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/PKG-INFO +2 -2
  2. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/pyproject.toml +1 -1
  3. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/_version.py +2 -2
  4. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/cli.py +19 -4
  5. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/client.py +5 -5
  6. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/indexer.py +2 -2
  7. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/server.py +19 -4
  8. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/.gitignore +0 -0
  9. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/LICENSE +0 -0
  10. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/README.md +0 -0
  11. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/__init__.py +0 -0
  12. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/__main__.py +0 -0
  13. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/config.py +0 -0
  14. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/daemon.py +0 -0
  15. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/project.py +0 -0
  16. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/protocol.py +0 -0
  17. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/query.py +0 -0
  18. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/schema.py +0 -0
  19. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/settings.py +0 -0
  20. {cocoindex_code-0.2.2 → cocoindex_code-0.2.4}/src/cocoindex_code/shared.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex-code
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: MCP server for indexing and querying codebases using CocoIndex
5
5
  Project-URL: Homepage, https://github.com/cocoindex-io/cocoindex-code
6
6
  Project-URL: Repository, https://github.com/cocoindex-io/cocoindex-code
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Requires-Python: >=3.11
20
- Requires-Dist: cocoindex[litellm]==1.0.0a33
20
+ Requires-Dist: cocoindex[litellm]==1.0.0a35
21
21
  Requires-Dist: einops>=0.8.2
22
22
  Requires-Dist: mcp>=1.0.0
23
23
  Requires-Dist: msgspec>=0.19.0
@@ -23,7 +23,7 @@ classifiers = [
23
23
 
24
24
  dependencies = [
25
25
  "mcp>=1.0.0",
26
- "cocoindex[litellm]==1.0.0a33",
26
+ "cocoindex[litellm]==1.0.0a35",
27
27
  "sentence-transformers>=2.2.0",
28
28
  "sqlite-vec>=0.1.0",
29
29
  "pydantic>=2.0.0",
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.2.2'
32
- __version_tuple__ = version_tuple = (0, 2, 2)
31
+ __version__ = version = '0.2.4'
32
+ __version_tuple__ = version_tuple = (0, 2, 4)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -449,19 +449,34 @@ def mcp() -> None:
449
449
 
450
450
  mcp_server = create_mcp_server(client, project_root)
451
451
  # Trigger initial indexing in background
452
- asyncio.create_task(_bg_index(client, project_root))
452
+ asyncio.create_task(_bg_index(project_root))
453
453
  await mcp_server.run_stdio_async()
454
454
 
455
455
  asyncio.run(_run_mcp())
456
456
 
457
457
 
458
- async def _bg_index(client, project_root: str) -> None: # type: ignore[no-untyped-def]
459
- """Index in background, swallowing errors."""
458
+ async def _bg_index(project_root: str) -> None:
459
+ """Index in background using a dedicated daemon connection.
460
+
461
+ A fresh DaemonClient is used so that background indexing does not share
462
+ the multiprocessing connection used by foreground MCP requests, which
463
+ would corrupt data ("Input data was truncated").
464
+ """
460
465
  import asyncio
461
466
 
467
+ from .client import ensure_daemon
468
+
462
469
  loop = asyncio.get_event_loop()
470
+
471
+ def _run_index() -> None:
472
+ bg_client = ensure_daemon()
473
+ try:
474
+ bg_client.index(project_root)
475
+ finally:
476
+ bg_client.close()
477
+
463
478
  try:
464
- await loop.run_in_executor(None, client.index, project_root)
479
+ await loop.run_in_executor(None, _run_index)
465
480
  except Exception:
466
481
  pass
467
482
 
@@ -205,16 +205,16 @@ def start_daemon() -> None:
205
205
 
206
206
  log_fd = open(log_path, "a")
207
207
  if sys.platform == "win32":
208
- # DETACHED_PROCESS fully detaches the daemon from the parent console,
209
- # preventing its exit code from leaking back to the calling shell.
210
- _create_new_process_group = 0x00000200
211
- _detached_process = 0x00000008
208
+ # CREATE_NO_WINDOW prevents the daemon from showing a visible
209
+ # console window. DETACHED_PROCESS alone is not sufficient
210
+ # it detaches from the parent console but still creates a new one.
211
+ _create_no_window = 0x08000000
212
212
  subprocess.Popen(
213
213
  cmd,
214
214
  stdout=log_fd,
215
215
  stderr=log_fd,
216
216
  stdin=subprocess.DEVNULL,
217
- creationflags=_create_new_process_group | _detached_process,
217
+ creationflags=_create_no_window,
218
218
  )
219
219
  else:
220
220
  subprocess.Popen(
@@ -25,8 +25,8 @@ from .shared import (
25
25
  )
26
26
 
27
27
  # Chunking configuration
28
- CHUNK_SIZE = 800
29
- MIN_CHUNK_SIZE = 200
28
+ CHUNK_SIZE = 1000
29
+ MIN_CHUNK_SIZE = 250
30
30
  CHUNK_OVERLAP = 150
31
31
 
32
32
  # Chunking splitter (stateless, can be module-level)
@@ -327,16 +327,31 @@ def main() -> None:
327
327
  mcp_server = create_mcp_server(client, str(project_root))
328
328
 
329
329
  async def _serve() -> None:
330
- asyncio.create_task(_bg_index(client, str(project_root)))
330
+ asyncio.create_task(_bg_index(str(project_root)))
331
331
  await mcp_server.run_stdio_async()
332
332
 
333
333
  asyncio.run(_serve())
334
334
 
335
335
 
336
- async def _bg_index(client: DaemonClient, project_root: str) -> None:
337
- """Index in background."""
336
+ async def _bg_index(project_root: str) -> None:
337
+ """Index in background using a dedicated daemon connection.
338
+
339
+ A fresh DaemonClient is used so that background indexing does not share
340
+ the multiprocessing connection used by foreground MCP requests, which
341
+ would corrupt data ("Input data was truncated").
342
+ """
343
+ from .client import ensure_daemon
344
+
338
345
  loop = asyncio.get_event_loop()
346
+
347
+ def _run_index() -> None:
348
+ bg_client = ensure_daemon()
349
+ try:
350
+ bg_client.index(project_root)
351
+ finally:
352
+ bg_client.close()
353
+
339
354
  try:
340
- await loop.run_in_executor(None, client.index, project_root)
355
+ await loop.run_in_executor(None, _run_index)
341
356
  except Exception:
342
357
  pass
File without changes
File without changes