@google/gemini-cli-core 0.1.18 → 0.1.19-nightly.250814.514e883a
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/README.md +199 -132
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/src/code_assist/converter.d.ts +3 -2
- package/dist/src/code_assist/converter.js +2 -2
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +48 -1
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +1 -1
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/server.test.js +4 -1
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.js +48 -17
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js +105 -5
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/config/config.d.ts +25 -6
- package/dist/src/config/config.js +47 -16
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +95 -1
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/core/client.d.ts +8 -5
- package/dist/src/core/client.js +184 -119
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +342 -37
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +3 -2
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +3 -2
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +21 -8
- package/dist/src/core/coreToolScheduler.js +170 -61
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +183 -41
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +7 -6
- package/dist/src/core/geminiChat.js +43 -43
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/logger.d.ts +1 -0
- package/dist/src/core/logger.js +18 -0
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +29 -0
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +29 -0
- package/dist/src/core/loggingContentGenerator.js +97 -0
- package/dist/src/core/loggingContentGenerator.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +20 -1
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +7 -31
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/subagent.d.ts +230 -0
- package/dist/src/core/subagent.js +447 -0
- package/dist/src/core/subagent.js.map +1 -0
- package/dist/src/core/subagent.test.d.ts +6 -0
- package/dist/src/core/subagent.test.js +515 -0
- package/dist/src/core/subagent.test.js.map +1 -0
- package/dist/src/core/turn.js +1 -0
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +4 -0
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +12 -2
- package/dist/src/ide/detect-ide.js +64 -5
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.d.ts +6 -0
- package/dist/src/ide/detect-ide.test.js +65 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +20 -1
- package/dist/src/ide/ide-client.js +145 -19
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-installer.js +1 -26
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +0 -4
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/ideContext.d.ts +95 -0
- package/dist/src/ide/ideContext.js +45 -0
- package/dist/src/ide/ideContext.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.js +9 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +45 -10
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-provider.d.ts +0 -1
- package/dist/src/mcp/oauth-provider.js +0 -1
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mocks/msw.d.ts +6 -0
- package/dist/src/mocks/msw.js +8 -0
- package/dist/src/mocks/msw.js.map +1 -0
- package/dist/src/services/loopDetectionService.js +14 -11
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +191 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +29 -9
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +8 -0
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +50 -7
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +236 -116
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +6 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +281 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +8 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +17 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +2 -2
- package/dist/src/telemetry/index.js +2 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +2 -1
- package/dist/src/telemetry/loggers.js +15 -0
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +7 -2
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +7 -2
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +3 -2
- package/dist/src/telemetry/metrics.js +7 -1
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +50 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sdk.d.ts +1 -1
- package/dist/src/telemetry/sdk.js +13 -5
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/telemetry.test.js +2 -2
- package/dist/src/telemetry/telemetry.test.js.map +1 -1
- package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
- package/dist/src/telemetry/tool-call-decision.js +29 -0
- package/dist/src/telemetry/tool-call-decision.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +37 -21
- package/dist/src/telemetry/types.js +55 -44
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +4 -1
- package/dist/src/telemetry/uiTelemetry.js +3 -1
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +13 -2
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +16 -0
- package/dist/src/test-utils/config.js +32 -0
- package/dist/src/test-utils/config.js.map +1 -0
- package/dist/src/test-utils/tools.d.ts +23 -0
- package/dist/src/test-utils/tools.js +41 -0
- package/dist/src/test-utils/tools.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +2 -0
- package/dist/src/tools/diffOptions.js +28 -0
- package/dist/src/tools/diffOptions.js.map +1 -1
- package/dist/src/tools/diffOptions.test.d.ts +6 -0
- package/dist/src/tools/diffOptions.test.js +119 -0
- package/dist/src/tools/diffOptions.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +9 -33
- package/dist/src/tools/edit.js +142 -132
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +115 -51
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +3 -10
- package/dist/src/tools/glob.js +85 -89
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +22 -12
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +3 -35
- package/dist/src/tools/grep.js +111 -83
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +40 -23
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +3 -22
- package/dist/src/tools/ls.js +81 -78
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +62 -34
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +14 -3
- package/dist/src/tools/mcp-client.js +82 -6
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +340 -5
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +6 -13
- package/dist/src/tools/mcp-tool.js +41 -31
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +53 -51
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +10 -14
- package/dist/src/tools/memoryTool.js +128 -121
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +38 -18
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/modifiable-tool.d.ts +8 -5
- package/dist/src/tools/modifiable-tool.js +4 -1
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +3 -3
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +4 -6
- package/dist/src/tools/read-file.js +92 -45
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +192 -130
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +4 -5
- package/dist/src/tools/read-many-files.js +120 -103
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +81 -47
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +4 -6
- package/dist/src/tools/shell.js +99 -101
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +43 -28
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +4 -0
- package/dist/src/tools/tool-error.js +4 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +17 -20
- package/dist/src/tools/tool-registry.js +35 -77
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +19 -192
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +156 -54
- package/dist/src/tools/tools.js +196 -25
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.d.ts +6 -0
- package/dist/src/tools/tools.test.js +117 -0
- package/dist/src/tools/tools.test.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +4 -7
- package/dist/src/tools/web-fetch.js +62 -63
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +8 -4
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.js +3 -3
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +8 -3
- package/dist/src/tools/write-file.js +89 -22
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +112 -8
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +28 -56
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/editCorrector.js +8 -9
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +21 -0
- package/dist/src/utils/environmentContext.js +90 -0
- package/dist/src/utils/environmentContext.js.map +1 -0
- package/dist/src/utils/environmentContext.test.d.ts +6 -0
- package/dist/src/utils/environmentContext.test.js +139 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -0
- package/dist/src/utils/errorParsing.d.ts +8 -0
- package/dist/src/utils/errorParsing.js +93 -0
- package/dist/src/utils/errorParsing.js.map +1 -0
- package/dist/src/utils/errorParsing.test.d.ts +6 -0
- package/dist/src/utils/errorParsing.test.js +172 -0
- package/dist/src/utils/errorParsing.test.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +7 -0
- package/dist/src/utils/fileUtils.js +15 -12
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +6 -5
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawlCache.d.ts +1 -1
- package/dist/src/utils/filesearch/crawlCache.js +4 -1
- package/dist/src/utils/filesearch/crawlCache.js.map +1 -1
- package/dist/src/utils/filesearch/crawlCache.test.js +10 -0
- package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +2 -0
- package/dist/src/utils/filesearch/fileSearch.js +33 -8
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +139 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/filesearch/result-cache.d.ts +1 -2
- package/dist/src/utils/filesearch/result-cache.js +1 -3
- package/dist/src/utils/filesearch/result-cache.js.map +1 -1
- package/dist/src/utils/filesearch/result-cache.test.js +3 -4
- package/dist/src/utils/filesearch/result-cache.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.js +4 -1
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +1 -1
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +17 -20
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.js +5 -6
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +2 -2
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.d.ts +1 -5
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/schemaValidator.d.ts +1 -8
- package/dist/src/utils/schemaValidator.js +1 -32
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/dist/google-gemini-cli-core-0.1.17.tgz +0 -0
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { BaseDeclarativeTool, BaseToolInvocation, Kind, } from './tools.js';
|
|
7
7
|
import { SchemaValidator } from '../utils/schemaValidator.js';
|
|
8
8
|
import { getErrorMessage } from '../utils/errors.js';
|
|
9
9
|
import * as path from 'path';
|
|
10
10
|
import { glob } from 'glob';
|
|
11
11
|
import { getCurrentGeminiMdFilename } from './memoryTool.js';
|
|
12
12
|
import { detectFileType, processSingleFileContent, DEFAULT_ENCODING, getSpecificMimeType, } from '../utils/fileUtils.js';
|
|
13
|
-
import { Type } from '@google/genai';
|
|
14
13
|
import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/config.js';
|
|
15
14
|
import { recordFileOperationMetric, FileOperation, } from '../telemetry/metrics.js';
|
|
16
15
|
/**
|
|
@@ -58,104 +57,34 @@ const DEFAULT_EXCLUDES = [
|
|
|
58
57
|
`**/${getCurrentGeminiMdFilename()}`,
|
|
59
58
|
];
|
|
60
59
|
const DEFAULT_OUTPUT_SEPARATOR_FORMAT = '--- {filePath} ---';
|
|
61
|
-
|
|
62
|
-
* Tool implementation for finding and reading multiple text files from the local filesystem
|
|
63
|
-
* within a specified target directory. The content is concatenated.
|
|
64
|
-
* It is intended to run in an environment with access to the local file system (e.g., a Node.js backend).
|
|
65
|
-
*/
|
|
66
|
-
export class ReadManyFilesTool extends BaseTool {
|
|
60
|
+
class ReadManyFilesToolInvocation extends BaseToolInvocation {
|
|
67
61
|
config;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const parameterSchema = {
|
|
71
|
-
type: Type.OBJECT,
|
|
72
|
-
properties: {
|
|
73
|
-
paths: {
|
|
74
|
-
type: Type.ARRAY,
|
|
75
|
-
items: {
|
|
76
|
-
type: Type.STRING,
|
|
77
|
-
minLength: '1',
|
|
78
|
-
},
|
|
79
|
-
minItems: '1',
|
|
80
|
-
description: "Required. An array of glob patterns or paths relative to the tool's target directory. Examples: ['src/**/*.ts'], ['README.md', 'docs/']",
|
|
81
|
-
},
|
|
82
|
-
include: {
|
|
83
|
-
type: Type.ARRAY,
|
|
84
|
-
items: {
|
|
85
|
-
type: Type.STRING,
|
|
86
|
-
minLength: '1',
|
|
87
|
-
},
|
|
88
|
-
description: 'Optional. Additional glob patterns to include. These are merged with `paths`. Example: ["*.test.ts"] to specifically add test files if they were broadly excluded.',
|
|
89
|
-
default: [],
|
|
90
|
-
},
|
|
91
|
-
exclude: {
|
|
92
|
-
type: Type.ARRAY,
|
|
93
|
-
items: {
|
|
94
|
-
type: Type.STRING,
|
|
95
|
-
minLength: '1',
|
|
96
|
-
},
|
|
97
|
-
description: 'Optional. Glob patterns for files/directories to exclude. Added to default excludes if useDefaultExcludes is true. Example: ["**/*.log", "temp/"]',
|
|
98
|
-
default: [],
|
|
99
|
-
},
|
|
100
|
-
recursive: {
|
|
101
|
-
type: Type.BOOLEAN,
|
|
102
|
-
description: 'Optional. Whether to search recursively (primarily controlled by `**` in glob patterns). Defaults to true.',
|
|
103
|
-
default: true,
|
|
104
|
-
},
|
|
105
|
-
useDefaultExcludes: {
|
|
106
|
-
type: Type.BOOLEAN,
|
|
107
|
-
description: 'Optional. Whether to apply a list of default exclusion patterns (e.g., node_modules, .git, binary files). Defaults to true.',
|
|
108
|
-
default: true,
|
|
109
|
-
},
|
|
110
|
-
file_filtering_options: {
|
|
111
|
-
description: 'Whether to respect ignore patterns from .gitignore or .geminiignore',
|
|
112
|
-
type: Type.OBJECT,
|
|
113
|
-
properties: {
|
|
114
|
-
respect_git_ignore: {
|
|
115
|
-
description: 'Optional: Whether to respect .gitignore patterns when listing files. Only available in git repositories. Defaults to true.',
|
|
116
|
-
type: Type.BOOLEAN,
|
|
117
|
-
},
|
|
118
|
-
respect_gemini_ignore: {
|
|
119
|
-
description: 'Optional: Whether to respect .geminiignore patterns when listing files. Defaults to true.',
|
|
120
|
-
type: Type.BOOLEAN,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
required: ['paths'],
|
|
126
|
-
};
|
|
127
|
-
super(ReadManyFilesTool.Name, 'ReadManyFiles', `Reads content from multiple files specified by paths or glob patterns within a configured target directory. For text files, it concatenates their content into a single string. It is primarily designed for text-based files. However, it can also process image (e.g., .png, .jpg) and PDF (.pdf) files if their file names or extensions are explicitly included in the 'paths' argument. For these explicitly requested non-text files, their data is read and included in a format suitable for model consumption (e.g., base64 encoded).
|
|
128
|
-
|
|
129
|
-
This tool is useful when you need to understand or analyze a collection of files, such as:
|
|
130
|
-
- Getting an overview of a codebase or parts of it (e.g., all TypeScript files in the 'src' directory).
|
|
131
|
-
- Finding where specific functionality is implemented if the user asks broad questions about code.
|
|
132
|
-
- Reviewing documentation files (e.g., all Markdown files in the 'docs' directory).
|
|
133
|
-
- Gathering context from multiple configuration files.
|
|
134
|
-
- When the user asks to "read all files in X directory" or "show me the content of all Y files".
|
|
135
|
-
|
|
136
|
-
Use this tool when the user's query implies needing the content of several files simultaneously for context, analysis, or summarization. For text files, it uses default UTF-8 encoding and a '--- {filePath} ---' separator between file contents. Ensure paths are relative to the target directory. Glob patterns like 'src/**/*.js' are supported. Avoid using for single files if a more specific single-file reading tool is available, unless the user specifically requests to process a list containing just one file via this tool. Other binary files (not explicitly requested as image/PDF) are generally skipped. Default excludes apply to common non-text files (except for explicitly requested images/PDFs) and large dependency directories unless 'useDefaultExcludes' is false.`, Icon.FileSearch, parameterSchema);
|
|
62
|
+
constructor(config, params) {
|
|
63
|
+
super(params);
|
|
137
64
|
this.config = config;
|
|
138
65
|
}
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
getDescription(params) {
|
|
147
|
-
const allPatterns = [...params.paths, ...(params.include || [])];
|
|
148
|
-
const pathDesc = `using patterns: \`${allPatterns.join('`, `')}\` (within target directory: \`${this.config.getTargetDir()}\`)`;
|
|
66
|
+
getDescription() {
|
|
67
|
+
const allPatterns = [...this.params.paths, ...(this.params.include || [])];
|
|
68
|
+
const pathDesc = `using patterns:
|
|
69
|
+
${allPatterns.join('`, `')}
|
|
70
|
+
(within target directory:
|
|
71
|
+
${this.config.getTargetDir()}
|
|
72
|
+
) `;
|
|
149
73
|
// Determine the final list of exclusion patterns exactly as in execute method
|
|
150
|
-
const paramExcludes = params.exclude || [];
|
|
151
|
-
const paramUseDefaultExcludes = params.useDefaultExcludes !== false;
|
|
74
|
+
const paramExcludes = this.params.exclude || [];
|
|
75
|
+
const paramUseDefaultExcludes = this.params.useDefaultExcludes !== false;
|
|
152
76
|
const geminiIgnorePatterns = this.config
|
|
153
77
|
.getFileService()
|
|
154
78
|
.getGeminiIgnorePatterns();
|
|
155
79
|
const finalExclusionPatternsForDescription = paramUseDefaultExcludes
|
|
156
80
|
? [...DEFAULT_EXCLUDES, ...paramExcludes, ...geminiIgnorePatterns]
|
|
157
81
|
: [...paramExcludes, ...geminiIgnorePatterns];
|
|
158
|
-
let excludeDesc = `Excluding: ${finalExclusionPatternsForDescription.length > 0
|
|
82
|
+
let excludeDesc = `Excluding: ${finalExclusionPatternsForDescription.length > 0
|
|
83
|
+
? `patterns like
|
|
84
|
+
${finalExclusionPatternsForDescription
|
|
85
|
+
.slice(0, 2)
|
|
86
|
+
.join('`, `')}${finalExclusionPatternsForDescription.length > 2 ? '...`' : '`'}`
|
|
87
|
+
: 'none specified'}`;
|
|
159
88
|
// Add a note if .geminiignore patterns contributed to the final list of exclusions
|
|
160
89
|
if (geminiIgnorePatterns.length > 0) {
|
|
161
90
|
const geminiPatternsInEffect = geminiIgnorePatterns.filter((p) => finalExclusionPatternsForDescription.includes(p)).length;
|
|
@@ -165,20 +94,13 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
165
94
|
}
|
|
166
95
|
return `Will attempt to read and concatenate files ${pathDesc}. ${excludeDesc}. File encoding: ${DEFAULT_ENCODING}. Separator: "${DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace('{filePath}', 'path/to/file.ext')}".`;
|
|
167
96
|
}
|
|
168
|
-
async execute(
|
|
169
|
-
const
|
|
170
|
-
if (validationError) {
|
|
171
|
-
return {
|
|
172
|
-
llmContent: `Error: Invalid parameters for ${this.displayName}. Reason: ${validationError}`,
|
|
173
|
-
returnDisplay: `## Parameter Error\n\n${validationError}`,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
const { paths: inputPatterns, include = [], exclude = [], useDefaultExcludes = true, } = params;
|
|
97
|
+
async execute(signal) {
|
|
98
|
+
const { paths: inputPatterns, include = [], exclude = [], useDefaultExcludes = true, } = this.params;
|
|
177
99
|
const defaultFileIgnores = this.config.getFileFilteringOptions() ?? DEFAULT_FILE_FILTERING_OPTIONS;
|
|
178
100
|
const fileFilteringOptions = {
|
|
179
|
-
respectGitIgnore: params.file_filtering_options?.respect_git_ignore ??
|
|
101
|
+
respectGitIgnore: this.params.file_filtering_options?.respect_git_ignore ??
|
|
180
102
|
defaultFileIgnores.respectGitIgnore, // Use the property from the returned object
|
|
181
|
-
respectGeminiIgnore: params.file_filtering_options?.respect_gemini_ignore ??
|
|
103
|
+
respectGeminiIgnore: this.params.file_filtering_options?.respect_gemini_ignore ??
|
|
182
104
|
defaultFileIgnores.respectGeminiIgnore, // Use the property from the returned object
|
|
183
105
|
};
|
|
184
106
|
// Get centralized file discovery service
|
|
@@ -346,10 +268,16 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
346
268
|
const { filePath, relativePathForDisplay, fileReadResult } = fileResult;
|
|
347
269
|
if (typeof fileReadResult.llmContent === 'string') {
|
|
348
270
|
const separator = DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace('{filePath}', filePath);
|
|
349
|
-
|
|
271
|
+
let fileContentForLlm = '';
|
|
272
|
+
if (fileReadResult.isTruncated) {
|
|
273
|
+
fileContentForLlm += `[WARNING: This file was truncated. To view the full content, use the 'read_file' tool on this specific file.]\n\n`;
|
|
274
|
+
}
|
|
275
|
+
fileContentForLlm += fileReadResult.llmContent;
|
|
276
|
+
contentParts.push(`${separator}\n\n${fileContentForLlm}\n\n`);
|
|
350
277
|
}
|
|
351
278
|
else {
|
|
352
|
-
|
|
279
|
+
// This is a Part for image/pdf, which we don't add the separator to.
|
|
280
|
+
contentParts.push(fileReadResult.llmContent);
|
|
353
281
|
}
|
|
354
282
|
processedFilesRelativePaths.push(relativePathForDisplay);
|
|
355
283
|
const lines = typeof fileReadResult.llmContent === 'string'
|
|
@@ -412,4 +340,93 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
412
340
|
};
|
|
413
341
|
}
|
|
414
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Tool implementation for finding and reading multiple text files from the local filesystem
|
|
345
|
+
* within a specified target directory. The content is concatenated.
|
|
346
|
+
* It is intended to run in an environment with access to the local file system (e.g., a Node.js backend).
|
|
347
|
+
*/
|
|
348
|
+
export class ReadManyFilesTool extends BaseDeclarativeTool {
|
|
349
|
+
config;
|
|
350
|
+
static Name = 'read_many_files';
|
|
351
|
+
constructor(config) {
|
|
352
|
+
const parameterSchema = {
|
|
353
|
+
type: 'object',
|
|
354
|
+
properties: {
|
|
355
|
+
paths: {
|
|
356
|
+
type: 'array',
|
|
357
|
+
items: {
|
|
358
|
+
type: 'string',
|
|
359
|
+
minLength: 1,
|
|
360
|
+
},
|
|
361
|
+
minItems: 1,
|
|
362
|
+
description: "Required. An array of glob patterns or paths relative to the tool's target directory. Examples: ['src/**/*.ts'], ['README.md', 'docs/']",
|
|
363
|
+
},
|
|
364
|
+
include: {
|
|
365
|
+
type: 'array',
|
|
366
|
+
items: {
|
|
367
|
+
type: 'string',
|
|
368
|
+
minLength: 1,
|
|
369
|
+
},
|
|
370
|
+
description: 'Optional. Additional glob patterns to include. These are merged with `paths`. Example: "*.test.ts" to specifically add test files if they were broadly excluded.',
|
|
371
|
+
default: [],
|
|
372
|
+
},
|
|
373
|
+
exclude: {
|
|
374
|
+
type: 'array',
|
|
375
|
+
items: {
|
|
376
|
+
type: 'string',
|
|
377
|
+
minLength: 1,
|
|
378
|
+
},
|
|
379
|
+
description: 'Optional. Glob patterns for files/directories to exclude. Added to default excludes if useDefaultExcludes is true. Example: "**/*.log", "temp/"',
|
|
380
|
+
default: [],
|
|
381
|
+
},
|
|
382
|
+
recursive: {
|
|
383
|
+
type: 'boolean',
|
|
384
|
+
description: 'Optional. Whether to search recursively (primarily controlled by `**` in glob patterns). Defaults to true.',
|
|
385
|
+
default: true,
|
|
386
|
+
},
|
|
387
|
+
useDefaultExcludes: {
|
|
388
|
+
type: 'boolean',
|
|
389
|
+
description: 'Optional. Whether to apply a list of default exclusion patterns (e.g., node_modules, .git, binary files). Defaults to true.',
|
|
390
|
+
default: true,
|
|
391
|
+
},
|
|
392
|
+
file_filtering_options: {
|
|
393
|
+
description: 'Whether to respect ignore patterns from .gitignore or .geminiignore',
|
|
394
|
+
type: 'object',
|
|
395
|
+
properties: {
|
|
396
|
+
respect_git_ignore: {
|
|
397
|
+
description: 'Optional: Whether to respect .gitignore patterns when listing files. Only available in git repositories. Defaults to true.',
|
|
398
|
+
type: 'boolean',
|
|
399
|
+
},
|
|
400
|
+
respect_gemini_ignore: {
|
|
401
|
+
description: 'Optional: Whether to respect .geminiignore patterns when listing files. Defaults to true.',
|
|
402
|
+
type: 'boolean',
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
required: ['paths'],
|
|
408
|
+
};
|
|
409
|
+
super(ReadManyFilesTool.Name, 'ReadManyFiles', `Reads content from multiple files specified by paths or glob patterns within a configured target directory. For text files, it concatenates their content into a single string. It is primarily designed for text-based files. However, it can also process image (e.g., .png, .jpg) and PDF (.pdf) files if their file names or extensions are explicitly included in the 'paths' argument. For these explicitly requested non-text files, their data is read and included in a format suitable for model consumption (e.g., base64 encoded).
|
|
410
|
+
|
|
411
|
+
This tool is useful when you need to understand or analyze a collection of files, such as:
|
|
412
|
+
- Getting an overview of a codebase or parts of it (e.g., all TypeScript files in the 'src' directory).
|
|
413
|
+
- Finding where specific functionality is implemented if the user asks broad questions about code.
|
|
414
|
+
- Reviewing documentation files (e.g., all Markdown files in the 'docs' directory).
|
|
415
|
+
- Gathering context from multiple configuration files.
|
|
416
|
+
- When the user asks to "read all files in X directory" or "show me the content of all Y files".
|
|
417
|
+
|
|
418
|
+
Use this tool when the user's query implies needing the content of several files simultaneously for context, analysis, or summarization. For text files, it uses default UTF-8 encoding and a '--- {filePath} ---' separator between file contents. Ensure paths are relative to the target directory. Glob patterns like 'src/**/*.js' are supported. Avoid using for single files if a more specific single-file reading tool is available, unless the user specifically requests to process a list containing just one file via this tool. Other binary files (not explicitly requested as image/PDF) are generally skipped. Default excludes apply to common non-text files (except for explicitly requested images/PDFs) and large dependency directories unless 'useDefaultExcludes' is false.`, Kind.Read, parameterSchema);
|
|
419
|
+
this.config = config;
|
|
420
|
+
}
|
|
421
|
+
validateToolParams(params) {
|
|
422
|
+
const errors = SchemaValidator.validate(this.schema.parametersJsonSchema, params);
|
|
423
|
+
if (errors) {
|
|
424
|
+
return errors;
|
|
425
|
+
}
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
createInvocation(params) {
|
|
429
|
+
return new ReadManyFilesToolInvocation(this.config, params);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
415
432
|
//# sourceMappingURL=read-many-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-many-files.js","sourceRoot":"","sources":["../../../src/tools/read-many-files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAyB,IAAI,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAU,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EACL,yBAAyB,EACzB,aAAa,GACd,MAAM,yBAAyB,CAAC;AAsEjC;;;;;GAKG;AACH,MAAM,gBAAgB,GAAa;IACjC,oBAAoB;IACpB,YAAY;IACZ,eAAe;IACf,aAAa;IACb,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,mBAAmB;IACnB,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,WAAW;IACX,UAAU;I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|
|
97
97
|
fs.rmSync(tempDirOutsideRoot, { recursive: true, force: true });
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
|
-
describe('
|
|
101
|
-
it('should return
|
|
100
|
+
describe('build', () => {
|
|
101
|
+
it('should return an invocation for valid relative paths within root', () => {
|
|
102
102
|
const params = { paths: ['file1.txt', 'subdir/file2.txt'] };
|
|
103
|
-
|
|
103
|
+
const invocation = tool.build(params);
|
|
104
|
+
expect(invocation).toBeDefined();
|
|
104
105
|
});
|
|
105
|
-
it('should return
|
|
106
|
+
it('should return an invocation for valid glob patterns within root', () => {
|
|
106
107
|
const params = { paths: ['*.txt', 'subdir/**/*.js'] };
|
|
107
|
-
|
|
108
|
+
const invocation = tool.build(params);
|
|
109
|
+
expect(invocation).toBeDefined();
|
|
108
110
|
});
|
|
109
|
-
it('should return
|
|
111
|
+
it('should return an invocation for paths trying to escape the root (e.g., ../) as execute handles this', () => {
|
|
110
112
|
const params = { paths: ['../outside.txt'] };
|
|
111
|
-
|
|
113
|
+
const invocation = tool.build(params);
|
|
114
|
+
expect(invocation).toBeDefined();
|
|
112
115
|
});
|
|
113
|
-
it('should return
|
|
116
|
+
it('should return an invocation for absolute paths as execute handles this', () => {
|
|
114
117
|
const params = { paths: [path.join(tempDirOutsideRoot, 'absolute.txt')] };
|
|
115
|
-
|
|
118
|
+
const invocation = tool.build(params);
|
|
119
|
+
expect(invocation).toBeDefined();
|
|
116
120
|
});
|
|
117
|
-
it('should
|
|
121
|
+
it('should throw error if paths array is empty', () => {
|
|
118
122
|
const params = { paths: [] };
|
|
119
|
-
expect(tool.
|
|
123
|
+
expect(() => tool.build(params)).toThrow('params/paths must NOT have fewer than 1 items');
|
|
120
124
|
});
|
|
121
|
-
it('should return
|
|
125
|
+
it('should return an invocation for valid exclude and include patterns', () => {
|
|
122
126
|
const params = {
|
|
123
127
|
paths: ['src/**/*.ts'],
|
|
124
128
|
exclude: ['**/*.test.ts'],
|
|
125
129
|
include: ['src/utils/*.ts'],
|
|
126
130
|
};
|
|
127
|
-
|
|
131
|
+
const invocation = tool.build(params);
|
|
132
|
+
expect(invocation).toBeDefined();
|
|
128
133
|
});
|
|
129
|
-
it('should
|
|
134
|
+
it('should throw error if paths array contains an empty string', () => {
|
|
130
135
|
const params = { paths: ['file1.txt', ''] };
|
|
131
|
-
expect(tool.
|
|
136
|
+
expect(() => tool.build(params)).toThrow('params/paths/1 must NOT have fewer than 1 characters');
|
|
132
137
|
});
|
|
133
|
-
it('should
|
|
138
|
+
it('should throw error if include array contains non-string elements', () => {
|
|
134
139
|
const params = {
|
|
135
140
|
paths: ['file1.txt'],
|
|
136
141
|
include: ['*.ts', 123],
|
|
137
142
|
};
|
|
138
|
-
expect(tool.
|
|
143
|
+
expect(() => tool.build(params)).toThrow('params/include/1 must be string');
|
|
139
144
|
});
|
|
140
|
-
it('should
|
|
145
|
+
it('should throw error if exclude array contains non-string elements', () => {
|
|
141
146
|
const params = {
|
|
142
147
|
paths: ['file1.txt'],
|
|
143
148
|
exclude: ['*.log', {}],
|
|
144
149
|
};
|
|
145
|
-
expect(tool.
|
|
150
|
+
expect(() => tool.build(params)).toThrow('params/exclude/1 must be string');
|
|
146
151
|
});
|
|
147
152
|
});
|
|
148
153
|
describe('execute', () => {
|
|
@@ -159,7 +164,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
159
164
|
it('should read a single specified file', async () => {
|
|
160
165
|
createFile('file1.txt', 'Content of file1');
|
|
161
166
|
const params = { paths: ['file1.txt'] };
|
|
162
|
-
const
|
|
167
|
+
const invocation = tool.build(params);
|
|
168
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
163
169
|
const expectedPath = path.join(tempRootDir, 'file1.txt');
|
|
164
170
|
expect(result.llmContent).toEqual([
|
|
165
171
|
`--- ${expectedPath} ---\n\nContent of file1\n\n`,
|
|
@@ -170,7 +176,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
170
176
|
createFile('file1.txt', 'Content1');
|
|
171
177
|
createFile('subdir/file2.js', 'Content2');
|
|
172
178
|
const params = { paths: ['file1.txt', 'subdir/file2.js'] };
|
|
173
|
-
const
|
|
179
|
+
const invocation = tool.build(params);
|
|
180
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
174
181
|
const content = result.llmContent;
|
|
175
182
|
const expectedPath1 = path.join(tempRootDir, 'file1.txt');
|
|
176
183
|
const expectedPath2 = path.join(tempRootDir, 'subdir/file2.js');
|
|
@@ -183,7 +190,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
183
190
|
createFile('another.txt', 'Another text');
|
|
184
191
|
createFile('sub/data.json', '{}');
|
|
185
192
|
const params = { paths: ['*.txt'] };
|
|
186
|
-
const
|
|
193
|
+
const invocation = tool.build(params);
|
|
194
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
187
195
|
const content = result.llmContent;
|
|
188
196
|
const expectedPath1 = path.join(tempRootDir, 'file.txt');
|
|
189
197
|
const expectedPath2 = path.join(tempRootDir, 'another.txt');
|
|
@@ -196,7 +204,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
196
204
|
createFile('src/main.ts', 'Main content');
|
|
197
205
|
createFile('src/main.test.ts', 'Test content');
|
|
198
206
|
const params = { paths: ['src/**/*.ts'], exclude: ['**/*.test.ts'] };
|
|
199
|
-
const
|
|
207
|
+
const invocation = tool.build(params);
|
|
208
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
200
209
|
const content = result.llmContent;
|
|
201
210
|
const expectedPath = path.join(tempRootDir, 'src/main.ts');
|
|
202
211
|
expect(content).toEqual([`--- ${expectedPath} ---\n\nMain content\n\n`]);
|
|
@@ -205,7 +214,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
205
214
|
});
|
|
206
215
|
it('should handle nonexistent specific files gracefully', async () => {
|
|
207
216
|
const params = { paths: ['nonexistent-file.txt'] };
|
|
208
|
-
const
|
|
217
|
+
const invocation = tool.build(params);
|
|
218
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
209
219
|
expect(result.llmContent).toEqual([
|
|
210
220
|
'No files matching the criteria were found or all were skipped.',
|
|
211
221
|
]);
|
|
@@ -215,7 +225,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
215
225
|
createFile('node_modules/some-lib/index.js', 'lib code');
|
|
216
226
|
createFile('src/app.js', 'app code');
|
|
217
227
|
const params = { paths: ['**/*.js'] };
|
|
218
|
-
const
|
|
228
|
+
const invocation = tool.build(params);
|
|
229
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
219
230
|
const content = result.llmContent;
|
|
220
231
|
const expectedPath = path.join(tempRootDir, 'src/app.js');
|
|
221
232
|
expect(content).toEqual([`--- ${expectedPath} ---\n\napp code\n\n`]);
|
|
@@ -226,7 +237,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
226
237
|
createFile('node_modules/some-lib/index.js', 'lib code');
|
|
227
238
|
createFile('src/app.js', 'app code');
|
|
228
239
|
const params = { paths: ['**/*.js'], useDefaultExcludes: false };
|
|
229
|
-
const
|
|
240
|
+
const invocation = tool.build(params);
|
|
241
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
230
242
|
const content = result.llmContent;
|
|
231
243
|
const expectedPath1 = path.join(tempRootDir, 'node_modules/some-lib/index.js');
|
|
232
244
|
const expectedPath2 = path.join(tempRootDir, 'src/app.js');
|
|
@@ -237,7 +249,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
237
249
|
it('should include images as inlineData parts if explicitly requested by extension', async () => {
|
|
238
250
|
createBinaryFile('image.png', Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]));
|
|
239
251
|
const params = { paths: ['*.png'] }; // Explicitly requesting .png
|
|
240
|
-
const
|
|
252
|
+
const invocation = tool.build(params);
|
|
253
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
241
254
|
expect(result.llmContent).toEqual([
|
|
242
255
|
{
|
|
243
256
|
inlineData: {
|
|
@@ -253,7 +266,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
253
266
|
it('should include images as inlineData parts if explicitly requested by name', async () => {
|
|
254
267
|
createBinaryFile('myExactImage.png', Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]));
|
|
255
268
|
const params = { paths: ['myExactImage.png'] }; // Explicitly requesting by full name
|
|
256
|
-
const
|
|
269
|
+
const invocation = tool.build(params);
|
|
270
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
257
271
|
expect(result.llmContent).toEqual([
|
|
258
272
|
{
|
|
259
273
|
inlineData: {
|
|
@@ -269,7 +283,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
269
283
|
createBinaryFile('document.pdf', Buffer.from('%PDF-1.4...'));
|
|
270
284
|
createFile('notes.txt', 'text notes');
|
|
271
285
|
const params = { paths: ['*'] }; // Generic glob, not specific to .pdf
|
|
272
|
-
const
|
|
286
|
+
const invocation = tool.build(params);
|
|
287
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
273
288
|
const content = result.llmContent;
|
|
274
289
|
const expectedPath = path.join(tempRootDir, 'notes.txt');
|
|
275
290
|
expect(content.some((c) => typeof c === 'string' &&
|
|
@@ -280,7 +295,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
280
295
|
it('should include PDF files as inlineData parts if explicitly requested by extension', async () => {
|
|
281
296
|
createBinaryFile('important.pdf', Buffer.from('%PDF-1.4...'));
|
|
282
297
|
const params = { paths: ['*.pdf'] }; // Explicitly requesting .pdf files
|
|
283
|
-
const
|
|
298
|
+
const invocation = tool.build(params);
|
|
299
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
284
300
|
expect(result.llmContent).toEqual([
|
|
285
301
|
{
|
|
286
302
|
inlineData: {
|
|
@@ -293,7 +309,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
293
309
|
it('should include PDF files as inlineData parts if explicitly requested by name', async () => {
|
|
294
310
|
createBinaryFile('report-final.pdf', Buffer.from('%PDF-1.4...'));
|
|
295
311
|
const params = { paths: ['report-final.pdf'] };
|
|
296
|
-
const
|
|
312
|
+
const invocation = tool.build(params);
|
|
313
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
297
314
|
expect(result.llmContent).toEqual([
|
|
298
315
|
{
|
|
299
316
|
inlineData: {
|
|
@@ -308,7 +325,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
308
325
|
createFile('bar.ts', '');
|
|
309
326
|
createFile('foo.quux', '');
|
|
310
327
|
const params = { paths: ['foo.bar', 'bar.ts', 'foo.quux'] };
|
|
311
|
-
const
|
|
328
|
+
const invocation = tool.build(params);
|
|
329
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
312
330
|
expect(result.returnDisplay).not.toContain('foo.bar');
|
|
313
331
|
expect(result.returnDisplay).not.toContain('foo.quux');
|
|
314
332
|
expect(result.returnDisplay).toContain('bar.ts');
|
|
@@ -330,7 +348,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
330
348
|
fs.writeFileSync(path.join(tempDir1, 'file1.txt'), 'Content1');
|
|
331
349
|
fs.writeFileSync(path.join(tempDir2, 'file2.txt'), 'Content2');
|
|
332
350
|
const params = { paths: ['*.txt'] };
|
|
333
|
-
const
|
|
351
|
+
const invocation = tool.build(params);
|
|
352
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
334
353
|
const content = result.llmContent;
|
|
335
354
|
if (!Array.isArray(content)) {
|
|
336
355
|
throw new Error(`llmContent is not an array: ${content}`);
|
|
@@ -343,6 +362,23 @@ describe('ReadManyFilesTool', () => {
|
|
|
343
362
|
fs.rmSync(tempDir1, { recursive: true, force: true });
|
|
344
363
|
fs.rmSync(tempDir2, { recursive: true, force: true });
|
|
345
364
|
});
|
|
365
|
+
it('should add a warning for truncated files', async () => {
|
|
366
|
+
createFile('file1.txt', 'Content1');
|
|
367
|
+
// Create a file that will be "truncated" by making it long
|
|
368
|
+
const longContent = Array.from({ length: 2500 }, (_, i) => `L${i}`).join('\n');
|
|
369
|
+
createFile('large-file.txt', longContent);
|
|
370
|
+
const params = { paths: ['*.txt'] };
|
|
371
|
+
const invocation = tool.build(params);
|
|
372
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
373
|
+
const content = result.llmContent;
|
|
374
|
+
const normalFileContent = content.find((c) => c.includes('file1.txt'));
|
|
375
|
+
const truncatedFileContent = content.find((c) => c.includes('large-file.txt'));
|
|
376
|
+
expect(normalFileContent).not.toContain('[WARNING: This file was truncated.');
|
|
377
|
+
expect(truncatedFileContent).toContain("[WARNING: This file was truncated. To view the full content, use the 'read_file' tool on this specific file.]");
|
|
378
|
+
// Check that the actual content is still there but truncated
|
|
379
|
+
expect(truncatedFileContent).toContain('L200');
|
|
380
|
+
expect(truncatedFileContent).not.toContain('L2400');
|
|
381
|
+
});
|
|
346
382
|
});
|
|
347
383
|
describe('Batch Processing', () => {
|
|
348
384
|
const createMultipleFiles = (count, contentPrefix = 'Content') => {
|
|
@@ -359,30 +395,26 @@ describe('ReadManyFilesTool', () => {
|
|
|
359
395
|
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
360
396
|
fs.writeFileSync(fullPath, content);
|
|
361
397
|
};
|
|
362
|
-
it('should process files in parallel
|
|
398
|
+
it('should process files in parallel', async () => {
|
|
363
399
|
// Mock detectFileType to add artificial delay to simulate I/O
|
|
364
400
|
const detectFileTypeSpy = vi.spyOn(await import('../utils/fileUtils.js'), 'detectFileType');
|
|
365
401
|
// Create files
|
|
366
402
|
const fileCount = 4;
|
|
367
403
|
const files = createMultipleFiles(fileCount, 'Batch test');
|
|
368
|
-
// Mock with
|
|
404
|
+
// Mock with 10ms delay per file to simulate I/O operations
|
|
369
405
|
detectFileTypeSpy.mockImplementation(async (_filePath) => {
|
|
370
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
406
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
371
407
|
return 'text';
|
|
372
408
|
});
|
|
373
|
-
const startTime = Date.now();
|
|
374
409
|
const params = { paths: files };
|
|
375
|
-
const
|
|
376
|
-
const
|
|
377
|
-
const processingTime = endTime - startTime;
|
|
378
|
-
console.log(`Processing time: ${processingTime}ms for ${fileCount} files`);
|
|
379
|
-
// Verify parallel processing performance improvement
|
|
380
|
-
// Parallel processing should complete in ~100ms (single file time)
|
|
381
|
-
// Sequential would take ~400ms (4 files × 100ms each)
|
|
382
|
-
expect(processingTime).toBeLessThan(200); // Should PASS with parallel implementation
|
|
410
|
+
const invocation = tool.build(params);
|
|
411
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
383
412
|
// Verify all files were processed
|
|
384
413
|
const content = result.llmContent;
|
|
385
414
|
expect(content).toHaveLength(fileCount);
|
|
415
|
+
for (let i = 0; i < fileCount; i++) {
|
|
416
|
+
expect(content.join('')).toContain(`Batch test ${i}`);
|
|
417
|
+
}
|
|
386
418
|
// Cleanup mock
|
|
387
419
|
detectFileTypeSpy.mockRestore();
|
|
388
420
|
});
|
|
@@ -399,7 +431,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
399
431
|
'valid3.txt',
|
|
400
432
|
],
|
|
401
433
|
};
|
|
402
|
-
const
|
|
434
|
+
const invocation = tool.build(params);
|
|
435
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
403
436
|
const content = result.llmContent;
|
|
404
437
|
// Should successfully process valid files despite one failure
|
|
405
438
|
expect(content.length).toBeGreaterThanOrEqual(3);
|
|
@@ -425,7 +458,8 @@ describe('ReadManyFilesTool', () => {
|
|
|
425
458
|
executionOrder.push(`end:${fileName}`);
|
|
426
459
|
return 'text';
|
|
427
460
|
});
|
|
428
|
-
|
|
461
|
+
const invocation = tool.build({ paths: files });
|
|
462
|
+
await invocation.execute(new AbortController().signal);
|
|
429
463
|
console.log('Execution order:', executionOrder);
|
|
430
464
|
// Verify concurrent execution pattern
|
|
431
465
|
// In parallel execution: all "start:" events should come before all "end:" events
|