summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/memoryTool.ts
diff options
context:
space:
mode:
authorBilly Biggs <[email protected]>2025-06-13 09:19:08 -0700
committerGitHub <[email protected]>2025-06-13 09:19:08 -0700
commit2a1ad1f5d961b9f9593a6016eea7dd398bdeed0b (patch)
tree9e83f9421ef9b01f30454c5af3db90540381d1e3 /packages/core/src/tools/memoryTool.ts
parent34e0d9c0b65b91b12df4f205d9835e05913992b9 (diff)
Update contextFileName to support an optional list of strings (#1001)
Diffstat (limited to 'packages/core/src/tools/memoryTool.ts')
-rw-r--r--packages/core/src/tools/memoryTool.ts20
1 files changed, 17 insertions, 3 deletions
diff --git a/packages/core/src/tools/memoryTool.ts b/packages/core/src/tools/memoryTool.ts
index a0c62eae..2c6f41c8 100644
--- a/packages/core/src/tools/memoryTool.ts
+++ b/packages/core/src/tools/memoryTool.ts
@@ -51,18 +51,32 @@ export const MEMORY_SECTION_HEADER = '## Gemini Added Memories';
// This variable will hold the currently configured filename for GEMINI.md context files.
// It defaults to DEFAULT_CONTEXT_FILENAME but can be overridden by setGeminiMdFilename.
-let currentGeminiMdFilename = DEFAULT_CONTEXT_FILENAME;
+let currentGeminiMdFilename: string | string[] = DEFAULT_CONTEXT_FILENAME;
-export function setGeminiMdFilename(newFilename: string): void {
- if (newFilename && newFilename.trim() !== '') {
+export function setGeminiMdFilename(newFilename: string | string[]): void {
+ if (Array.isArray(newFilename)) {
+ if (newFilename.length > 0) {
+ currentGeminiMdFilename = newFilename.map((name) => name.trim());
+ }
+ } else if (newFilename && newFilename.trim() !== '') {
currentGeminiMdFilename = newFilename.trim();
}
}
export function getCurrentGeminiMdFilename(): string {
+ if (Array.isArray(currentGeminiMdFilename)) {
+ return currentGeminiMdFilename[0];
+ }
return currentGeminiMdFilename;
}
+export function getAllGeminiMdFilenames(): string[] {
+ if (Array.isArray(currentGeminiMdFilename)) {
+ return currentGeminiMdFilename;
+ }
+ return [currentGeminiMdFilename];
+}
+
interface SaveMemoryParams {
fact: string;
}