codebase-retrieval-context-engine 2.0.5__py3-none-any.whl → 2.0.6__py3-none-any.whl
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.
- {codebase_retrieval_context_engine-2.0.5.dist-info → codebase_retrieval_context_engine-2.0.6.dist-info}/METADATA +1 -1
- {codebase_retrieval_context_engine-2.0.5.dist-info → codebase_retrieval_context_engine-2.0.6.dist-info}/RECORD +7 -7
- corbell/__init__.py +1 -1
- corbell/core/query/formatter.py +36 -4
- {codebase_retrieval_context_engine-2.0.5.dist-info → codebase_retrieval_context_engine-2.0.6.dist-info}/WHEEL +0 -0
- {codebase_retrieval_context_engine-2.0.5.dist-info → codebase_retrieval_context_engine-2.0.6.dist-info}/entry_points.txt +0 -0
- {codebase_retrieval_context_engine-2.0.5.dist-info → codebase_retrieval_context_engine-2.0.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codebase-retrieval-context-engine
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.6
|
|
4
4
|
Summary: Code retrieval engine — hybrid embedding + graph search for LLM context injection.
|
|
5
5
|
Project-URL: Homepage, https://github.com/nullmastermind/local-context-engine
|
|
6
6
|
Project-URL: Repository, https://github.com/nullmastermind/local-context-engine
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
corbell/__init__.py,sha256=
|
|
1
|
+
corbell/__init__.py,sha256=8lQdcrCgCID8TDejlPX3pfWw3rZhnPOMOtaxf-XRMtY,124
|
|
2
2
|
corbell/cli/__init__.py,sha256=5-MP6JIWgp4nDLNIhqP6Gtx97GESaIYg3NGxtRGaMv0,28
|
|
3
3
|
corbell/cli/main.py,sha256=CP5EHizFLaBLF1EohgVo_-XFlm4VaO6peQaSnzyfxAI,1954
|
|
4
4
|
corbell/cli/commands/__init__.py,sha256=0mAOs3RWC7XMZnGRN677hjPCHHQKDq9ASjIr_GQM3js,37
|
|
@@ -36,12 +36,12 @@ corbell/core/query/__init__.py,sha256=OCyVRZOyh_eLGhOxR_JYyH6zp8O7qy_-rC3fqGHm7B
|
|
|
36
36
|
corbell/core/query/diagnostics.py,sha256=o9uIAYFQy8hHua1xLMToSaQPP6xcmnvDJMY3fVg1Dhg,2102
|
|
37
37
|
corbell/core/query/engine.py,sha256=vTFVlXqHavxcR1mIy4KbIRWXx-u_uNHDt4Jb3JRiJ78,18016
|
|
38
38
|
corbell/core/query/enhancer.py,sha256=w5mvm1B8qQZpL6RVhMuhq_rls77hakGSNUyanfkyNEU,3934
|
|
39
|
-
corbell/core/query/formatter.py,sha256=
|
|
39
|
+
corbell/core/query/formatter.py,sha256=ZtiQwh1DqpDsiILlVbMdxq45Gr1Hf8NgZwa8oL0cSsI,4548
|
|
40
40
|
corbell/core/query/graph_expander.py,sha256=Y-yKnr6db-OM2Gh8ukYgVIcUZa6-wfWA-GhdvOwf_yA,9184
|
|
41
41
|
corbell/core/query/merger.py,sha256=fs6PL7X7EweXnSnDRnpzmpaU8JjwJpL0akzm4hSwLJk,6168
|
|
42
42
|
corbell/core/query/reranker.py,sha256=0M8Km2WEO3NX46gT0mF7ma9e0v_HOYXu-t6WgF5U2tI,7262
|
|
43
|
-
codebase_retrieval_context_engine-2.0.
|
|
44
|
-
codebase_retrieval_context_engine-2.0.
|
|
45
|
-
codebase_retrieval_context_engine-2.0.
|
|
46
|
-
codebase_retrieval_context_engine-2.0.
|
|
47
|
-
codebase_retrieval_context_engine-2.0.
|
|
43
|
+
codebase_retrieval_context_engine-2.0.6.dist-info/METADATA,sha256=WCUALd5QR2cce_KLTB3ag9TKKH3OBgEeRtk7Yj-LWv8,4036
|
|
44
|
+
codebase_retrieval_context_engine-2.0.6.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
45
|
+
codebase_retrieval_context_engine-2.0.6.dist-info/entry_points.txt,sha256=vFB4a4Qb7Ty182usK8deJXiis0UYnGIUDusw0V3Jya8,115
|
|
46
|
+
codebase_retrieval_context_engine-2.0.6.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
47
|
+
codebase_retrieval_context_engine-2.0.6.dist-info/RECORD,,
|
corbell/__init__.py
CHANGED
corbell/core/query/formatter.py
CHANGED
|
@@ -12,6 +12,8 @@ if TYPE_CHECKING:
|
|
|
12
12
|
def format_results(
|
|
13
13
|
chunks: List["ScoredChunk"],
|
|
14
14
|
repo_paths: Dict[str, str],
|
|
15
|
+
max_output_bytes: int = 80_000,
|
|
16
|
+
max_line_chars: int = 1000,
|
|
15
17
|
) -> str:
|
|
16
18
|
"""Format scored chunks as annotated code blocks for LLM context injection.
|
|
17
19
|
|
|
@@ -26,16 +28,24 @@ def format_results(
|
|
|
26
28
|
chunks: Scored chunks to format (pre-sorted by score descending).
|
|
27
29
|
repo_paths: Mapping of repo_id -> absolute repo path string.
|
|
28
30
|
Used to resolve relative file paths to absolute paths.
|
|
31
|
+
max_output_bytes: Maximum total output size in bytes. Truncation stops at the
|
|
32
|
+
last complete chunk boundary that fits. Defaults to 80 000 (~20K tokens).
|
|
33
|
+
max_line_chars: Maximum characters per source line before inline truncation.
|
|
34
|
+
Defaults to 1000.
|
|
29
35
|
|
|
30
36
|
Returns:
|
|
31
|
-
Formatted string with all chunks, separated by blank lines.
|
|
37
|
+
Formatted string with all chunks, separated by blank lines. If the output
|
|
38
|
+
exceeds max_output_bytes, a trailing note reports how many results were shown.
|
|
32
39
|
"""
|
|
33
40
|
if not chunks:
|
|
34
41
|
return ""
|
|
35
42
|
|
|
43
|
+
total = len(chunks)
|
|
36
44
|
blocks: List[str] = []
|
|
45
|
+
accumulated_bytes = 0
|
|
46
|
+
truncation_footer = ""
|
|
37
47
|
|
|
38
|
-
for chunk in chunks:
|
|
48
|
+
for n, chunk in enumerate(chunks):
|
|
39
49
|
abs_path = _resolve_absolute_path(chunk.file_path, chunk.repo_id, repo_paths)
|
|
40
50
|
|
|
41
51
|
# Read the actual lines for this chunk range
|
|
@@ -47,16 +57,38 @@ def format_results(
|
|
|
47
57
|
# Build the header: path#Lstart-end
|
|
48
58
|
header = f"{abs_path}#L{chunk.start_line}-{chunk.end_line}"
|
|
49
59
|
|
|
50
|
-
# Build numbered lines
|
|
60
|
+
# Build numbered lines with per-line truncation
|
|
51
61
|
numbered_lines: List[str] = []
|
|
52
62
|
for i, line in enumerate(lines):
|
|
53
63
|
line_num = chunk.start_line + i
|
|
64
|
+
if len(line) > max_line_chars:
|
|
65
|
+
line = line[:max_line_chars] + " [truncated — use Read tool for full content]"
|
|
54
66
|
numbered_lines.append(f"{line_num}: {line}")
|
|
55
67
|
|
|
56
68
|
block = header + "\n" + "\n".join(numbered_lines)
|
|
69
|
+
|
|
70
|
+
# Per-output size gate: check if adding this block would exceed the limit
|
|
71
|
+
# Account for the separator ("\n\n") between blocks
|
|
72
|
+
separator_size = 2 if blocks else 0
|
|
73
|
+
block_bytes = len(block.encode("utf-8"))
|
|
74
|
+
if accumulated_bytes + separator_size + block_bytes > max_output_bytes:
|
|
75
|
+
# Collect remaining chunk headers so the agent knows what else is relevant
|
|
76
|
+
remaining_headers: List[str] = []
|
|
77
|
+
for remaining in chunks[n:]:
|
|
78
|
+
rp = _resolve_absolute_path(remaining.file_path, remaining.repo_id, repo_paths)
|
|
79
|
+
remaining_headers.append(f"{rp}#L{remaining.start_line}-{remaining.end_line}")
|
|
80
|
+
truncation_footer = (
|
|
81
|
+
f"\n\n[Showing {n}/{total} results. "
|
|
82
|
+
f"Remaining (use Read tool):\n"
|
|
83
|
+
+ "\n".join(remaining_headers)
|
|
84
|
+
+ "]"
|
|
85
|
+
)
|
|
86
|
+
break
|
|
87
|
+
|
|
57
88
|
blocks.append(block)
|
|
89
|
+
accumulated_bytes += separator_size + block_bytes
|
|
58
90
|
|
|
59
|
-
return "\n\n".join(blocks)
|
|
91
|
+
return "\n\n".join(blocks) + truncation_footer
|
|
60
92
|
|
|
61
93
|
|
|
62
94
|
def _resolve_absolute_path(
|
|
File without changes
|
|
File without changes
|