sift-light 1.0.0

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 (145) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/CONTRIBUTING.md +19 -0
  3. package/LICENSE +661 -0
  4. package/README.md +177 -0
  5. package/README.zh-CN.md +177 -0
  6. package/SECURITY.md +25 -0
  7. package/package.json +142 -0
  8. package/plugins/sift-light/.claude-plugin/plugin.json +10 -0
  9. package/plugins/sift-light/.codex-plugin/plugin.json +20 -0
  10. package/plugins/sift-light/.mcp.json +24 -0
  11. package/plugins/sift-light/LICENSE +661 -0
  12. package/plugins/sift-light/concept-worker.mjs +567 -0
  13. package/plugins/sift-light/hooks/THIRD_PARTY_NOTICES.txt +70 -0
  14. package/plugins/sift-light/hooks/hooks.json +16 -0
  15. package/plugins/sift-light/hooks/search-policy.mjs +4113 -0
  16. package/plugins/sift-light/hooks/tree-sitter-bash.wasm +0 -0
  17. package/plugins/sift-light/hooks/tree-sitter-powershell.wasm +0 -0
  18. package/plugins/sift-light/hooks/tree-sitter.wasm +0 -0
  19. package/plugins/sift-light/kimi.plugin.json +36 -0
  20. package/plugins/sift-light/mcp-server.mjs +1 -0
  21. package/plugins/sift-light/omp-extension.mjs +20914 -0
  22. package/plugins/sift-light/package.json +11 -0
  23. package/plugins/sift-light/syntax-worker.mjs +280 -0
  24. package/plugins/sift-light/syntax-worker.toml +2 -0
  25. package/src/analysis-evidence.ts +43 -0
  26. package/src/analysis-limits.ts +27 -0
  27. package/src/analysis-store.ts +559 -0
  28. package/src/analysis-term-pages.ts +73 -0
  29. package/src/analysis-types.ts +162 -0
  30. package/src/audit-search.ts +391 -0
  31. package/src/capped-lines.ts +112 -0
  32. package/src/concept-embedding-cache.ts +186 -0
  33. package/src/concept-inference.ts +218 -0
  34. package/src/concept-model.ts +96 -0
  35. package/src/concept-search.ts +577 -0
  36. package/src/concept-setup.ts +75 -0
  37. package/src/concept-source-generation.ts +268 -0
  38. package/src/concept-worker.mjs +567 -0
  39. package/src/concept-worker.ts +210 -0
  40. package/src/config-reader.ts +283 -0
  41. package/src/config.ts +37 -0
  42. package/src/context-budget.ts +26 -0
  43. package/src/discovery-errors.ts +2 -0
  44. package/src/errors.ts +95 -0
  45. package/src/evidence-candidates.ts +344 -0
  46. package/src/evidence-ranking.ts +48 -0
  47. package/src/evidence-service.ts +1047 -0
  48. package/src/evidence-validation.ts +466 -0
  49. package/src/evidence-validity.ts +33 -0
  50. package/src/excerpt.ts +53 -0
  51. package/src/file-discovery.ts +150 -0
  52. package/src/file-metadata-filter.ts +46 -0
  53. package/src/format.ts +407 -0
  54. package/src/git-diff.ts +195 -0
  55. package/src/git-process.ts +189 -0
  56. package/src/git-repository.ts +367 -0
  57. package/src/git-source.ts +385 -0
  58. package/src/historical-paths.ts +205 -0
  59. package/src/hybrid-search.ts +340 -0
  60. package/src/import-model.ts +611 -0
  61. package/src/import-navigation.ts +100 -0
  62. package/src/import-resolution.ts +240 -0
  63. package/src/index.ts +97 -0
  64. package/src/inspect-batch.ts +265 -0
  65. package/src/inspect.ts +271 -0
  66. package/src/language-capabilities.ts +157 -0
  67. package/src/language-capability-definitions.ts +204 -0
  68. package/src/literal-search.ts +25 -0
  69. package/src/mcp-cli.ts +21 -0
  70. package/src/mcp-model-output.ts +120 -0
  71. package/src/mcp-output.ts +9 -0
  72. package/src/mcp-semantic-judge.ts +39 -0
  73. package/src/mcp-server.mjs +14064 -0
  74. package/src/mcp-server.ts +157 -0
  75. package/src/mcp-stdio.ts +114 -0
  76. package/src/mcp.ts +631 -0
  77. package/src/model-error.ts +120 -0
  78. package/src/multi-term-search.ts +122 -0
  79. package/src/omp-index.ts +277 -0
  80. package/src/omp-marketplace-entry.ts +7 -0
  81. package/src/operation-lifecycle.ts +413 -0
  82. package/src/operation-output.ts +100 -0
  83. package/src/owned-parallel.ts +22 -0
  84. package/src/owned-process.ts +102 -0
  85. package/src/owned-task-queue.ts +38 -0
  86. package/src/package-version.ts +3 -0
  87. package/src/path-policy.ts +203 -0
  88. package/src/pi-search-policy.ts +33 -0
  89. package/src/prompt-guidelines.ts +54 -0
  90. package/src/python-outline.ts +231 -0
  91. package/src/record-value.ts +3 -0
  92. package/src/redaction.ts +95 -0
  93. package/src/request-contract-catalog.ts +215 -0
  94. package/src/request-contract-error.ts +96 -0
  95. package/src/request-contract.ts +481 -0
  96. package/src/request.ts +132 -0
  97. package/src/result-statistics.ts +178 -0
  98. package/src/rg.ts +574 -0
  99. package/src/ripgrep-diagnostics.ts +122 -0
  100. package/src/ripgrep-executable.ts +43 -0
  101. package/src/runtime.ts +53 -0
  102. package/src/scan-revisions.ts +148 -0
  103. package/src/script-runtime.ts +11 -0
  104. package/src/search-policy-commands.ts +170 -0
  105. package/src/search-policy-hook.ts +61 -0
  106. package/src/search-policy-recovery.ts +388 -0
  107. package/src/search-policy-shell.ts +280 -0
  108. package/src/search-policy.ts +102 -0
  109. package/src/search-retention.ts +77 -0
  110. package/src/semantic-judge-batches.ts +135 -0
  111. package/src/semantic-judge.ts +519 -0
  112. package/src/service.ts +945 -0
  113. package/src/session-summary.ts +100 -0
  114. package/src/snapshot-store.ts +203 -0
  115. package/src/source-access.ts +288 -0
  116. package/src/source-continuations.ts +168 -0
  117. package/src/source-document.ts +277 -0
  118. package/src/source-inspection.ts +731 -0
  119. package/src/source-pages.ts +112 -0
  120. package/src/source.ts +286 -0
  121. package/src/structural-search.ts +125 -0
  122. package/src/structure.ts +259 -0
  123. package/src/summary-previews.ts +96 -0
  124. package/src/summary.ts +79 -0
  125. package/src/syntax-facts.ts +464 -0
  126. package/src/syntax-fields.ts +161 -0
  127. package/src/syntax-search.ts +361 -0
  128. package/src/syntax-tree.ts +30 -0
  129. package/src/syntax-types.ts +72 -0
  130. package/src/syntax-worker.mjs +280 -0
  131. package/src/syntax-worker.toml +2 -0
  132. package/src/syntax-worker.ts +143 -0
  133. package/src/syntax.ts +259 -0
  134. package/src/test-navigation-facts.ts +261 -0
  135. package/src/test-navigation.ts +543 -0
  136. package/src/tool-schema.ts +321 -0
  137. package/src/tui/dashboard.ts +107 -0
  138. package/src/tui/layout.ts +291 -0
  139. package/src/tui/palette.ts +73 -0
  140. package/src/tui/presentation.ts +240 -0
  141. package/src/tui/renderers.ts +106 -0
  142. package/src/types.ts +368 -0
  143. package/src/validation-output.ts +148 -0
  144. package/src/validation-types.ts +48 -0
  145. package/src/workspace-files.ts +142 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "sift-light",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "omp": {
7
+ "extensions": [
8
+ "./omp-extension.mjs"
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,280 @@
1
+ // src/syntax-worker.ts
2
+ import { parse, registerDynamicLanguage } from "@ast-grep/napi";
3
+ import go from "@ast-grep/lang-go";
4
+
5
+ // src/analysis-limits.ts
6
+ var MAX_STRUCTURE_BYTES = 32 * 1024 * 1024;
7
+ var MAX_SYNTAX_NODES = 1e5;
8
+ var MAX_ANALYSIS_STORAGE_BYTES = 32 * 1024 * 1024;
9
+ var ANALYSIS_METADATA_RESERVE_BYTES = 64 * 1024;
10
+ var MAX_ANALYSIS_REASON_BYTES = 4 * 1024;
11
+ var ANALYSIS_TTL_MS = 10 * 60 * 1000;
12
+ var MAX_SOURCE_CONTINUATION_BYTES = 1024 * 1024;
13
+
14
+ // src/syntax-fields.ts
15
+ var JAVASCRIPT_FIELDS = {
16
+ arrow_function: ["body", "parameter", "parameters", "return_type", "type_parameters"],
17
+ assignment_expression: ["left", "right"],
18
+ assignment_pattern: ["left", "right"],
19
+ augmented_assignment_expression: ["left", "operator", "right"],
20
+ binary_expression: ["left", "operator", "right"],
21
+ break_statement: ["label"],
22
+ call_expression: ["arguments", "function", "optional_chain", "type_arguments"],
23
+ catch_clause: ["body", "parameter", "type"],
24
+ class: ["body", "decorator", "name", "type_parameters"],
25
+ class_body: ["decorator", "member"],
26
+ class_declaration: ["body", "decorator", "name", "type_parameters"],
27
+ class_static_block: ["body"],
28
+ continue_statement: ["label"],
29
+ do_statement: ["body", "condition"],
30
+ export_specifier: ["alias", "name"],
31
+ export_statement: ["declaration", "decorator", "source", "value"],
32
+ field_definition: ["decorator", "property", "value"],
33
+ finally_clause: ["body"],
34
+ for_in_statement: ["body", "kind", "left", "operator", "right", "value"],
35
+ for_statement: ["body", "condition", "increment", "initializer"],
36
+ function_declaration: ["body", "name", "parameters", "return_type", "type_parameters"],
37
+ function_expression: ["body", "name", "parameters", "return_type", "type_parameters"],
38
+ generator_function: ["body", "name", "parameters", "return_type", "type_parameters"],
39
+ generator_function_declaration: ["body", "name", "parameters", "return_type", "type_parameters"],
40
+ if_statement: ["alternative", "condition", "consequence"],
41
+ import_specifier: ["alias", "name"],
42
+ import_statement: ["source"],
43
+ jsx_closing_element: ["name"],
44
+ jsx_element: ["close_tag", "open_tag"],
45
+ jsx_opening_element: ["attribute", "name", "type_arguments"],
46
+ jsx_self_closing_element: ["attribute", "name", "type_arguments"],
47
+ labeled_statement: ["body", "label"],
48
+ lexical_declaration: ["kind"],
49
+ member_expression: ["object", "optional_chain", "property"],
50
+ method_definition: ["body", "decorator", "name", "parameters", "return_type", "type_parameters"],
51
+ new_expression: ["arguments", "constructor", "type_arguments"],
52
+ object_assignment_pattern: ["left", "right"],
53
+ pair: ["key", "value"],
54
+ pair_pattern: ["key", "value"],
55
+ regex: ["flags", "pattern"],
56
+ subscript_expression: ["index", "object", "optional_chain"],
57
+ switch_case: ["body", "value"],
58
+ switch_default: ["body"],
59
+ switch_statement: ["body", "value"],
60
+ ternary_expression: ["alternative", "condition", "consequence"],
61
+ try_statement: ["body", "finalizer", "handler"],
62
+ unary_expression: ["argument", "operator"],
63
+ update_expression: ["argument", "operator"],
64
+ using_declaration: ["kind"],
65
+ variable_declarator: ["name", "type", "value"],
66
+ while_statement: ["body", "condition"],
67
+ with_statement: ["body", "object"],
68
+ abstract_class_declaration: ["body", "decorator", "name", "type_parameters"],
69
+ abstract_method_signature: ["name", "parameters", "return_type", "type_parameters"],
70
+ call_signature: ["parameters", "return_type", "type_parameters"],
71
+ conditional_type: ["alternative", "consequence", "left", "right"],
72
+ construct_signature: ["parameters", "type", "type_parameters"],
73
+ constructor_type: ["parameters", "type", "type_parameters"],
74
+ enum_assignment: ["name", "value"],
75
+ enum_body: ["name"],
76
+ enum_declaration: ["body", "name"],
77
+ extends_clause: ["type_arguments", "value"],
78
+ extends_type_clause: ["type"],
79
+ function_signature: ["name", "parameters", "return_type", "type_parameters"],
80
+ function_type: ["parameters", "return_type", "type_parameters"],
81
+ generic_type: ["name", "type_arguments"],
82
+ import_require_clause: ["source"],
83
+ index_signature: ["index_type", "name", "sign", "type"],
84
+ instantiation_expression: ["function", "type_arguments"],
85
+ interface_declaration: ["body", "name", "type_parameters"],
86
+ internal_module: ["body", "name"],
87
+ mapped_type_clause: ["alias", "name", "type"],
88
+ method_signature: ["name", "parameters", "return_type", "type_parameters"],
89
+ module: ["body", "name"],
90
+ nested_identifier: ["object", "property"],
91
+ nested_type_identifier: ["module", "name"],
92
+ optional_parameter: ["decorator", "name", "pattern", "type", "value"],
93
+ parenthesized_expression: ["type"],
94
+ property_signature: ["name", "type"],
95
+ public_field_definition: ["decorator", "name", "type", "value"],
96
+ required_parameter: ["decorator", "name", "pattern", "type", "value"],
97
+ type_alias_declaration: ["name", "type_parameters", "value"],
98
+ type_parameter: ["constraint", "name", "value"],
99
+ type_predicate: ["name", "type"]
100
+ };
101
+ var GO_FIELDS = {
102
+ array_type: ["element", "length"],
103
+ assignment_statement: ["left", "operator", "right"],
104
+ binary_expression: ["left", "operator", "right"],
105
+ call_expression: ["arguments", "function", "type_arguments"],
106
+ channel_type: ["value"],
107
+ communication_case: ["communication"],
108
+ composite_literal: ["body", "type"],
109
+ const_spec: ["name", "type", "value"],
110
+ expression_case: ["value"],
111
+ expression_switch_statement: ["initializer", "value"],
112
+ field_declaration: ["name", "tag", "type"],
113
+ for_clause: ["condition", "initializer", "update"],
114
+ for_statement: ["body"],
115
+ func_literal: ["body", "parameters", "result"],
116
+ function_declaration: ["body", "name", "parameters", "result", "type_parameters"],
117
+ function_type: ["parameters", "result"],
118
+ generic_type: ["type", "type_arguments"],
119
+ if_statement: ["alternative", "condition", "consequence", "initializer"],
120
+ implicit_length_array_type: ["element"],
121
+ import_spec: ["name", "path"],
122
+ index_expression: ["index", "operand"],
123
+ keyed_element: ["key", "value"],
124
+ labeled_statement: ["label"],
125
+ map_type: ["key", "value"],
126
+ method_declaration: ["body", "name", "parameters", "receiver", "result"],
127
+ method_elem: ["name", "parameters", "result"],
128
+ parameter_declaration: ["name", "type"],
129
+ qualified_type: ["name", "package"],
130
+ range_clause: ["left", "right"],
131
+ receive_statement: ["left", "right"],
132
+ selector_expression: ["field", "operand"],
133
+ send_statement: ["channel", "value"],
134
+ short_var_declaration: ["left", "right"],
135
+ slice_expression: ["capacity", "end", "operand", "start"],
136
+ slice_type: ["element"],
137
+ type_alias: ["name", "type", "type_parameters"],
138
+ type_assertion_expression: ["operand", "type"],
139
+ type_case: ["type"],
140
+ type_conversion_expression: ["operand", "type"],
141
+ type_instantiation_expression: ["type"],
142
+ type_parameter_declaration: ["name", "type"],
143
+ type_spec: ["name", "type", "type_parameters"],
144
+ type_switch_statement: ["alias", "initializer", "value"],
145
+ unary_expression: ["operand", "operator"],
146
+ var_spec: ["name", "type", "value"],
147
+ variadic_parameter_declaration: ["name", "type"]
148
+ };
149
+
150
+ // src/types.ts
151
+ var MAX_SEARCH_STORAGE_BYTES = 32 * 1024 * 1024;
152
+ var MAX_RESULT_BYTES = 16 * 1024;
153
+ var MAX_PROTOCOL_LINE_BYTES = 16 * 1024 * 1024;
154
+ var MAX_SOURCE_FILE_BYTES = 5 * 1024 * 1024;
155
+ var MAX_PATTERN_CHARACTERS = 64 * 1024;
156
+
157
+ // src/syntax-worker.ts
158
+ function fieldsFor(node, language) {
159
+ const fields = new Map;
160
+ const names = (language === "go" ? GO_FIELDS : JAVASCRIPT_FIELDS)[node.kind()] ?? [];
161
+ for (const name of names) {
162
+ for (const child of node.fieldChildren(name))
163
+ fields.set(child.id(), name);
164
+ }
165
+ return fields;
166
+ }
167
+ function languageName(value) {
168
+ if (value === "javascript" || value === "typescript" || value === "tsx" || value === "go") {
169
+ return value;
170
+ }
171
+ throw new Error("Invalid syntax worker language");
172
+ }
173
+ function parseInput(input) {
174
+ if (!input || typeof input !== "object" || !("language" in input) || !("text" in input)) {
175
+ throw new Error("Invalid syntax worker input");
176
+ }
177
+ const language = languageName(input.language);
178
+ if (typeof input.text !== "string" || !input.text.isWellFormed()) {
179
+ throw new Error("Syntax worker input must be well-formed Unicode");
180
+ }
181
+ if (Buffer.byteLength(input.text) > MAX_SOURCE_FILE_BYTES) {
182
+ throw new Error("Syntax worker source exceeds the file limit");
183
+ }
184
+ if ("pattern" in input && (typeof input.pattern !== "string" || Buffer.byteLength(input.pattern) > 4096))
185
+ throw new Error("Invalid AST pattern");
186
+ return {
187
+ language,
188
+ text: input.text,
189
+ ..."pattern" in input && typeof input.pattern === "string" ? { pattern: input.pattern } : {}
190
+ };
191
+ }
192
+ function extract(language, text, pattern) {
193
+ if (language === "go")
194
+ registerDynamicLanguage({ go });
195
+ const names = { javascript: "JavaScript", typescript: "TypeScript", tsx: "Tsx", go: "go" };
196
+ if (pattern !== undefined) {
197
+ const prepared = language === "go" ? pattern.replaceAll("$", "µ") : pattern;
198
+ const templates = language === "go" ? [
199
+ prepared,
200
+ `package pattern
201
+ ${prepared}`,
202
+ `package pattern
203
+ func pattern() {
204
+ ${prepared}
205
+ }`
206
+ ] : [prepared];
207
+ const valid = templates.some((candidate) => {
208
+ const template = parse(names[language], candidate).root();
209
+ return template.kind() !== "ERROR" && !template.find({ rule: { kind: "ERROR" } });
210
+ });
211
+ if (!valid)
212
+ throw new Error("Malformed structural pattern for selected language");
213
+ }
214
+ const root = parse(names[language], text).root();
215
+ const rootRange = root.range();
216
+ const nodes = [
217
+ {
218
+ kind: String(root.kind()),
219
+ start: rootRange.start.index,
220
+ end: rootRange.end.index,
221
+ parent: null,
222
+ named: root.isNamed()
223
+ }
224
+ ];
225
+ const stack = [{ node: root, index: 0, next: 0, fields: fieldsFor(root, language) }];
226
+ let malformed = root.kind() === "ERROR";
227
+ while (stack.length > 0) {
228
+ const frame = stack.at(-1);
229
+ if (!frame)
230
+ break;
231
+ const child = frame.node.child(frame.next++);
232
+ if (!child) {
233
+ stack.pop();
234
+ continue;
235
+ }
236
+ if (nodes.length === MAX_SYNTAX_NODES)
237
+ return { status: "limit", nodes };
238
+ const range = child.range();
239
+ const kind = String(child.kind());
240
+ const field = frame.fields.get(child.id());
241
+ const node = {
242
+ kind,
243
+ start: range.start.index,
244
+ end: range.end.index,
245
+ parent: frame.index,
246
+ named: child.isNamed(),
247
+ ...field ? { field } : {}
248
+ };
249
+ if (kind === "ERROR" || node.start === node.end)
250
+ malformed = true;
251
+ const index = nodes.length;
252
+ nodes.push(node);
253
+ stack.push({ node: child, index, next: 0, fields: fieldsFor(child, language) });
254
+ }
255
+ const patternMatches = pattern === undefined || malformed ? undefined : root.findAll(pattern).map((node) => ({ start: node.range().start.index, end: node.range().end.index }));
256
+ return {
257
+ status: malformed ? "parse-error" : "ok",
258
+ nodes,
259
+ ...patternMatches ? { patternMatches } : {}
260
+ };
261
+ }
262
+ async function main() {
263
+ const chunks = [];
264
+ let bytes = 0;
265
+ for await (const chunk of process.stdin) {
266
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
267
+ bytes += buffer.length;
268
+ if (bytes > MAX_STRUCTURE_BYTES)
269
+ throw new Error("Syntax worker input exceeds protocol limit");
270
+ chunks.push(buffer);
271
+ }
272
+ const input = JSON.parse(Buffer.concat(chunks).toString("utf8"));
273
+ const { language, text, pattern } = parseInput(input);
274
+ const output = JSON.stringify(extract(language, text, pattern));
275
+ if (Buffer.byteLength(output) > MAX_STRUCTURE_BYTES) {
276
+ throw new Error("Syntax worker output exceeds protocol limit");
277
+ }
278
+ process.stdout.write(output);
279
+ }
280
+ await main();
@@ -0,0 +1,2 @@
1
+ # Parser runtime configuration, not user/project configuration.
2
+ preload = []
@@ -0,0 +1,43 @@
1
+ import type { ByteRange, SourceDocument } from "./source-document.js";
2
+ import { MAX_LINE_CHARACTERS } from "./types.js";
3
+
4
+ /** Creates one bounded, UTF-8-safe line excerpt around an exact byte range. */
5
+ export function sourceEvidence(document: SourceDocument, range: ByteRange) {
6
+ const line = document.lineAt(range.start);
7
+ const lineRange = document.lineRange(line);
8
+ const lineStart = document.toCharacterOffset(lineRange.start);
9
+ const lineEnd = document.toCharacterOffset(lineRange.end);
10
+ const focus = document.toCharacterOffset(range.start);
11
+ const focusEnd = document.toCharacterOffset(range.end);
12
+ let start = Math.max(
13
+ lineStart,
14
+ focus - Math.floor(Math.max(0, MAX_LINE_CHARACTERS - (focusEnd - focus)) / 2),
15
+ );
16
+ let end = Math.min(lineEnd, start + MAX_LINE_CHARACTERS);
17
+ const startCode = document.text.charCodeAt(start);
18
+ const endCode = document.text.charCodeAt(end);
19
+ if (startCode >= 0xdc00 && startCode <= 0xdfff) start--;
20
+ if (endCode >= 0xdc00 && endCode <= 0xdfff) end--;
21
+ const excerptRange = { start: document.toByteOffset(start), end: document.toByteOffset(end) };
22
+ return {
23
+ range: { ...range },
24
+ line,
25
+ excerpt: `${start > lineStart ? "…" : ""}${document.text.slice(start, end)}${end < lineEnd ? "…" : ""}`,
26
+ excerptRange,
27
+ excerptTruncated: start > lineStart || end < lineEnd,
28
+ };
29
+ }
30
+
31
+ /** A bounded multi-line excerpt from a selected source range, without splitting Unicode. */
32
+ export function rangeEvidence(document: SourceDocument, range: ByteRange) {
33
+ const start = document.toCharacterOffset(range.start);
34
+ const rangeEnd = document.toCharacterOffset(range.end);
35
+ let end = Math.min(rangeEnd, start + MAX_LINE_CHARACTERS);
36
+ const code = document.text.charCodeAt(end);
37
+ if (code >= 0xdc00 && code <= 0xdfff) end -= 1;
38
+ return {
39
+ excerpt: `${document.text.slice(start, end)}${end < rangeEnd ? "…" : ""}`,
40
+ excerptRange: { start: range.start, end: document.toByteOffset(end) },
41
+ excerptTruncated: end < rangeEnd,
42
+ };
43
+ }
@@ -0,0 +1,27 @@
1
+ /** Shared limits for source analysis, independent of retained grep matches. */
2
+ export const MAX_STRUCTURE_FILES = 200;
3
+ export const MAX_CONFIGURABLE_STRUCTURE_FILES = 2_000;
4
+ export const MAX_STRUCTURE_BYTES = 32 * 1024 * 1024;
5
+ export const MAX_SYNTAX_CACHE_ENTRIES = 256;
6
+ export const MAX_SYNTAX_CACHE_NODES = 1_000_000;
7
+ export const MAX_GIT_DIFF_WORK = 2_000_000;
8
+ export const MAX_SYNTAX_NODES = 100_000;
9
+ export const MAX_PARSE_TIME_MS = 5_000;
10
+ export const MAX_ANALYSIS_RESULTS = 50_000;
11
+ export const MAX_ANALYSIS_SNAPSHOTS = 20;
12
+ export const MAX_ANALYSIS_STORAGE_BYTES = 32 * 1024 * 1024;
13
+ export const ANALYSIS_METADATA_RESERVE_BYTES = 64 * 1024;
14
+ export const MAX_ANALYSIS_REASONS = 64;
15
+ export const MAX_ANALYSIS_REASON_BYTES = 4 * 1024;
16
+ export const MIN_ANY_OF_TERMS = 2;
17
+ export const MAX_ANY_OF_TERMS = 8;
18
+ /** Public union size; execution keeps the proven eight-term scan boundary per chunk. */
19
+ export const MAX_ANY_OF_TOTAL_TERMS = 64;
20
+ export const MAX_LITERAL_TERM_BYTES = 256;
21
+ export const ANALYSIS_TTL_MS = 10 * 60 * 1000;
22
+ export const MAX_SOURCE_CONTINUATIONS = 20;
23
+ export const MAX_SOURCE_CONTINUATION_BYTES = 1024 * 1024;
24
+ export const MAX_IMPORT_HOPS = 8;
25
+ export const MAX_IMPORT_FILES = 20;
26
+ export const DEFAULT_HYBRID_CONCEPT_LIMIT = 3;
27
+ export const MAX_HYBRID_CONCEPT_LIMIT = 20;