codevault 1.6.0 → 1.7.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.
- package/dist/chunking/file-grouper.d.ts +39 -0
- package/dist/chunking/file-grouper.d.ts.map +1 -0
- package/dist/chunking/file-grouper.js +164 -0
- package/dist/chunking/file-grouper.js.map +1 -0
- package/dist/chunking/semantic-chunker.d.ts +37 -0
- package/dist/chunking/semantic-chunker.d.ts.map +1 -0
- package/dist/chunking/semantic-chunker.js +157 -0
- package/dist/chunking/semantic-chunker.js.map +1 -0
- package/dist/chunking/token-counter.d.ts +28 -0
- package/dist/chunking/token-counter.d.ts.map +1 -0
- package/dist/chunking/token-counter.js +178 -0
- package/dist/chunking/token-counter.js.map +1 -0
- package/dist/cli/commands/ask-cmd.d.ts +3 -0
- package/dist/cli/commands/ask-cmd.d.ts.map +1 -0
- package/dist/cli/commands/ask-cmd.js +130 -0
- package/dist/cli/commands/ask-cmd.js.map +1 -0
- package/dist/cli/commands/chat-cmd.d.ts +3 -0
- package/dist/cli/commands/chat-cmd.d.ts.map +1 -0
- package/dist/cli/commands/chat-cmd.js +194 -0
- package/dist/cli/commands/chat-cmd.js.map +1 -0
- package/dist/cli/commands/config-cmd.d.ts +3 -0
- package/dist/cli/commands/config-cmd.d.ts.map +1 -0
- package/dist/cli/commands/config-cmd.js +245 -0
- package/dist/cli/commands/config-cmd.js.map +1 -0
- package/dist/cli/commands/context.d.ts +3 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +98 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/interactive-config.d.ts +2 -0
- package/dist/cli/commands/interactive-config.d.ts.map +1 -0
- package/dist/cli/commands/interactive-config.js +274 -0
- package/dist/cli/commands/interactive-config.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +401 -0
- package/dist/cli.js.map +1 -0
- package/dist/codemap/io.d.ts +6 -0
- package/dist/codemap/io.d.ts.map +1 -0
- package/dist/codemap/io.js +46 -0
- package/dist/codemap/io.js.map +1 -0
- package/dist/config/apply-env.d.ts +23 -0
- package/dist/config/apply-env.d.ts.map +1 -0
- package/dist/config/apply-env.js +89 -0
- package/dist/config/apply-env.js.map +1 -0
- package/dist/config/constants.d.ts +326 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +214 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/loader.d.ts +57 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +287 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/resolver.d.ts +30 -0
- package/dist/config/resolver.d.ts.map +1 -0
- package/dist/config/resolver.js +29 -0
- package/dist/config/resolver.js.map +1 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/context/packs.d.ts +33 -0
- package/dist/context/packs.d.ts.map +1 -0
- package/dist/context/packs.js +180 -0
- package/dist/context/packs.js.map +1 -0
- package/dist/core/IndexerEngine.d.ts +24 -0
- package/dist/core/IndexerEngine.d.ts.map +1 -0
- package/dist/core/IndexerEngine.js +372 -0
- package/dist/core/IndexerEngine.js.map +1 -0
- package/dist/core/SearchService.d.ts +25 -0
- package/dist/core/SearchService.d.ts.map +1 -0
- package/dist/core/SearchService.js +455 -0
- package/dist/core/SearchService.js.map +1 -0
- package/dist/core/batch-indexer.d.ts +56 -0
- package/dist/core/batch-indexer.d.ts.map +1 -0
- package/dist/core/batch-indexer.js +192 -0
- package/dist/core/batch-indexer.js.map +1 -0
- package/dist/core/indexer.d.ts +3 -0
- package/dist/core/indexer.d.ts.map +1 -0
- package/dist/core/indexer.js +6 -0
- package/dist/core/indexer.js.map +1 -0
- package/dist/core/indexing/chunk-pipeline.d.ts +39 -0
- package/dist/core/indexing/chunk-pipeline.d.ts.map +1 -0
- package/dist/core/indexing/chunk-pipeline.js +210 -0
- package/dist/core/indexing/chunk-pipeline.js.map +1 -0
- package/dist/core/indexing/file-scanner.d.ts +11 -0
- package/dist/core/indexing/file-scanner.d.ts.map +1 -0
- package/dist/core/indexing/file-scanner.js +49 -0
- package/dist/core/indexing/file-scanner.js.map +1 -0
- package/dist/core/metadata.d.ts +19 -0
- package/dist/core/metadata.d.ts.map +1 -0
- package/dist/core/metadata.js +161 -0
- package/dist/core/metadata.js.map +1 -0
- package/dist/core/search.d.ts +7 -0
- package/dist/core/search.d.ts.map +1 -0
- package/dist/core/search.js +16 -0
- package/dist/core/search.js.map +1 -0
- package/dist/core/symbol-extractor.d.ts +3 -0
- package/dist/core/symbol-extractor.d.ts.map +1 -0
- package/dist/core/symbol-extractor.js +78 -0
- package/dist/core/symbol-extractor.js.map +1 -0
- package/dist/core/types.d.ts +104 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/database/db.d.ts +101 -0
- package/dist/database/db.d.ts.map +1 -0
- package/dist/database/db.js +326 -0
- package/dist/database/db.js.map +1 -0
- package/dist/indexer/merkle.d.ts +13 -0
- package/dist/indexer/merkle.d.ts.map +1 -0
- package/dist/indexer/merkle.js +86 -0
- package/dist/indexer/merkle.js.map +1 -0
- package/dist/indexer/update.d.ts +19 -0
- package/dist/indexer/update.d.ts.map +1 -0
- package/dist/indexer/update.js +40 -0
- package/dist/indexer/update.js.map +1 -0
- package/dist/indexer/watch.d.ts +21 -0
- package/dist/indexer/watch.d.ts.map +1 -0
- package/dist/indexer/watch.js +224 -0
- package/dist/indexer/watch.js.map +1 -0
- package/dist/languages/rules.d.ts +11 -0
- package/dist/languages/rules.d.ts.map +1 -0
- package/dist/languages/rules.js +371 -0
- package/dist/languages/rules.js.map +1 -0
- package/dist/languages/tree-sitter-loader.d.ts +27 -0
- package/dist/languages/tree-sitter-loader.d.ts.map +1 -0
- package/dist/languages/tree-sitter-loader.js +76 -0
- package/dist/languages/tree-sitter-loader.js.map +1 -0
- package/dist/mcp/handlers/context.d.ts +15 -0
- package/dist/mcp/handlers/context.d.ts.map +1 -0
- package/dist/mcp/handlers/context.js +31 -0
- package/dist/mcp/handlers/context.js.map +1 -0
- package/dist/mcp/handlers/index.d.ts +5 -0
- package/dist/mcp/handlers/index.d.ts.map +1 -0
- package/dist/mcp/handlers/index.js +5 -0
- package/dist/mcp/handlers/index.js.map +1 -0
- package/dist/mcp/handlers/project.d.ts +41 -0
- package/dist/mcp/handlers/project.d.ts.map +1 -0
- package/dist/mcp/handlers/project.js +76 -0
- package/dist/mcp/handlers/project.js.map +1 -0
- package/dist/mcp/handlers/search.d.ts +27 -0
- package/dist/mcp/handlers/search.d.ts.map +1 -0
- package/dist/mcp/handlers/search.js +108 -0
- package/dist/mcp/handlers/search.js.map +1 -0
- package/dist/mcp/handlers/synthesis.d.ts +15 -0
- package/dist/mcp/handlers/synthesis.d.ts.map +1 -0
- package/dist/mcp/handlers/synthesis.js +58 -0
- package/dist/mcp/handlers/synthesis.js.map +1 -0
- package/dist/mcp/schemas.d.ts +166 -0
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +159 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/tools/ask-codebase.d.ts +85 -0
- package/dist/mcp/tools/ask-codebase.d.ts.map +1 -0
- package/dist/mcp/tools/ask-codebase.js +125 -0
- package/dist/mcp/tools/ask-codebase.js.map +1 -0
- package/dist/mcp/tools/use-context-pack.d.ts +57 -0
- package/dist/mcp/tools/use-context-pack.d.ts.map +1 -0
- package/dist/mcp/tools/use-context-pack.js +91 -0
- package/dist/mcp/tools/use-context-pack.js.map +1 -0
- package/dist/mcp-server.d.ts +13 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +263 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/providers/base.d.ts +39 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +198 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/chat-llm.d.ts +35 -0
- package/dist/providers/chat-llm.d.ts.map +1 -0
- package/dist/providers/chat-llm.js +98 -0
- package/dist/providers/chat-llm.js.map +1 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +12 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai.d.ts +18 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +132 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/token-counter.d.ts +2 -0
- package/dist/providers/token-counter.d.ts.map +1 -0
- package/dist/providers/token-counter.js +18 -0
- package/dist/providers/token-counter.js.map +1 -0
- package/dist/ranking/api-reranker.d.ts +18 -0
- package/dist/ranking/api-reranker.d.ts.map +1 -0
- package/dist/ranking/api-reranker.js +137 -0
- package/dist/ranking/api-reranker.js.map +1 -0
- package/dist/ranking/symbol-boost.d.ts +15 -0
- package/dist/ranking/symbol-boost.d.ts.map +1 -0
- package/dist/ranking/symbol-boost.js +175 -0
- package/dist/ranking/symbol-boost.js.map +1 -0
- package/dist/search/bm25.d.ts +17 -0
- package/dist/search/bm25.d.ts.map +1 -0
- package/dist/search/bm25.js +56 -0
- package/dist/search/bm25.js.map +1 -0
- package/dist/search/hybrid.d.ts +21 -0
- package/dist/search/hybrid.d.ts.map +1 -0
- package/dist/search/hybrid.js +50 -0
- package/dist/search/hybrid.js.map +1 -0
- package/dist/search/scope.d.ts +5 -0
- package/dist/search/scope.d.ts.map +1 -0
- package/dist/search/scope.js +107 -0
- package/dist/search/scope.js.map +1 -0
- package/dist/storage/encrypted-chunks.d.ts +40 -0
- package/dist/storage/encrypted-chunks.d.ts.map +1 -0
- package/dist/storage/encrypted-chunks.js +238 -0
- package/dist/storage/encrypted-chunks.js.map +1 -0
- package/dist/symbols/extract.d.ts +15 -0
- package/dist/symbols/extract.d.ts.map +1 -0
- package/dist/symbols/extract.js +208 -0
- package/dist/symbols/extract.js.map +1 -0
- package/dist/symbols/graph.d.ts +3 -0
- package/dist/symbols/graph.d.ts.map +1 -0
- package/dist/symbols/graph.js +89 -0
- package/dist/symbols/graph.js.map +1 -0
- package/dist/synthesis/conversational-synthesizer.d.ts +61 -0
- package/dist/synthesis/conversational-synthesizer.d.ts.map +1 -0
- package/dist/synthesis/conversational-synthesizer.js +289 -0
- package/dist/synthesis/conversational-synthesizer.js.map +1 -0
- package/dist/synthesis/markdown-formatter.d.ts +13 -0
- package/dist/synthesis/markdown-formatter.d.ts.map +1 -0
- package/dist/synthesis/markdown-formatter.js +104 -0
- package/dist/synthesis/markdown-formatter.js.map +1 -0
- package/dist/synthesis/prompt-builder.d.ts +21 -0
- package/dist/synthesis/prompt-builder.d.ts.map +1 -0
- package/dist/synthesis/prompt-builder.js +129 -0
- package/dist/synthesis/prompt-builder.js.map +1 -0
- package/dist/synthesis/synthesizer.d.ts +30 -0
- package/dist/synthesis/synthesizer.d.ts.map +1 -0
- package/dist/synthesis/synthesizer.js +213 -0
- package/dist/synthesis/synthesizer.js.map +1 -0
- package/dist/tests/rate-limiter.test.d.ts +2 -0
- package/dist/tests/rate-limiter.test.d.ts.map +1 -0
- package/dist/tests/rate-limiter.test.js +11 -0
- package/dist/tests/rate-limiter.test.js.map +1 -0
- package/dist/tests/search-normalization.test.d.ts +2 -0
- package/dist/tests/search-normalization.test.d.ts.map +1 -0
- package/dist/tests/search-normalization.test.js +9 -0
- package/dist/tests/search-normalization.test.js.map +1 -0
- package/dist/tests/semantic-chunker.test.d.ts +2 -0
- package/dist/tests/semantic-chunker.test.d.ts.map +1 -0
- package/dist/tests/semantic-chunker.test.js +48 -0
- package/dist/tests/semantic-chunker.test.js.map +1 -0
- package/dist/tests/simple-lru.test.d.ts +2 -0
- package/dist/tests/simple-lru.test.d.ts.map +1 -0
- package/dist/tests/simple-lru.test.js +21 -0
- package/dist/tests/simple-lru.test.js.map +1 -0
- package/dist/tests/symbol-boost.test.d.ts +2 -0
- package/dist/tests/symbol-boost.test.d.ts.map +1 -0
- package/dist/tests/symbol-boost.test.js +21 -0
- package/dist/tests/symbol-boost.test.js.map +1 -0
- package/dist/types/ast.d.ts +3 -0
- package/dist/types/ast.d.ts.map +1 -0
- package/dist/types/ast.js +2 -0
- package/dist/types/ast.js.map +1 -0
- package/dist/types/codemap.d.ts +58 -0
- package/dist/types/codemap.d.ts.map +1 -0
- package/dist/types/codemap.js +224 -0
- package/dist/types/codemap.js.map +1 -0
- package/dist/types/context-pack.d.ts +47 -0
- package/dist/types/context-pack.d.ts.map +1 -0
- package/dist/types/context-pack.js +44 -0
- package/dist/types/context-pack.js.map +1 -0
- package/dist/types/search.d.ts +15 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/search.js +11 -0
- package/dist/types/search.js.map +1 -0
- package/dist/utils/cli-ui.d.ts +44 -0
- package/dist/utils/cli-ui.d.ts.map +1 -0
- package/dist/utils/cli-ui.js +139 -0
- package/dist/utils/cli-ui.js.map +1 -0
- package/dist/utils/indexer-with-progress.d.ts +10 -0
- package/dist/utils/indexer-with-progress.d.ts.map +1 -0
- package/dist/utils/indexer-with-progress.js +43 -0
- package/dist/utils/indexer-with-progress.js.map +1 -0
- package/dist/utils/logger.d.ts +55 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +121 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mutex.d.ts +63 -0
- package/dist/utils/mutex.d.ts.map +1 -0
- package/dist/utils/mutex.js +123 -0
- package/dist/utils/mutex.js.map +1 -0
- package/dist/utils/path-helpers.d.ts +27 -0
- package/dist/utils/path-helpers.d.ts.map +1 -0
- package/dist/utils/path-helpers.js +55 -0
- package/dist/utils/path-helpers.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +34 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +178 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/scan-patterns.d.ts +5 -0
- package/dist/utils/scan-patterns.d.ts.map +1 -0
- package/dist/utils/scan-patterns.js +29 -0
- package/dist/utils/scan-patterns.js.map +1 -0
- package/dist/utils/simple-lru.d.ts +10 -0
- package/dist/utils/simple-lru.d.ts.map +1 -0
- package/dist/utils/simple-lru.js +38 -0
- package/dist/utils/simple-lru.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized configuration constants for CodeVault
|
|
3
|
+
*
|
|
4
|
+
* This file contains all magic numbers and configuration values used throughout
|
|
5
|
+
* the codebase. Centralizing these values makes the system easier to tune and
|
|
6
|
+
* understand.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Parsing and Tree-sitter Configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare const PARSING_CONSTANTS: {
|
|
12
|
+
/**
|
|
13
|
+
* Threshold in bytes to switch to streaming parser
|
|
14
|
+
* Large files above this size are parsed in chunks to avoid memory issues
|
|
15
|
+
*/
|
|
16
|
+
readonly SIZE_THRESHOLD: 30000;
|
|
17
|
+
/**
|
|
18
|
+
* Chunk size for streaming parser in bytes
|
|
19
|
+
* Parser will read this many bytes at a time when streaming
|
|
20
|
+
*/
|
|
21
|
+
readonly CHUNK_SIZE: 30000;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Cache Configuration
|
|
25
|
+
*/
|
|
26
|
+
export declare const CACHE_CONSTANTS: {
|
|
27
|
+
/** Maximum number of BM25 indexes to cache (LRU eviction) */
|
|
28
|
+
readonly MAX_BM25_CACHE_SIZE: number;
|
|
29
|
+
/** Maximum number of code chunks to cache in memory */
|
|
30
|
+
readonly MAX_CHUNK_TEXT_CACHE_SIZE: number;
|
|
31
|
+
/** Interval for periodic cache cleanup in MCP server (milliseconds) */
|
|
32
|
+
readonly CACHE_CLEAR_INTERVAL_MS: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Search Configuration
|
|
36
|
+
*/
|
|
37
|
+
export declare const SEARCH_CONSTANTS: {
|
|
38
|
+
/** Maximum candidates to send to reranking API */
|
|
39
|
+
readonly RERANKER_MAX_CANDIDATES: number;
|
|
40
|
+
/** Maximum code chunk size to return in bytes (prevents OOM) */
|
|
41
|
+
readonly MAX_CHUNK_SIZE: 100000;
|
|
42
|
+
/** Default result limit for search queries */
|
|
43
|
+
readonly DEFAULT_SEARCH_LIMIT: 10;
|
|
44
|
+
/** Maximum search results limit */
|
|
45
|
+
readonly MAX_SEARCH_LIMIT: 200;
|
|
46
|
+
/** Selection budget multiplier for hybrid search */
|
|
47
|
+
readonly SELECTION_BUDGET_MULTIPLIER: 60;
|
|
48
|
+
/** Reciprocal rank fusion constant */
|
|
49
|
+
readonly RRF_K_CONSTANT: 60;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Symbol Boosting Configuration
|
|
53
|
+
*/
|
|
54
|
+
export declare const SYMBOL_BOOST_CONSTANTS: {
|
|
55
|
+
/** Boost applied when query matches function signature */
|
|
56
|
+
readonly SIGNATURE_MATCH_BOOST: 0.3;
|
|
57
|
+
/** Boost applied when query matches neighbor functions */
|
|
58
|
+
readonly NEIGHBOR_MATCH_BOOST: 0.15;
|
|
59
|
+
/** Maximum total boost from symbol matching */
|
|
60
|
+
readonly MAX_SYMBOL_BOOST: 0.45;
|
|
61
|
+
/** Minimum token length for symbol matching */
|
|
62
|
+
readonly MIN_TOKEN_LENGTH: 3;
|
|
63
|
+
/** Maximum parameters to extract from signature */
|
|
64
|
+
readonly MAX_PARAMETERS: 12;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* File Watcher Configuration
|
|
68
|
+
*/
|
|
69
|
+
export declare const WATCHER_CONSTANTS: {
|
|
70
|
+
/** Default debounce interval in milliseconds */
|
|
71
|
+
readonly DEFAULT_DEBOUNCE_MS: 500;
|
|
72
|
+
/** Minimum debounce interval in milliseconds */
|
|
73
|
+
readonly MIN_DEBOUNCE_MS: 50;
|
|
74
|
+
/** Settle delay for watcher shutdown */
|
|
75
|
+
readonly SETTLE_DELAY_MS: 200;
|
|
76
|
+
/** Stability threshold for file write detection */
|
|
77
|
+
readonly STABILITY_THRESHOLD_MS: 100;
|
|
78
|
+
/** Poll interval for file stability check */
|
|
79
|
+
readonly POLL_INTERVAL_MS: 50;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Rate Limiting Configuration
|
|
83
|
+
*/
|
|
84
|
+
export declare const RATE_LIMIT_CONSTANTS: {
|
|
85
|
+
/** Retry delays for rate limit errors (milliseconds) */
|
|
86
|
+
readonly RETRY_DELAYS: readonly [1000, 2000, 5000, 10000];
|
|
87
|
+
/** Maximum queue size to prevent unbounded growth */
|
|
88
|
+
readonly DEFAULT_MAX_QUEUE_SIZE: 10000;
|
|
89
|
+
/** Delay buffer added to rate limit calculations */
|
|
90
|
+
readonly DELAY_BUFFER_MS: 100;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Batch Processing Configuration
|
|
94
|
+
*/
|
|
95
|
+
export declare const BATCH_CONSTANTS: {
|
|
96
|
+
/** Maximum retries for failed batches */
|
|
97
|
+
readonly MAX_BATCH_RETRIES: 3;
|
|
98
|
+
/** Initial retry delay for batch failures */
|
|
99
|
+
readonly INITIAL_RETRY_DELAY_MS: 1000;
|
|
100
|
+
/** Maximum tokens per batch for OpenAI */
|
|
101
|
+
readonly MAX_BATCH_TOKENS: 100000;
|
|
102
|
+
/** Maximum tokens per individual item */
|
|
103
|
+
readonly MAX_ITEM_TOKENS: 8191;
|
|
104
|
+
/** Default batch size for embedding generation */
|
|
105
|
+
readonly DEFAULT_BATCH_SIZE: 50;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Encryption Configuration
|
|
109
|
+
*/
|
|
110
|
+
export declare const ENCRYPTION_CONSTANTS: {
|
|
111
|
+
/** Magic header for encrypted files */
|
|
112
|
+
readonly MAGIC_HEADER: "CVAULTE1";
|
|
113
|
+
/** Salt length in bytes for key derivation */
|
|
114
|
+
readonly SALT_LENGTH: 16;
|
|
115
|
+
/** Initialization vector length in bytes */
|
|
116
|
+
readonly IV_LENGTH: 12;
|
|
117
|
+
/** Authentication tag length in bytes */
|
|
118
|
+
readonly TAG_LENGTH: 16;
|
|
119
|
+
/** HKDF info string for key derivation */
|
|
120
|
+
readonly HKDF_INFO: "codevault-chunk-v1";
|
|
121
|
+
/** Required encryption key length in bytes */
|
|
122
|
+
readonly REQUIRED_KEY_LENGTH: 32;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* LLM Configuration
|
|
126
|
+
*/
|
|
127
|
+
export declare const LLM_CONSTANTS: {
|
|
128
|
+
/** Default temperature for multi-query generation */
|
|
129
|
+
readonly MULTI_QUERY_TEMPERATURE: 0.3;
|
|
130
|
+
/** Default temperature for answer synthesis */
|
|
131
|
+
readonly DEFAULT_TEMPERATURE: 0.7;
|
|
132
|
+
/** Maximum tokens for multi-query response */
|
|
133
|
+
readonly MULTI_QUERY_MAX_TOKENS: 500;
|
|
134
|
+
/** Default maximum tokens for chat responses */
|
|
135
|
+
readonly DEFAULT_CHAT_MAX_TOKENS: 4096;
|
|
136
|
+
/** Maximum context chunks for answer synthesis */
|
|
137
|
+
readonly DEFAULT_MAX_CHUNKS: 10;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Chunking Configuration
|
|
141
|
+
*/
|
|
142
|
+
export declare const CHUNKING_CONSTANTS: {
|
|
143
|
+
/** Minimum token count for a valid chunk */
|
|
144
|
+
readonly MIN_CHUNK_TOKENS: 50;
|
|
145
|
+
/** Overlap percentage for line-based chunking */
|
|
146
|
+
readonly LINE_OVERLAP_PERCENTAGE: 0.2;
|
|
147
|
+
/** Maximum snippet length for signature extraction */
|
|
148
|
+
readonly MAX_SIGNATURE_SNIPPET: 400;
|
|
149
|
+
/** Maximum snippet length for call extraction */
|
|
150
|
+
readonly MAX_CALL_SNIPPET: 120;
|
|
151
|
+
/** Maximum snippet length for return type detection */
|
|
152
|
+
readonly MAX_RETURN_TYPE_SNIPPET: 80;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Conversational Chat Configuration
|
|
156
|
+
*/
|
|
157
|
+
export declare const CONVERSATION_CONSTANTS: {
|
|
158
|
+
/** Maximum distinct chunks retained in conversation cache */
|
|
159
|
+
readonly MAX_CONTEXT_CHUNKS: 200;
|
|
160
|
+
/** Characters to truncate prompts to */
|
|
161
|
+
readonly PROMPT_TRUNCATE_LENGTH: 2000;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Documentation boost configuration
|
|
165
|
+
*/
|
|
166
|
+
export declare const DOC_BOOST_CONSTANTS: {
|
|
167
|
+
/** Boost applied to README and documentation files */
|
|
168
|
+
readonly DOC_FILE_BOOST: 0.15;
|
|
169
|
+
/** Intent match boost */
|
|
170
|
+
readonly INTENT_MATCH_BOOST: 0.2;
|
|
171
|
+
/** Tag match boost per tag */
|
|
172
|
+
readonly TAG_MATCH_BOOST: 0.1;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Backward compatibility exports
|
|
176
|
+
* These maintain the old flat constant names for existing code
|
|
177
|
+
*/
|
|
178
|
+
export declare const SIZE_THRESHOLD: 30000;
|
|
179
|
+
export declare const CHUNK_SIZE: 30000;
|
|
180
|
+
export declare const MAX_CHUNK_SIZE: 100000;
|
|
181
|
+
export declare const RRF_K: 60;
|
|
182
|
+
export declare const DOC_BOOST: 0.15;
|
|
183
|
+
export declare const MAX_NEIGHBORS: 12;
|
|
184
|
+
export declare const PROMPT_TRUNCATE_LENGTH: 2000;
|
|
185
|
+
export declare const CONVERSATION_MAX_CONTEXT_CHUNKS: 200;
|
|
186
|
+
export declare const DEFAULT_CACHE_CLEAR_INTERVAL_MS: number;
|
|
187
|
+
/**
|
|
188
|
+
* Character estimation (4 chars ≈ 1 token)
|
|
189
|
+
*/
|
|
190
|
+
export declare const CHAR_TO_TOKEN_RATIO = 4;
|
|
191
|
+
/**
|
|
192
|
+
* Get all constants as a single object (useful for debugging)
|
|
193
|
+
*/
|
|
194
|
+
export declare const ALL_CONSTANTS: {
|
|
195
|
+
readonly PARSING: {
|
|
196
|
+
/**
|
|
197
|
+
* Threshold in bytes to switch to streaming parser
|
|
198
|
+
* Large files above this size are parsed in chunks to avoid memory issues
|
|
199
|
+
*/
|
|
200
|
+
readonly SIZE_THRESHOLD: 30000;
|
|
201
|
+
/**
|
|
202
|
+
* Chunk size for streaming parser in bytes
|
|
203
|
+
* Parser will read this many bytes at a time when streaming
|
|
204
|
+
*/
|
|
205
|
+
readonly CHUNK_SIZE: 30000;
|
|
206
|
+
};
|
|
207
|
+
readonly CACHE: {
|
|
208
|
+
/** Maximum number of BM25 indexes to cache (LRU eviction) */
|
|
209
|
+
readonly MAX_BM25_CACHE_SIZE: number;
|
|
210
|
+
/** Maximum number of code chunks to cache in memory */
|
|
211
|
+
readonly MAX_CHUNK_TEXT_CACHE_SIZE: number;
|
|
212
|
+
/** Interval for periodic cache cleanup in MCP server (milliseconds) */
|
|
213
|
+
readonly CACHE_CLEAR_INTERVAL_MS: number;
|
|
214
|
+
};
|
|
215
|
+
readonly SEARCH: {
|
|
216
|
+
/** Maximum candidates to send to reranking API */
|
|
217
|
+
readonly RERANKER_MAX_CANDIDATES: number;
|
|
218
|
+
/** Maximum code chunk size to return in bytes (prevents OOM) */
|
|
219
|
+
readonly MAX_CHUNK_SIZE: 100000;
|
|
220
|
+
/** Default result limit for search queries */
|
|
221
|
+
readonly DEFAULT_SEARCH_LIMIT: 10;
|
|
222
|
+
/** Maximum search results limit */
|
|
223
|
+
readonly MAX_SEARCH_LIMIT: 200;
|
|
224
|
+
/** Selection budget multiplier for hybrid search */
|
|
225
|
+
readonly SELECTION_BUDGET_MULTIPLIER: 60;
|
|
226
|
+
/** Reciprocal rank fusion constant */
|
|
227
|
+
readonly RRF_K_CONSTANT: 60;
|
|
228
|
+
};
|
|
229
|
+
readonly SYMBOL_BOOST: {
|
|
230
|
+
/** Boost applied when query matches function signature */
|
|
231
|
+
readonly SIGNATURE_MATCH_BOOST: 0.3;
|
|
232
|
+
/** Boost applied when query matches neighbor functions */
|
|
233
|
+
readonly NEIGHBOR_MATCH_BOOST: 0.15;
|
|
234
|
+
/** Maximum total boost from symbol matching */
|
|
235
|
+
readonly MAX_SYMBOL_BOOST: 0.45;
|
|
236
|
+
/** Minimum token length for symbol matching */
|
|
237
|
+
readonly MIN_TOKEN_LENGTH: 3;
|
|
238
|
+
/** Maximum parameters to extract from signature */
|
|
239
|
+
readonly MAX_PARAMETERS: 12;
|
|
240
|
+
};
|
|
241
|
+
readonly WATCHER: {
|
|
242
|
+
/** Default debounce interval in milliseconds */
|
|
243
|
+
readonly DEFAULT_DEBOUNCE_MS: 500;
|
|
244
|
+
/** Minimum debounce interval in milliseconds */
|
|
245
|
+
readonly MIN_DEBOUNCE_MS: 50;
|
|
246
|
+
/** Settle delay for watcher shutdown */
|
|
247
|
+
readonly SETTLE_DELAY_MS: 200;
|
|
248
|
+
/** Stability threshold for file write detection */
|
|
249
|
+
readonly STABILITY_THRESHOLD_MS: 100;
|
|
250
|
+
/** Poll interval for file stability check */
|
|
251
|
+
readonly POLL_INTERVAL_MS: 50;
|
|
252
|
+
};
|
|
253
|
+
readonly RATE_LIMIT: {
|
|
254
|
+
/** Retry delays for rate limit errors (milliseconds) */
|
|
255
|
+
readonly RETRY_DELAYS: readonly [1000, 2000, 5000, 10000];
|
|
256
|
+
/** Maximum queue size to prevent unbounded growth */
|
|
257
|
+
readonly DEFAULT_MAX_QUEUE_SIZE: 10000;
|
|
258
|
+
/** Delay buffer added to rate limit calculations */
|
|
259
|
+
readonly DELAY_BUFFER_MS: 100;
|
|
260
|
+
};
|
|
261
|
+
readonly BATCH: {
|
|
262
|
+
/** Maximum retries for failed batches */
|
|
263
|
+
readonly MAX_BATCH_RETRIES: 3;
|
|
264
|
+
/** Initial retry delay for batch failures */
|
|
265
|
+
readonly INITIAL_RETRY_DELAY_MS: 1000;
|
|
266
|
+
/** Maximum tokens per batch for OpenAI */
|
|
267
|
+
readonly MAX_BATCH_TOKENS: 100000;
|
|
268
|
+
/** Maximum tokens per individual item */
|
|
269
|
+
readonly MAX_ITEM_TOKENS: 8191;
|
|
270
|
+
/** Default batch size for embedding generation */
|
|
271
|
+
readonly DEFAULT_BATCH_SIZE: 50;
|
|
272
|
+
};
|
|
273
|
+
readonly ENCRYPTION: {
|
|
274
|
+
/** Magic header for encrypted files */
|
|
275
|
+
readonly MAGIC_HEADER: "CVAULTE1";
|
|
276
|
+
/** Salt length in bytes for key derivation */
|
|
277
|
+
readonly SALT_LENGTH: 16;
|
|
278
|
+
/** Initialization vector length in bytes */
|
|
279
|
+
readonly IV_LENGTH: 12;
|
|
280
|
+
/** Authentication tag length in bytes */
|
|
281
|
+
readonly TAG_LENGTH: 16;
|
|
282
|
+
/** HKDF info string for key derivation */
|
|
283
|
+
readonly HKDF_INFO: "codevault-chunk-v1";
|
|
284
|
+
/** Required encryption key length in bytes */
|
|
285
|
+
readonly REQUIRED_KEY_LENGTH: 32;
|
|
286
|
+
};
|
|
287
|
+
readonly LLM: {
|
|
288
|
+
/** Default temperature for multi-query generation */
|
|
289
|
+
readonly MULTI_QUERY_TEMPERATURE: 0.3;
|
|
290
|
+
/** Default temperature for answer synthesis */
|
|
291
|
+
readonly DEFAULT_TEMPERATURE: 0.7;
|
|
292
|
+
/** Maximum tokens for multi-query response */
|
|
293
|
+
readonly MULTI_QUERY_MAX_TOKENS: 500;
|
|
294
|
+
/** Default maximum tokens for chat responses */
|
|
295
|
+
readonly DEFAULT_CHAT_MAX_TOKENS: 4096;
|
|
296
|
+
/** Maximum context chunks for answer synthesis */
|
|
297
|
+
readonly DEFAULT_MAX_CHUNKS: 10;
|
|
298
|
+
};
|
|
299
|
+
readonly CHUNKING: {
|
|
300
|
+
/** Minimum token count for a valid chunk */
|
|
301
|
+
readonly MIN_CHUNK_TOKENS: 50;
|
|
302
|
+
/** Overlap percentage for line-based chunking */
|
|
303
|
+
readonly LINE_OVERLAP_PERCENTAGE: 0.2;
|
|
304
|
+
/** Maximum snippet length for signature extraction */
|
|
305
|
+
readonly MAX_SIGNATURE_SNIPPET: 400;
|
|
306
|
+
/** Maximum snippet length for call extraction */
|
|
307
|
+
readonly MAX_CALL_SNIPPET: 120;
|
|
308
|
+
/** Maximum snippet length for return type detection */
|
|
309
|
+
readonly MAX_RETURN_TYPE_SNIPPET: 80;
|
|
310
|
+
};
|
|
311
|
+
readonly CONVERSATION: {
|
|
312
|
+
/** Maximum distinct chunks retained in conversation cache */
|
|
313
|
+
readonly MAX_CONTEXT_CHUNKS: 200;
|
|
314
|
+
/** Characters to truncate prompts to */
|
|
315
|
+
readonly PROMPT_TRUNCATE_LENGTH: 2000;
|
|
316
|
+
};
|
|
317
|
+
readonly DOC_BOOST: {
|
|
318
|
+
/** Boost applied to README and documentation files */
|
|
319
|
+
readonly DOC_FILE_BOOST: 0.15;
|
|
320
|
+
/** Intent match boost */
|
|
321
|
+
readonly INTENT_MATCH_BOOST: 0.2;
|
|
322
|
+
/** Tag match boost per tag */
|
|
323
|
+
readonly TAG_MATCH_BOOST: 0.1;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;OAGG;;IAGH;;;OAGG;;CAEK,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B,6DAA6D;;IAG7D,uDAAuD;;IAGvD,uEAAuE;;CAE/D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,kDAAkD;;IAGlD,gEAAgE;;IAGhE,8CAA8C;;IAG9C,mCAAmC;;IAGnC,oDAAoD;;IA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;CAmDtB,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized configuration constants for CodeVault
|
|
3
|
+
*
|
|
4
|
+
* This file contains all magic numbers and configuration values used throughout
|
|
5
|
+
* the codebase. Centralizing these values makes the system easier to tune and
|
|
6
|
+
* understand.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Parsing and Tree-sitter Configuration
|
|
10
|
+
*/
|
|
11
|
+
export const PARSING_CONSTANTS = {
|
|
12
|
+
/**
|
|
13
|
+
* Threshold in bytes to switch to streaming parser
|
|
14
|
+
* Large files above this size are parsed in chunks to avoid memory issues
|
|
15
|
+
*/
|
|
16
|
+
SIZE_THRESHOLD: 30_000,
|
|
17
|
+
/**
|
|
18
|
+
* Chunk size for streaming parser in bytes
|
|
19
|
+
* Parser will read this many bytes at a time when streaming
|
|
20
|
+
*/
|
|
21
|
+
CHUNK_SIZE: 30_000,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Cache Configuration
|
|
25
|
+
*/
|
|
26
|
+
export const CACHE_CONSTANTS = {
|
|
27
|
+
/** Maximum number of BM25 indexes to cache (LRU eviction) */
|
|
28
|
+
MAX_BM25_CACHE_SIZE: parseInt(process.env.CODEVAULT_MAX_BM25_CACHE || '10', 10),
|
|
29
|
+
/** Maximum number of code chunks to cache in memory */
|
|
30
|
+
MAX_CHUNK_TEXT_CACHE_SIZE: parseInt(process.env.CODEVAULT_MAX_CHUNK_CACHE || '1000', 10),
|
|
31
|
+
/** Interval for periodic cache cleanup in MCP server (milliseconds) */
|
|
32
|
+
CACHE_CLEAR_INTERVAL_MS: parseInt(process.env.CODEVAULT_CACHE_CLEAR_INTERVAL || '3600000', 10), // 1 hour
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Search Configuration
|
|
36
|
+
*/
|
|
37
|
+
export const SEARCH_CONSTANTS = {
|
|
38
|
+
/** Maximum candidates to send to reranking API */
|
|
39
|
+
RERANKER_MAX_CANDIDATES: parseInt(process.env.CODEVAULT_RERANKER_MAX || '50', 10),
|
|
40
|
+
/** Maximum code chunk size to return in bytes (prevents OOM) */
|
|
41
|
+
MAX_CHUNK_SIZE: 100_000,
|
|
42
|
+
/** Default result limit for search queries */
|
|
43
|
+
DEFAULT_SEARCH_LIMIT: 10,
|
|
44
|
+
/** Maximum search results limit */
|
|
45
|
+
MAX_SEARCH_LIMIT: 200,
|
|
46
|
+
/** Selection budget multiplier for hybrid search */
|
|
47
|
+
SELECTION_BUDGET_MULTIPLIER: 60,
|
|
48
|
+
/** Reciprocal rank fusion constant */
|
|
49
|
+
RRF_K_CONSTANT: 60,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Symbol Boosting Configuration
|
|
53
|
+
*/
|
|
54
|
+
export const SYMBOL_BOOST_CONSTANTS = {
|
|
55
|
+
/** Boost applied when query matches function signature */
|
|
56
|
+
SIGNATURE_MATCH_BOOST: 0.3,
|
|
57
|
+
/** Boost applied when query matches neighbor functions */
|
|
58
|
+
NEIGHBOR_MATCH_BOOST: 0.15,
|
|
59
|
+
/** Maximum total boost from symbol matching */
|
|
60
|
+
MAX_SYMBOL_BOOST: 0.45,
|
|
61
|
+
/** Minimum token length for symbol matching */
|
|
62
|
+
MIN_TOKEN_LENGTH: 3,
|
|
63
|
+
/** Maximum parameters to extract from signature */
|
|
64
|
+
MAX_PARAMETERS: 12,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* File Watcher Configuration
|
|
68
|
+
*/
|
|
69
|
+
export const WATCHER_CONSTANTS = {
|
|
70
|
+
/** Default debounce interval in milliseconds */
|
|
71
|
+
DEFAULT_DEBOUNCE_MS: 500,
|
|
72
|
+
/** Minimum debounce interval in milliseconds */
|
|
73
|
+
MIN_DEBOUNCE_MS: 50,
|
|
74
|
+
/** Settle delay for watcher shutdown */
|
|
75
|
+
SETTLE_DELAY_MS: 200,
|
|
76
|
+
/** Stability threshold for file write detection */
|
|
77
|
+
STABILITY_THRESHOLD_MS: 100,
|
|
78
|
+
/** Poll interval for file stability check */
|
|
79
|
+
POLL_INTERVAL_MS: 50,
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Rate Limiting Configuration
|
|
83
|
+
*/
|
|
84
|
+
export const RATE_LIMIT_CONSTANTS = {
|
|
85
|
+
/** Retry delays for rate limit errors (milliseconds) */
|
|
86
|
+
RETRY_DELAYS: [1000, 2000, 5000, 10000],
|
|
87
|
+
/** Maximum queue size to prevent unbounded growth */
|
|
88
|
+
DEFAULT_MAX_QUEUE_SIZE: 10_000,
|
|
89
|
+
/** Delay buffer added to rate limit calculations */
|
|
90
|
+
DELAY_BUFFER_MS: 100,
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Batch Processing Configuration
|
|
94
|
+
*/
|
|
95
|
+
export const BATCH_CONSTANTS = {
|
|
96
|
+
/** Maximum retries for failed batches */
|
|
97
|
+
MAX_BATCH_RETRIES: 3,
|
|
98
|
+
/** Initial retry delay for batch failures */
|
|
99
|
+
INITIAL_RETRY_DELAY_MS: 1000,
|
|
100
|
+
/** Maximum tokens per batch for OpenAI */
|
|
101
|
+
MAX_BATCH_TOKENS: 100_000,
|
|
102
|
+
/** Maximum tokens per individual item */
|
|
103
|
+
MAX_ITEM_TOKENS: 8191,
|
|
104
|
+
/** Default batch size for embedding generation */
|
|
105
|
+
DEFAULT_BATCH_SIZE: 50,
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Encryption Configuration
|
|
109
|
+
*/
|
|
110
|
+
export const ENCRYPTION_CONSTANTS = {
|
|
111
|
+
/** Magic header for encrypted files */
|
|
112
|
+
MAGIC_HEADER: 'CVAULTE1',
|
|
113
|
+
/** Salt length in bytes for key derivation */
|
|
114
|
+
SALT_LENGTH: 16,
|
|
115
|
+
/** Initialization vector length in bytes */
|
|
116
|
+
IV_LENGTH: 12,
|
|
117
|
+
/** Authentication tag length in bytes */
|
|
118
|
+
TAG_LENGTH: 16,
|
|
119
|
+
/** HKDF info string for key derivation */
|
|
120
|
+
HKDF_INFO: 'codevault-chunk-v1',
|
|
121
|
+
/** Required encryption key length in bytes */
|
|
122
|
+
REQUIRED_KEY_LENGTH: 32,
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* LLM Configuration
|
|
126
|
+
*/
|
|
127
|
+
export const LLM_CONSTANTS = {
|
|
128
|
+
/** Default temperature for multi-query generation */
|
|
129
|
+
MULTI_QUERY_TEMPERATURE: 0.3,
|
|
130
|
+
/** Default temperature for answer synthesis */
|
|
131
|
+
DEFAULT_TEMPERATURE: 0.7,
|
|
132
|
+
/** Maximum tokens for multi-query response */
|
|
133
|
+
MULTI_QUERY_MAX_TOKENS: 500,
|
|
134
|
+
/** Default maximum tokens for chat responses */
|
|
135
|
+
DEFAULT_CHAT_MAX_TOKENS: 4096,
|
|
136
|
+
/** Maximum context chunks for answer synthesis */
|
|
137
|
+
DEFAULT_MAX_CHUNKS: 10,
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Chunking Configuration
|
|
141
|
+
*/
|
|
142
|
+
export const CHUNKING_CONSTANTS = {
|
|
143
|
+
/** Minimum token count for a valid chunk */
|
|
144
|
+
MIN_CHUNK_TOKENS: 50,
|
|
145
|
+
/** Overlap percentage for line-based chunking */
|
|
146
|
+
LINE_OVERLAP_PERCENTAGE: 0.2,
|
|
147
|
+
/** Maximum snippet length for signature extraction */
|
|
148
|
+
MAX_SIGNATURE_SNIPPET: 400,
|
|
149
|
+
/** Maximum snippet length for call extraction */
|
|
150
|
+
MAX_CALL_SNIPPET: 120,
|
|
151
|
+
/** Maximum snippet length for return type detection */
|
|
152
|
+
MAX_RETURN_TYPE_SNIPPET: 80,
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Conversational Chat Configuration
|
|
156
|
+
*/
|
|
157
|
+
export const CONVERSATION_CONSTANTS = {
|
|
158
|
+
/** Maximum distinct chunks retained in conversation cache */
|
|
159
|
+
MAX_CONTEXT_CHUNKS: 200,
|
|
160
|
+
/** Characters to truncate prompts to */
|
|
161
|
+
PROMPT_TRUNCATE_LENGTH: 2000,
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Documentation boost configuration
|
|
165
|
+
*/
|
|
166
|
+
export const DOC_BOOST_CONSTANTS = {
|
|
167
|
+
/** Boost applied to README and documentation files */
|
|
168
|
+
DOC_FILE_BOOST: 0.15,
|
|
169
|
+
/** Intent match boost */
|
|
170
|
+
INTENT_MATCH_BOOST: 0.2,
|
|
171
|
+
/** Tag match boost per tag */
|
|
172
|
+
TAG_MATCH_BOOST: 0.1,
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Backward compatibility exports
|
|
176
|
+
* These maintain the old flat constant names for existing code
|
|
177
|
+
*/
|
|
178
|
+
// Chunking thresholds
|
|
179
|
+
export const SIZE_THRESHOLD = PARSING_CONSTANTS.SIZE_THRESHOLD;
|
|
180
|
+
export const CHUNK_SIZE = PARSING_CONSTANTS.CHUNK_SIZE;
|
|
181
|
+
export const MAX_CHUNK_SIZE = SEARCH_CONSTANTS.MAX_CHUNK_SIZE;
|
|
182
|
+
// Search and ranking constants
|
|
183
|
+
export const RRF_K = SEARCH_CONSTANTS.RRF_K_CONSTANT;
|
|
184
|
+
export const DOC_BOOST = DOC_BOOST_CONSTANTS.DOC_FILE_BOOST;
|
|
185
|
+
// Symbol graph constants
|
|
186
|
+
export const MAX_NEIGHBORS = SYMBOL_BOOST_CONSTANTS.MAX_PARAMETERS;
|
|
187
|
+
// UI truncation limits
|
|
188
|
+
export const PROMPT_TRUNCATE_LENGTH = CONVERSATION_CONSTANTS.PROMPT_TRUNCATE_LENGTH;
|
|
189
|
+
// Conversational context limits
|
|
190
|
+
export const CONVERSATION_MAX_CONTEXT_CHUNKS = CONVERSATION_CONSTANTS.MAX_CONTEXT_CHUNKS;
|
|
191
|
+
// Cache cleanup interval (in milliseconds)
|
|
192
|
+
export const DEFAULT_CACHE_CLEAR_INTERVAL_MS = CACHE_CONSTANTS.CACHE_CLEAR_INTERVAL_MS;
|
|
193
|
+
/**
|
|
194
|
+
* Character estimation (4 chars ≈ 1 token)
|
|
195
|
+
*/
|
|
196
|
+
export const CHAR_TO_TOKEN_RATIO = 4;
|
|
197
|
+
/**
|
|
198
|
+
* Get all constants as a single object (useful for debugging)
|
|
199
|
+
*/
|
|
200
|
+
export const ALL_CONSTANTS = {
|
|
201
|
+
PARSING: PARSING_CONSTANTS,
|
|
202
|
+
CACHE: CACHE_CONSTANTS,
|
|
203
|
+
SEARCH: SEARCH_CONSTANTS,
|
|
204
|
+
SYMBOL_BOOST: SYMBOL_BOOST_CONSTANTS,
|
|
205
|
+
WATCHER: WATCHER_CONSTANTS,
|
|
206
|
+
RATE_LIMIT: RATE_LIMIT_CONSTANTS,
|
|
207
|
+
BATCH: BATCH_CONSTANTS,
|
|
208
|
+
ENCRYPTION: ENCRYPTION_CONSTANTS,
|
|
209
|
+
LLM: LLM_CONSTANTS,
|
|
210
|
+
CHUNKING: CHUNKING_CONSTANTS,
|
|
211
|
+
CONVERSATION: CONVERSATION_CONSTANTS,
|
|
212
|
+
DOC_BOOST: DOC_BOOST_CONSTANTS,
|
|
213
|
+
};
|
|
214
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;OAGG;IACH,cAAc,EAAE,MAAM;IAEtB;;;OAGG;IACH,UAAU,EAAE,MAAM;CACV,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,6DAA6D;IAC7D,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,IAAI,EAAE,EAAE,CAAC;IAE/E,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,EAAE,gBAAgB;IACxB,YAAY,EAAE,sBAAsB;IACpC,OAAO,EAAE,iBAAiB;IAC1B,UAAU,EAAE,oBAAoB;IAChC,KAAK,EAAE,eAAe;IACtB,UAAU,EAAE,oBAAoB;IAChC,GAAG,EAAE,aAAa;IAClB,QAAQ,EAAE,kBAAkB;IAC5B,YAAY,EAAE,sBAAsB;IACpC,SAAS,EAAE,mBAAmB;CACtB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { CodevaultConfig, ConfigSource } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read global configuration from ~/.codevault/config.json
|
|
4
|
+
* @readonly Never modifies files
|
|
5
|
+
*/
|
|
6
|
+
export declare function readGlobalConfig(): CodevaultConfig | null;
|
|
7
|
+
/**
|
|
8
|
+
* Read project-local configuration from .codevault/config.json
|
|
9
|
+
* @readonly Never modifies files
|
|
10
|
+
*/
|
|
11
|
+
export declare function readProjectConfig(basePath?: string): CodevaultConfig | null;
|
|
12
|
+
/**
|
|
13
|
+
* Read configuration from environment variables
|
|
14
|
+
* @readonly Never modifies files or environment
|
|
15
|
+
*/
|
|
16
|
+
export declare function readEnvConfig(): CodevaultConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Load merged configuration from all sources
|
|
19
|
+
* Priority: env > project > global
|
|
20
|
+
*
|
|
21
|
+
* @readonly Never modifies config files
|
|
22
|
+
* @param basePath Project path for project-local config
|
|
23
|
+
* @returns Merged configuration (in-memory only)
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadConfig(basePath?: string): CodevaultConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Get configuration sources for debugging
|
|
28
|
+
* @readonly Never modifies files
|
|
29
|
+
*/
|
|
30
|
+
export declare function getConfigSources(basePath?: string): ConfigSource;
|
|
31
|
+
/**
|
|
32
|
+
* Write global configuration (CLI only)
|
|
33
|
+
* This is the ONLY function that writes to disk
|
|
34
|
+
*/
|
|
35
|
+
export declare function saveGlobalConfig(config: CodevaultConfig): void;
|
|
36
|
+
/**
|
|
37
|
+
* Write project-local configuration (CLI only)
|
|
38
|
+
* This is the ONLY function that writes project config
|
|
39
|
+
*/
|
|
40
|
+
export declare function saveProjectConfig(config: CodevaultConfig, basePath?: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Check if global config exists
|
|
43
|
+
*/
|
|
44
|
+
export declare function hasGlobalConfig(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check if project config exists
|
|
47
|
+
*/
|
|
48
|
+
export declare function hasProjectConfig(basePath?: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get global config file path
|
|
51
|
+
*/
|
|
52
|
+
export declare function getGlobalConfigPath(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Get project config file path
|
|
55
|
+
*/
|
|
56
|
+
export declare function getProjectConfigPath(basePath?: string): string;
|
|
57
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAOhE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,GAAG,IAAI,CAWzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAM,GAAG,eAAe,GAAG,IAAI,CAaxE;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAyH/C;AA6ED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,SAAM,GAAG,eAAe,CAO1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAM,GAAG,YAAY,CAM7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAQ9D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,QAAQ,SAAM,GAAG,IAAI,CAW/E;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAM,GAAG,OAAO,CAGxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAM,GAAG,MAAM,CAE3D"}
|