@vybestack/llxprt-code-core 0.2.24 → 0.3.4-nightly.250912.5e46408e
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/code_assist/converter.js +35 -3
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +1 -1
- package/dist/src/code_assist/oauth2.js +18 -25
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/config/config.d.ts +33 -2
- package/dist/src/config/config.js +73 -13
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/storage.d.ts +33 -0
- package/dist/src/config/storage.js +93 -0
- package/dist/src/config/storage.js.map +1 -0
- package/dist/src/core/client.d.ts +8 -5
- package/dist/src/core/client.js +119 -20
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/contentGenerator.js +11 -0
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +18 -12
- package/dist/src/core/coreToolScheduler.js +235 -241
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/logger.d.ts +3 -1
- package/dist/src/core/logger.js +5 -3
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.js +2 -2
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/subagent.js +2 -12
- package/dist/src/core/subagent.js.map +1 -1
- package/dist/src/core/turn.d.ts +13 -2
- package/dist/src/core/turn.js +15 -4
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/filters/EmojiFilter.d.ts +5 -0
- package/dist/src/filters/EmojiFilter.js +3 -2
- package/dist/src/filters/EmojiFilter.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +8 -3
- package/dist/src/ide/detect-ide.js +29 -11
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +5 -4
- package/dist/src/ide/ide-client.js +21 -17
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-installer.d.ts +1 -1
- package/dist/src/ide/ide-installer.js +29 -20
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/process-utils.d.ts +7 -5
- package/dist/src/ide/process-utils.js +80 -47
- package/dist/src/ide/process-utils.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/file-token-store.d.ts +58 -0
- package/dist/src/mcp/file-token-store.js +181 -0
- package/dist/src/mcp/file-token-store.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.d.ts +13 -28
- package/dist/src/mcp/oauth-token-storage.js +21 -87
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +8 -0
- package/dist/src/mcp/oauth-utils.js +41 -27
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/token-store.d.ts +99 -0
- package/dist/src/mcp/token-store.js +77 -0
- package/dist/src/mcp/token-store.js.map +1 -0
- package/dist/src/parsers/TextToolCallParser.d.ts +5 -0
- package/dist/src/parsers/TextToolCallParser.js +3 -13
- package/dist/src/parsers/TextToolCallParser.js.map +1 -1
- package/dist/src/providers/anthropic/AnthropicProvider.d.ts +5 -0
- package/dist/src/providers/anthropic/AnthropicProvider.js +26 -8
- package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
- package/dist/src/providers/gemini/GeminiProvider.js +16 -1
- package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
- package/dist/src/providers/openai/OpenAIProvider.d.ts +15 -0
- package/dist/src/providers/openai/OpenAIProvider.js +99 -48
- package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
- package/dist/src/services/gitService.d.ts +3 -1
- package/dist/src/services/gitService.js +20 -10
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/history/ContentConverters.js +40 -1
- package/dist/src/services/history/ContentConverters.js.map +1 -1
- package/dist/src/services/loopDetectionService.js +8 -2
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +2 -1
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/settings/SettingsService.d.ts +5 -0
- package/dist/src/settings/SettingsService.js +5 -0
- package/dist/src/settings/SettingsService.js.map +1 -1
- package/dist/src/settings/settingsServiceInstance.d.ts +5 -0
- package/dist/src/settings/settingsServiceInstance.js +5 -0
- package/dist/src/settings/settingsServiceInstance.js.map +1 -1
- package/dist/src/settings/types.d.ts +5 -0
- package/dist/src/settings/types.js +3 -1
- package/dist/src/settings/types.js.map +1 -1
- package/dist/src/tools/IToolFormatter.d.ts +5 -0
- package/dist/src/tools/IToolFormatter.js +3 -13
- package/dist/src/tools/IToolFormatter.js.map +1 -1
- package/dist/src/tools/ToolFormatter.d.ts +18 -0
- package/dist/src/tools/ToolFormatter.js +41 -13
- package/dist/src/tools/ToolFormatter.js.map +1 -1
- package/dist/src/tools/doubleEscapeUtils.d.ts +3 -13
- package/dist/src/tools/doubleEscapeUtils.js +5 -0
- package/dist/src/tools/doubleEscapeUtils.js.map +1 -1
- package/dist/src/tools/edit.js +10 -1
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/glob.d.ts +0 -4
- package/dist/src/tools/glob.js +18 -42
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/grep.d.ts +0 -4
- package/dist/src/tools/grep.js +41 -77
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/ls.d.ts +2 -6
- package/dist/src/tools/ls.js +18 -13
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +7 -0
- package/dist/src/tools/mcp-client.js +26 -21
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-tool.js +12 -2
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/memoryTool.js +7 -2
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/read-file.js +2 -30
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-many-files.js +29 -52
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +46 -0
- package/dist/src/tools/ripGrep.js +368 -0
- package/dist/src/tools/ripGrep.js.map +1 -0
- package/dist/src/tools/shell.js +13 -2
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/todo-pause.js +0 -1
- package/dist/src/tools/todo-pause.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +18 -2
- package/dist/src/tools/tool-error.js +27 -1
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +13 -2
- package/dist/src/tools/tool-registry.js +30 -2
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tools.d.ts +7 -5
- package/dist/src/tools/tools.js +12 -0
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-fetch.js +101 -76
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-search-invocation.js +13 -1
- package/dist/src/tools/web-search-invocation.js.map +1 -1
- package/dist/src/utils/deterministicEditCorrector.d.ts +28 -0
- package/dist/src/utils/deterministicEditCorrector.js +295 -0
- package/dist/src/utils/deterministicEditCorrector.js.map +1 -0
- package/dist/src/utils/editCorrector.d.ts +4 -4
- package/dist/src/utils/editCorrector.js +15 -213
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editor.js +1 -1
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/errors.d.ts +19 -0
- package/dist/src/utils/errors.js +32 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +2 -7
- package/dist/src/utils/fileUtils.js +16 -47
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +1 -0
- package/dist/src/utils/filesearch/fileSearch.js +14 -9
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/ignorePatterns.d.ts +103 -0
- package/dist/src/utils/ignorePatterns.js +220 -0
- package/dist/src/utils/ignorePatterns.js.map +1 -0
- package/dist/src/utils/installationManager.d.ts +16 -0
- package/dist/src/utils/installationManager.js +50 -0
- package/dist/src/utils/installationManager.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +1 -1
- package/dist/src/utils/memoryDiscovery.js +64 -43
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/paths.d.ts +0 -17
- package/dist/src/utils/paths.js +0 -26
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +4 -0
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +1 -1
- package/dist/src/utils/shell-utils.js +23 -29
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.d.ts +19 -0
- package/dist/src/utils/tool-utils.js +58 -0
- package/dist/src/utils/tool-utils.js.map +1 -0
- package/dist/src/utils/userAccountManager.d.ts +20 -0
- package/dist/src/utils/userAccountManager.js +122 -0
- package/dist/src/utils/userAccountManager.js.map +1 -0
- package/dist/src/utils/workspaceContext.js +11 -5
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/package.json +7 -3
- package/dist/src/utils/nextSpeakerChecker.d.ts +0 -12
- package/dist/src/utils/nextSpeakerChecker.js +0 -97
- package/dist/src/utils/nextSpeakerChecker.js.map +0 -1
- package/dist/src/utils/user_account.d.ts +0 -9
- package/dist/src/utils/user_account.js +0 -109
- package/dist/src/utils/user_account.js.map +0 -1
- package/dist/src/utils/user_id.d.ts +0 -11
- package/dist/src/utils/user_id.js +0 -49
- package/dist/src/utils/user_id.js.map +0 -1
@@ -9,6 +9,7 @@ import { loadIgnoreRules } from './ignore.js';
|
|
9
9
|
import { ResultCache } from './result-cache.js';
|
10
10
|
import { crawl } from './crawler.js';
|
11
11
|
import { AsyncFzf } from 'fzf';
|
12
|
+
import { unescapePath } from '../paths.js';
|
12
13
|
export class AbortError extends Error {
|
13
14
|
constructor(message = 'Search aborted') {
|
14
15
|
super(message);
|
@@ -76,10 +77,12 @@ class RecursiveFileSearch {
|
|
76
77
|
this.buildResultCache();
|
77
78
|
}
|
78
79
|
async search(pattern, options = {}) {
|
79
|
-
if (!this.resultCache ||
|
80
|
+
if (!this.resultCache ||
|
81
|
+
(!this.fzf && !this.options.disableFuzzySearch) ||
|
82
|
+
!this.ignore) {
|
80
83
|
throw new Error('Engine not initialized. Call initialize() first.');
|
81
84
|
}
|
82
|
-
pattern = pattern || '*';
|
85
|
+
pattern = unescapePath(pattern) || '*';
|
83
86
|
let filteredCandidates;
|
84
87
|
const { files: candidates, isExactMatch } = await this.resultCache.get(pattern);
|
85
88
|
if (isExactMatch) {
|
@@ -88,7 +91,7 @@ class RecursiveFileSearch {
|
|
88
91
|
}
|
89
92
|
else {
|
90
93
|
let shouldCache = true;
|
91
|
-
if (pattern.includes('*')) {
|
94
|
+
if (pattern.includes('*') || !this.fzf) {
|
92
95
|
filteredCandidates = await filter(candidates, pattern, options.signal);
|
93
96
|
}
|
94
97
|
else {
|
@@ -127,12 +130,14 @@ class RecursiveFileSearch {
|
|
127
130
|
}
|
128
131
|
buildResultCache() {
|
129
132
|
this.resultCache = new ResultCache(this.allFiles);
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
133
|
+
if (!this.options.disableFuzzySearch) {
|
134
|
+
// The v1 algorithm is much faster since it only looks at the first
|
135
|
+
// occurence of the pattern. We use it for search spaces that have >20k
|
136
|
+
// files, because the v2 algorithm is just too slow in those cases.
|
137
|
+
this.fzf = new AsyncFzf(this.allFiles, {
|
138
|
+
fuzzy: this.allFiles.length > 20000 ? 'v1' : 'v2',
|
139
|
+
});
|
140
|
+
}
|
136
141
|
}
|
137
142
|
}
|
138
143
|
class DirectoryFileSearch {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fileSearch.js","sourceRoot":"","sources":["../../../../src/utils/filesearch/fileSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAU,eAAe,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAiB,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"fileSearch.js","sourceRoot":"","sources":["../../../../src/utils/filesearch/fileSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAU,eAAe,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAiB,MAAM,KAAK,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAc3C,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAO,GAAG,gBAAgB;QACpC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,QAAkB,EAClB,OAAe,EACf,MAA+B;IAE/B,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,EAAE;QACvC,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,MAAM,OAAO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: Apache-2.0
|
5
|
+
*/
|
6
|
+
import { Config } from '../config/config.js';
|
7
|
+
/**
|
8
|
+
* Common ignore patterns used across multiple tools for basic exclusions.
|
9
|
+
* These are the most commonly ignored directories in development projects.
|
10
|
+
*/
|
11
|
+
export declare const COMMON_IGNORE_PATTERNS: string[];
|
12
|
+
/**
|
13
|
+
* Binary file extension patterns that are typically excluded from text processing.
|
14
|
+
*/
|
15
|
+
export declare const BINARY_FILE_PATTERNS: string[];
|
16
|
+
/**
|
17
|
+
* Media file patterns that require special handling in tools like read-many-files.
|
18
|
+
* These files can be processed as inlineData when explicitly requested.
|
19
|
+
*/
|
20
|
+
export declare const MEDIA_FILE_PATTERNS: string[];
|
21
|
+
/**
|
22
|
+
* Common directory patterns that are typically ignored in development projects.
|
23
|
+
*/
|
24
|
+
export declare const COMMON_DIRECTORY_EXCLUDES: string[];
|
25
|
+
/**
|
26
|
+
* Python-specific patterns.
|
27
|
+
*/
|
28
|
+
export declare const PYTHON_EXCLUDES: string[];
|
29
|
+
/**
|
30
|
+
* System and environment file patterns.
|
31
|
+
*/
|
32
|
+
export declare const SYSTEM_FILE_EXCLUDES: string[];
|
33
|
+
/**
|
34
|
+
* Comprehensive file exclusion patterns combining all common ignore patterns.
|
35
|
+
* These patterns are compatible with glob ignore patterns.
|
36
|
+
* Note: Media files (PDF, images) are not excluded here as they need special handling in read-many-files.
|
37
|
+
*/
|
38
|
+
export declare const DEFAULT_FILE_EXCLUDES: string[];
|
39
|
+
/**
|
40
|
+
* Options for configuring file exclusion patterns.
|
41
|
+
*/
|
42
|
+
export interface ExcludeOptions {
|
43
|
+
/**
|
44
|
+
* Whether to include default exclusion patterns. Defaults to true.
|
45
|
+
*/
|
46
|
+
includeDefaults?: boolean;
|
47
|
+
/**
|
48
|
+
* Additional custom patterns from configuration.
|
49
|
+
*/
|
50
|
+
customPatterns?: string[];
|
51
|
+
/**
|
52
|
+
* Additional patterns provided at runtime (e.g., from CLI arguments).
|
53
|
+
*/
|
54
|
+
runtimePatterns?: string[];
|
55
|
+
/**
|
56
|
+
* Whether to include dynamic patterns like the current LLxprt MD filename. Defaults to true.
|
57
|
+
*/
|
58
|
+
includeDynamicPatterns?: boolean;
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Centralized file exclusion utility that provides configurable and extensible
|
62
|
+
* file exclusion patterns for different tools and use cases.
|
63
|
+
*/
|
64
|
+
export declare class FileExclusions {
|
65
|
+
private config?;
|
66
|
+
constructor(config?: Config | undefined);
|
67
|
+
/**
|
68
|
+
* Gets core ignore patterns for basic file operations like glob.
|
69
|
+
* These are the minimal essential patterns that should almost always be excluded.
|
70
|
+
*/
|
71
|
+
getCoreIgnorePatterns(): string[];
|
72
|
+
/**
|
73
|
+
* Gets comprehensive default exclusion patterns for operations like read-many-files.
|
74
|
+
* Includes all standard exclusions: directories, binary files, system files, etc.
|
75
|
+
*/
|
76
|
+
getDefaultExcludePatterns(options?: ExcludeOptions): string[];
|
77
|
+
/**
|
78
|
+
* Gets exclude patterns for read-many-files tool with legacy compatibility.
|
79
|
+
* This maintains the same behavior as the previous getDefaultExcludes() function.
|
80
|
+
*/
|
81
|
+
getReadManyFilesExcludes(additionalExcludes?: string[]): string[];
|
82
|
+
/**
|
83
|
+
* Gets exclude patterns for glob tool operations.
|
84
|
+
* Uses core patterns by default but can be extended with additional patterns.
|
85
|
+
*/
|
86
|
+
getGlobExcludes(additionalExcludes?: string[]): string[];
|
87
|
+
/**
|
88
|
+
* Builds exclude patterns with full customization options.
|
89
|
+
* This is the most flexible method for advanced use cases.
|
90
|
+
*/
|
91
|
+
buildExcludePatterns(options: ExcludeOptions): string[];
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Extracts file extensions from glob patterns.
|
95
|
+
* Converts patterns like glob/*.exe to .exe
|
96
|
+
* Handles brace expansion like glob/*.{js,ts} to .js and .ts
|
97
|
+
*/
|
98
|
+
export declare function extractExtensionsFromPatterns(patterns: string[]): string[];
|
99
|
+
/**
|
100
|
+
* Binary file extensions extracted from BINARY_FILE_PATTERNS for quick lookup.
|
101
|
+
* Additional extensions not covered by the patterns are included for completeness.
|
102
|
+
*/
|
103
|
+
export declare const BINARY_EXTENSIONS: string[];
|
@@ -0,0 +1,220 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2025 Google LLC
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
import path from 'path';
|
7
|
+
import { getCurrentLlxprtMdFilename } from '../tools/memoryTool.js';
|
8
|
+
/**
|
9
|
+
* Common ignore patterns used across multiple tools for basic exclusions.
|
10
|
+
* These are the most commonly ignored directories in development projects.
|
11
|
+
*/
|
12
|
+
export const COMMON_IGNORE_PATTERNS = [
|
13
|
+
'**/node_modules/**',
|
14
|
+
'**/.git/**',
|
15
|
+
'**/bower_components/**',
|
16
|
+
'**/.svn/**',
|
17
|
+
'**/.hg/**',
|
18
|
+
];
|
19
|
+
/**
|
20
|
+
* Binary file extension patterns that are typically excluded from text processing.
|
21
|
+
*/
|
22
|
+
export const BINARY_FILE_PATTERNS = [
|
23
|
+
'**/*.bin',
|
24
|
+
'**/*.exe',
|
25
|
+
'**/*.dll',
|
26
|
+
'**/*.so',
|
27
|
+
'**/*.dylib',
|
28
|
+
'**/*.class',
|
29
|
+
'**/*.jar',
|
30
|
+
'**/*.war',
|
31
|
+
'**/*.zip',
|
32
|
+
'**/*.tar',
|
33
|
+
'**/*.gz',
|
34
|
+
'**/*.bz2',
|
35
|
+
'**/*.rar',
|
36
|
+
'**/*.7z',
|
37
|
+
'**/*.doc',
|
38
|
+
'**/*.docx',
|
39
|
+
'**/*.xls',
|
40
|
+
'**/*.xlsx',
|
41
|
+
'**/*.ppt',
|
42
|
+
'**/*.pptx',
|
43
|
+
'**/*.odt',
|
44
|
+
'**/*.ods',
|
45
|
+
'**/*.odp',
|
46
|
+
];
|
47
|
+
/**
|
48
|
+
* Media file patterns that require special handling in tools like read-many-files.
|
49
|
+
* These files can be processed as inlineData when explicitly requested.
|
50
|
+
*/
|
51
|
+
export const MEDIA_FILE_PATTERNS = [
|
52
|
+
'**/*.pdf',
|
53
|
+
'**/*.png',
|
54
|
+
'**/*.jpg',
|
55
|
+
'**/*.jpeg',
|
56
|
+
'**/*.gif',
|
57
|
+
'**/*.webp',
|
58
|
+
'**/*.bmp',
|
59
|
+
'**/*.svg',
|
60
|
+
];
|
61
|
+
/**
|
62
|
+
* Common directory patterns that are typically ignored in development projects.
|
63
|
+
*/
|
64
|
+
export const COMMON_DIRECTORY_EXCLUDES = [
|
65
|
+
'**/.vscode/**',
|
66
|
+
'**/.idea/**',
|
67
|
+
'**/dist/**',
|
68
|
+
'**/build/**',
|
69
|
+
'**/coverage/**',
|
70
|
+
'**/__pycache__/**',
|
71
|
+
];
|
72
|
+
/**
|
73
|
+
* Python-specific patterns.
|
74
|
+
*/
|
75
|
+
export const PYTHON_EXCLUDES = ['**/*.pyc', '**/*.pyo'];
|
76
|
+
/**
|
77
|
+
* System and environment file patterns.
|
78
|
+
*/
|
79
|
+
export const SYSTEM_FILE_EXCLUDES = ['**/.DS_Store', '**/.env'];
|
80
|
+
/**
|
81
|
+
* Comprehensive file exclusion patterns combining all common ignore patterns.
|
82
|
+
* These patterns are compatible with glob ignore patterns.
|
83
|
+
* Note: Media files (PDF, images) are not excluded here as they need special handling in read-many-files.
|
84
|
+
*/
|
85
|
+
export const DEFAULT_FILE_EXCLUDES = [
|
86
|
+
...COMMON_IGNORE_PATTERNS,
|
87
|
+
...COMMON_DIRECTORY_EXCLUDES,
|
88
|
+
...BINARY_FILE_PATTERNS,
|
89
|
+
...PYTHON_EXCLUDES,
|
90
|
+
...SYSTEM_FILE_EXCLUDES,
|
91
|
+
];
|
92
|
+
/**
|
93
|
+
* Centralized file exclusion utility that provides configurable and extensible
|
94
|
+
* file exclusion patterns for different tools and use cases.
|
95
|
+
*/
|
96
|
+
export class FileExclusions {
|
97
|
+
config;
|
98
|
+
constructor(config) {
|
99
|
+
this.config = config;
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* Gets core ignore patterns for basic file operations like glob.
|
103
|
+
* These are the minimal essential patterns that should almost always be excluded.
|
104
|
+
*/
|
105
|
+
getCoreIgnorePatterns() {
|
106
|
+
return [...COMMON_IGNORE_PATTERNS];
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* Gets comprehensive default exclusion patterns for operations like read-many-files.
|
110
|
+
* Includes all standard exclusions: directories, binary files, system files, etc.
|
111
|
+
*/
|
112
|
+
getDefaultExcludePatterns(options = {}) {
|
113
|
+
const { includeDefaults = true, customPatterns = [], runtimePatterns = [], includeDynamicPatterns = true, } = options;
|
114
|
+
const patterns = [];
|
115
|
+
// Add base defaults if requested
|
116
|
+
if (includeDefaults) {
|
117
|
+
patterns.push(...DEFAULT_FILE_EXCLUDES);
|
118
|
+
}
|
119
|
+
// Add dynamic patterns (like current LLxprt MD filename)
|
120
|
+
if (includeDynamicPatterns) {
|
121
|
+
patterns.push(`**/${getCurrentLlxprtMdFilename()}`);
|
122
|
+
}
|
123
|
+
// Add custom patterns from configuration
|
124
|
+
// TODO: getCustomExcludes method needs to be implemented in Config interface
|
125
|
+
if (this.config) {
|
126
|
+
const configCustomExcludes = this.config.getCustomExcludes?.() ?? [];
|
127
|
+
patterns.push(...configCustomExcludes);
|
128
|
+
}
|
129
|
+
// Add user-provided custom patterns
|
130
|
+
patterns.push(...customPatterns);
|
131
|
+
// Add runtime patterns (e.g., from CLI)
|
132
|
+
patterns.push(...runtimePatterns);
|
133
|
+
return patterns;
|
134
|
+
}
|
135
|
+
/**
|
136
|
+
* Gets exclude patterns for read-many-files tool with legacy compatibility.
|
137
|
+
* This maintains the same behavior as the previous getDefaultExcludes() function.
|
138
|
+
*/
|
139
|
+
getReadManyFilesExcludes(additionalExcludes = []) {
|
140
|
+
return this.getDefaultExcludePatterns({
|
141
|
+
includeDefaults: true,
|
142
|
+
runtimePatterns: additionalExcludes,
|
143
|
+
includeDynamicPatterns: true,
|
144
|
+
});
|
145
|
+
}
|
146
|
+
/**
|
147
|
+
* Gets exclude patterns for glob tool operations.
|
148
|
+
* Uses core patterns by default but can be extended with additional patterns.
|
149
|
+
*/
|
150
|
+
getGlobExcludes(additionalExcludes = []) {
|
151
|
+
const corePatterns = this.getCoreIgnorePatterns();
|
152
|
+
// Add any custom patterns from config if available
|
153
|
+
// TODO: getCustomExcludes method needs to be implemented in Config interface
|
154
|
+
const configPatterns = this.config?.getCustomExcludes?.() ?? [];
|
155
|
+
return [...corePatterns, ...configPatterns, ...additionalExcludes];
|
156
|
+
}
|
157
|
+
/**
|
158
|
+
* Builds exclude patterns with full customization options.
|
159
|
+
* This is the most flexible method for advanced use cases.
|
160
|
+
*/
|
161
|
+
buildExcludePatterns(options) {
|
162
|
+
return this.getDefaultExcludePatterns(options);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
/**
|
166
|
+
* Extracts file extensions from glob patterns.
|
167
|
+
* Converts patterns like glob/*.exe to .exe
|
168
|
+
* Handles brace expansion like glob/*.{js,ts} to .js and .ts
|
169
|
+
*/
|
170
|
+
export function extractExtensionsFromPatterns(patterns) {
|
171
|
+
const extensions = new Set(patterns
|
172
|
+
.filter((pattern) => pattern.includes('*.'))
|
173
|
+
.flatMap((pattern) => {
|
174
|
+
const extPart = pattern.substring(pattern.lastIndexOf('*.') + 1);
|
175
|
+
// Handle brace expansion e.g. `**/*.{jpg,png}`
|
176
|
+
if (extPart.startsWith('.{') && extPart.endsWith('}')) {
|
177
|
+
const inner = extPart.slice(2, -1); // get 'jpg,png'
|
178
|
+
return inner
|
179
|
+
.split(',')
|
180
|
+
.map((ext) => `.${ext.trim()}`)
|
181
|
+
.filter((ext) => ext !== '.');
|
182
|
+
}
|
183
|
+
// Handle simple/compound/dotfile extensions
|
184
|
+
if (extPart.startsWith('.') &&
|
185
|
+
!extPart.includes('/') &&
|
186
|
+
!extPart.includes('{') &&
|
187
|
+
!extPart.includes('}')) {
|
188
|
+
// Using path.extname on a dummy file handles various cases like
|
189
|
+
// '.tar.gz' -> '.gz' and '.profile' -> '.profile' correctly.
|
190
|
+
const extracted = path.extname(`dummy${extPart}`);
|
191
|
+
// If extname returns empty (e.g. for '.'), use the original part.
|
192
|
+
// Then filter out empty or '.' results and invalid double dot patterns.
|
193
|
+
const result = extracted || extPart;
|
194
|
+
return result && result !== '.' && !result.substring(1).includes('.')
|
195
|
+
? [result]
|
196
|
+
: [];
|
197
|
+
}
|
198
|
+
return [];
|
199
|
+
}));
|
200
|
+
return Array.from(extensions).sort();
|
201
|
+
}
|
202
|
+
/**
|
203
|
+
* Binary file extensions extracted from BINARY_FILE_PATTERNS for quick lookup.
|
204
|
+
* Additional extensions not covered by the patterns are included for completeness.
|
205
|
+
*/
|
206
|
+
export const BINARY_EXTENSIONS = [
|
207
|
+
...extractExtensionsFromPatterns([
|
208
|
+
...BINARY_FILE_PATTERNS,
|
209
|
+
...MEDIA_FILE_PATTERNS,
|
210
|
+
...PYTHON_EXCLUDES,
|
211
|
+
]),
|
212
|
+
// Additional binary extensions not in the main patterns
|
213
|
+
'.dat',
|
214
|
+
'.obj',
|
215
|
+
'.o',
|
216
|
+
'.a',
|
217
|
+
'.lib',
|
218
|
+
'.wasm',
|
219
|
+
].sort();
|
220
|
+
//# sourceMappingURL=ignorePatterns.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ignorePatterns.js","sourceRoot":"","sources":["../../../src/utils/ignorePatterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAa;IAC9C,oBAAoB;IACpB,YAAY;IACZ,wBAAwB;IACxB,YAAY;IACZ,WAAW;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAa;IAC5C,UAAU;IACV,UAAU;IACV,UAAU;IACV,SA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MAAM,GAAG,SAAS,IAAI,OAAO,CAAC;YACpC,OAAO,MAAM,IAAI,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACnE,CAAC,CAAC,CAAC,MAAM,CAAC;gBACV,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CACL,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACzC,GAAG,6BAA6B,CAAC;QAC/B,GAAG,oBAAoB;QACvB,GAAG,mBAAmB;QACtB,GAAG,eAAe;KACnB,CAAC;IACF,wDAAwD;IACxD,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,OAAO;CACR,CAAC,IAAI,EAAE,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2025 Google LLC
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
export declare class InstallationManager {
|
7
|
+
private getInstallationIdPath;
|
8
|
+
private readInstallationIdFromFile;
|
9
|
+
private writeInstallationIdToFile;
|
10
|
+
/**
|
11
|
+
* Retrieves the installation ID from a file, creating it if it doesn't exist.
|
12
|
+
* This ID is used for unique user installation tracking.
|
13
|
+
* @returns A UUID string for the user.
|
14
|
+
*/
|
15
|
+
getInstallationId(): string;
|
16
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* Copyright 2025 Google LLC
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
5
|
+
*/
|
6
|
+
import * as fs from 'fs';
|
7
|
+
import { randomUUID } from 'crypto';
|
8
|
+
import * as path from 'node:path';
|
9
|
+
import { Storage } from '../config/storage.js';
|
10
|
+
export class InstallationManager {
|
11
|
+
getInstallationIdPath() {
|
12
|
+
return Storage.getInstallationIdPath();
|
13
|
+
}
|
14
|
+
readInstallationIdFromFile() {
|
15
|
+
const installationIdFile = this.getInstallationIdPath();
|
16
|
+
if (fs.existsSync(installationIdFile)) {
|
17
|
+
const installationid = fs
|
18
|
+
.readFileSync(installationIdFile, 'utf-8')
|
19
|
+
.trim();
|
20
|
+
return installationid || null;
|
21
|
+
}
|
22
|
+
return null;
|
23
|
+
}
|
24
|
+
writeInstallationIdToFile(installationId) {
|
25
|
+
const installationIdFile = this.getInstallationIdPath();
|
26
|
+
const dir = path.dirname(installationIdFile);
|
27
|
+
fs.mkdirSync(dir, { recursive: true });
|
28
|
+
fs.writeFileSync(installationIdFile, installationId, 'utf-8');
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Retrieves the installation ID from a file, creating it if it doesn't exist.
|
32
|
+
* This ID is used for unique user installation tracking.
|
33
|
+
* @returns A UUID string for the user.
|
34
|
+
*/
|
35
|
+
getInstallationId() {
|
36
|
+
try {
|
37
|
+
let installationId = this.readInstallationIdFromFile();
|
38
|
+
if (!installationId) {
|
39
|
+
installationId = randomUUID();
|
40
|
+
this.writeInstallationIdToFile(installationId);
|
41
|
+
}
|
42
|
+
return installationId;
|
43
|
+
}
|
44
|
+
catch (error) {
|
45
|
+
console.error('Error accessing installation ID file, generating ephemeral ID:', error);
|
46
|
+
return '123456789';
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
//# sourceMappingURL=installationManager.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"installationManager.js","sourceRoot":"","sources":["../../../src/utils/installationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,WAAW,CA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 @@
|
|
6
6
|
import { FileDiscoveryService } from '../services/fileDiscoveryService.js';
|
7
7
|
import { FileFilteringOptions } from '../config/config.js';
|
8
8
|
/**
|
9
|
-
* Loads hierarchical
|
9
|
+
* Loads hierarchical GEMINI.md files and concatenates their content.
|
10
10
|
* This function is intended for use by the server.
|
11
11
|
*/
|
12
12
|
export declare function loadServerHierarchicalMemory(currentWorkingDirectory: string, includeDirectoriesToReadGemini: readonly string[], debugMode: boolean, fileService: FileDiscoveryService, extensionContextFilePaths?: string[], importFormat?: 'flat' | 'tree', fileFilteringOptions?: FileFilteringOptions, maxDirs?: number): Promise<{
|