@google/gemini-cli 0.36.0-preview.8 → 0.37.0-preview.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/bundle/{chunk-N22U7LIR.js → chunk-3TN4SOLW.js} +6651 -4180
- package/bundle/{chunk-S2IQOR7T.js → chunk-7UZ4Y32N.js} +214 -66
- package/bundle/{chunk-QBLIM2T2.js → chunk-A62NZYIK.js} +711 -240
- package/bundle/{chunk-5JDHTAA3.js → chunk-LEK5YYAR.js} +6295 -4094
- package/bundle/{chunk-MYI75E6G.js → chunk-R5X4CMUM.js} +233 -70
- package/bundle/{chunk-5Y6Y7SEB.js → chunk-TJ76C6AA.js} +16847 -9496
- package/bundle/chunk-U4FACSVX.js +30 -0
- package/bundle/{chunk-UUJ4JLTB.js → chunk-ULC3DHVX.js} +711 -240
- package/bundle/{chunk-642LNT3F.js → chunk-XX7JYMTE.js} +765 -306
- package/bundle/{core-N4UNRLQA.js → core-5OME6LT4.js} +58 -4
- package/bundle/{dist-HD2ZHBHJ.js → core-CUCGSGCA.js} +58 -4
- package/bundle/{devtoolsService-7D3WUF33.js → devtoolsService-4FIYD6OW.js} +20 -3
- package/bundle/{devtoolsService-NA7MR5UO.js → devtoolsService-IDLWLZFQ.js} +21 -5
- package/bundle/{devtoolsService-Y53ZUB56.js → devtoolsService-TVWW3DBW.js} +20 -3
- package/bundle/{dist-JYY2GAAR.js → dist-YWCADMDD.js} +58 -4
- package/bundle/docs/CONTRIBUTING.md +10 -7
- package/bundle/docs/assets/theme-tokyonight-dark.png +0 -0
- package/bundle/docs/changelogs/index.md +24 -0
- package/bundle/docs/changelogs/latest.md +366 -459
- package/bundle/docs/changelogs/preview.md +362 -356
- package/bundle/docs/cli/acp-mode.md +126 -0
- package/bundle/docs/cli/cli-reference.md +1 -1
- package/bundle/docs/cli/notifications.md +5 -5
- package/bundle/docs/cli/plan-mode.md +12 -8
- package/bundle/docs/cli/sandbox.md +1 -1
- package/bundle/docs/cli/settings.md +14 -13
- package/bundle/docs/cli/themes.md +5 -0
- package/bundle/docs/core/index.md +2 -2
- package/bundle/docs/core/subagents.md +134 -23
- package/bundle/docs/get-started/gemini-3.md +1 -1
- package/bundle/docs/get-started/index.md +127 -1
- package/bundle/docs/ide-integration/index.md +99 -24
- package/bundle/docs/index.md +0 -2
- package/bundle/docs/redirects.json +1 -0
- package/bundle/docs/reference/commands.md +1 -3
- package/bundle/docs/reference/configuration.md +182 -91
- package/bundle/docs/reference/keyboard-shortcuts.md +14 -6
- package/bundle/docs/reference/policy-engine.md +16 -30
- package/bundle/docs/reference/tools.md +56 -23
- package/bundle/docs/resources/quota-and-pricing.md +23 -9
- package/bundle/docs/sidebar.json +11 -4
- package/bundle/docs/tools/planning.md +6 -4
- package/bundle/events-CLX3JQHP.js +12 -0
- package/bundle/gemini.js +342 -52
- package/bundle/{interactiveCli-R5N55BDV.js → interactiveCli-4WFWOVAQ.js} +5066 -4010
- package/bundle/{interactiveCli-LFO7EWZS.js → interactiveCli-4ZZ72DR3.js} +5066 -4010
- package/bundle/{interactiveCli-2JRQPNZP.js → interactiveCli-6SIGBRWS.js} +5279 -4240
- package/bundle/{memoryDiscovery-BQGYT4OD.js → memoryDiscovery-NS2EGHYH.js} +3 -1
- package/bundle/{memoryDiscovery-FCEPFZ3M.js → memoryDiscovery-VL3OH25S.js} +3 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js +26 -19
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.d.ts +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js.map +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js +35 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js.map +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-2WD22PTI.js → oauth2-provider-HGHECKPY.js} +2 -2
- package/bundle/{oauth2-provider-QOWLZC44.js → oauth2-provider-TYBJKXSJ.js} +2 -2
- package/bundle/{oauth2-provider-34BPLPQX.js → oauth2-provider-YYRJ44X5.js} +73 -39
- package/bundle/policies/discovered.toml +7 -0
- package/bundle/policies/non-interactive.toml +7 -0
- package/bundle/policies/plan.toml +25 -0
- package/bundle/policies/read-only.toml +6 -0
- package/bundle/policies/sandbox-default.toml +3 -2
- package/bundle/policies/write.toml +21 -0
- package/bundle/policies/yolo.toml +1 -1
- package/package.json +1 -1
- package/bundle/chunk-FWCJAF6L.js +0 -97905
- package/bundle/chunk-X6CSYCBW.js +0 -354180
- package/bundle/devtoolsService-VU7N6PSG.js +0 -854
- package/bundle/dist-QEB25IFU.js +0 -1886
- package/bundle/docs/get-started/examples.md +0 -141
- package/bundle/interactiveCli-A6H7VTMC.js +0 -49299
- package/bundle/oauth2-provider-MZAUZWUS.js +0 -237
|
@@ -40771,6 +40771,7 @@ var MessageBusType;
|
|
|
40771
40771
|
MessageBusType2["TOOL_CALLS_UPDATE"] = "tool-calls-update";
|
|
40772
40772
|
MessageBusType2["ASK_USER_REQUEST"] = "ask-user-request";
|
|
40773
40773
|
MessageBusType2["ASK_USER_RESPONSE"] = "ask-user-response";
|
|
40774
|
+
MessageBusType2["SUBAGENT_ACTIVITY"] = "subagent-activity";
|
|
40774
40775
|
})(MessageBusType || (MessageBusType = {}));
|
|
40775
40776
|
var QuestionType;
|
|
40776
40777
|
(function(QuestionType2) {
|
|
@@ -40986,6 +40987,11 @@ var BaseToolInvocation = class {
|
|
|
40986
40987
|
}
|
|
40987
40988
|
});
|
|
40988
40989
|
}
|
|
40990
|
+
toJSON() {
|
|
40991
|
+
return {
|
|
40992
|
+
params: this.params
|
|
40993
|
+
};
|
|
40994
|
+
}
|
|
40989
40995
|
};
|
|
40990
40996
|
var DeclarativeTool = class {
|
|
40991
40997
|
name;
|
|
@@ -41025,6 +41031,15 @@ var DeclarativeTool = class {
|
|
|
41025
41031
|
}
|
|
41026
41032
|
return cloned;
|
|
41027
41033
|
}
|
|
41034
|
+
toJSON() {
|
|
41035
|
+
return {
|
|
41036
|
+
name: this.name,
|
|
41037
|
+
displayName: this.displayName,
|
|
41038
|
+
description: this.description,
|
|
41039
|
+
kind: this.kind,
|
|
41040
|
+
parameterSchema: this.parameterSchema
|
|
41041
|
+
};
|
|
41042
|
+
}
|
|
41028
41043
|
get isReadOnly() {
|
|
41029
41044
|
return READ_ONLY_KINDS.includes(this.kind);
|
|
41030
41045
|
}
|
|
@@ -41235,6 +41250,7 @@ function isStructuredToolResult(obj) {
|
|
|
41235
41250
|
var hasSummary = (res) => isStructuredToolResult(res);
|
|
41236
41251
|
var isGrepResult = (res) => isStructuredToolResult(res) && "matches" in res && Array.isArray(res.matches);
|
|
41237
41252
|
var isListResult = (res) => isStructuredToolResult(res) && "files" in res && Array.isArray(res.files);
|
|
41253
|
+
var isReadManyFilesResult = (res) => isListResult(res) && "include" in res;
|
|
41238
41254
|
var isFileDiff = (res) => typeof res === "object" && res !== null && "fileDiff" in res && "fileName" in res && "filePath" in res;
|
|
41239
41255
|
var ToolConfirmationOutcome;
|
|
41240
41256
|
(function(ToolConfirmationOutcome2) {
|
|
@@ -41971,6 +41987,10 @@ var Storage = class _Storage {
|
|
|
41971
41987
|
const historyDir = path6.join(_Storage.getGlobalGeminiDir(), "history");
|
|
41972
41988
|
return path6.join(historyDir, identifier);
|
|
41973
41989
|
}
|
|
41990
|
+
getProjectMemoryDir() {
|
|
41991
|
+
const identifier = this.getProjectIdentifier();
|
|
41992
|
+
return path6.join(_Storage.getGlobalGeminiDir(), "memory", identifier);
|
|
41993
|
+
}
|
|
41974
41994
|
getWorkspaceSettingsPath() {
|
|
41975
41995
|
return path6.join(this.getGeminiDir(), "settings.json");
|
|
41976
41996
|
}
|
|
@@ -43168,6 +43188,7 @@ var READ_MANY_PARAM_RECURSIVE = "recursive";
|
|
|
43168
43188
|
var READ_MANY_PARAM_USE_DEFAULT_EXCLUDES = "useDefaultExcludes";
|
|
43169
43189
|
var MEMORY_TOOL_NAME = "save_memory";
|
|
43170
43190
|
var MEMORY_PARAM_FACT = "fact";
|
|
43191
|
+
var MEMORY_PARAM_SCOPE = "scope";
|
|
43171
43192
|
var GET_INTERNAL_DOCS_TOOL_NAME = "get_internal_docs";
|
|
43172
43193
|
var DOCS_PARAM_PATH = "path";
|
|
43173
43194
|
var ACTIVATE_SKILL_TOOL_NAME = "activate_skill";
|
|
@@ -43187,6 +43208,11 @@ var EXIT_PLAN_PARAM_PLAN_FILENAME = "plan_filename";
|
|
|
43187
43208
|
var ENTER_PLAN_MODE_TOOL_NAME = "enter_plan_mode";
|
|
43188
43209
|
var PLAN_MODE_PARAM_REASON = "reason";
|
|
43189
43210
|
var PARAM_ADDITIONAL_PERMISSIONS = "additional_permissions";
|
|
43211
|
+
var UPDATE_TOPIC_TOOL_NAME = "update_topic";
|
|
43212
|
+
var UPDATE_TOPIC_DISPLAY_NAME = "Update Topic Context";
|
|
43213
|
+
var TOPIC_PARAM_TITLE = "title";
|
|
43214
|
+
var TOPIC_PARAM_SUMMARY = "summary";
|
|
43215
|
+
var TOPIC_PARAM_STRATEGIC_INTENT = "strategic_intent";
|
|
43190
43216
|
|
|
43191
43217
|
// packages/core/dist/src/tools/definitions/dynamic-declaration-helpers.js
|
|
43192
43218
|
import * as os4 from "node:os";
|
|
@@ -48605,7 +48631,7 @@ function getShellDeclaration(enableInteractiveShell, enableEfficiency, enableToo
|
|
|
48605
48631
|
function getExitPlanModeDeclaration() {
|
|
48606
48632
|
return {
|
|
48607
48633
|
name: EXIT_PLAN_MODE_TOOL_NAME,
|
|
48608
|
-
description: "Finalizes the planning phase and transitions to implementation by presenting the plan for user approval. This tool MUST be used to exit Plan Mode before any source code edits can be performed.
|
|
48634
|
+
description: "Finalizes the planning phase and transitions to implementation by presenting the plan for formal user approval. You MUST reach an informal agreement with the user in the chat regarding the proposed strategy BEFORE calling this tool. This tool MUST be used to exit Plan Mode before any source code edits can be performed.",
|
|
48609
48635
|
parametersJsonSchema: {
|
|
48610
48636
|
type: "object",
|
|
48611
48637
|
required: [EXIT_PLAN_PARAM_PLAN_FILENAME],
|
|
@@ -48636,6 +48662,30 @@ function getActivateSkillDeclaration(skillNames) {
|
|
|
48636
48662
|
parametersJsonSchema: zodToJsonSchema(schema)
|
|
48637
48663
|
};
|
|
48638
48664
|
}
|
|
48665
|
+
function getUpdateTopicDeclaration() {
|
|
48666
|
+
return {
|
|
48667
|
+
name: UPDATE_TOPIC_TOOL_NAME,
|
|
48668
|
+
description: "Manages your narrative flow. Include `title` and `summary` only when starting a new Chapter (logical phase) or shifting strategic intent.",
|
|
48669
|
+
parametersJsonSchema: {
|
|
48670
|
+
type: "object",
|
|
48671
|
+
properties: {
|
|
48672
|
+
[TOPIC_PARAM_TITLE]: {
|
|
48673
|
+
type: "string",
|
|
48674
|
+
description: "The title of the new topic or chapter."
|
|
48675
|
+
},
|
|
48676
|
+
[TOPIC_PARAM_SUMMARY]: {
|
|
48677
|
+
type: "string",
|
|
48678
|
+
description: "(OPTIONAL) A detailed summary (5-10 sentences) covering both the work completed in the previous topic and the strategic intent of the new topic. This is required when transitioning between topics to maintain continuity."
|
|
48679
|
+
},
|
|
48680
|
+
[TOPIC_PARAM_STRATEGIC_INTENT]: {
|
|
48681
|
+
type: "string",
|
|
48682
|
+
description: "A mandatory one-sentence statement of your immediate intent."
|
|
48683
|
+
}
|
|
48684
|
+
},
|
|
48685
|
+
required: [TOPIC_PARAM_STRATEGIC_INTENT]
|
|
48686
|
+
}
|
|
48687
|
+
};
|
|
48688
|
+
}
|
|
48639
48689
|
|
|
48640
48690
|
// packages/core/dist/src/tools/definitions/model-family-sets/default-legacy.js
|
|
48641
48691
|
var DEFAULT_LEGACY_SET = {
|
|
@@ -49005,19 +49055,24 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
49005
49055
|
save_memory: {
|
|
49006
49056
|
name: MEMORY_TOOL_NAME,
|
|
49007
49057
|
description: `
|
|
49008
|
-
Saves concise
|
|
49058
|
+
Saves concise user context (preferences, facts) for use across future sessions.
|
|
49009
49059
|
|
|
49010
|
-
|
|
49011
|
-
|
|
49060
|
+
Supports two scopes:
|
|
49061
|
+
- **global** (default): Cross-project preferences loaded in every workspace. Use for "Remember X" or clear personal facts.
|
|
49062
|
+
- **project**: Facts specific to the current workspace, private to the user (not committed to the repo). Use for local dev setup notes, project-specific workflows, or personal reminders about this codebase.
|
|
49012
49063
|
|
|
49013
|
-
|
|
49014
|
-
- Do NOT use for session context.`,
|
|
49064
|
+
Do NOT use for session-specific context or temporary data.`,
|
|
49015
49065
|
parametersJsonSchema: {
|
|
49016
49066
|
type: "object",
|
|
49017
49067
|
properties: {
|
|
49018
49068
|
[MEMORY_PARAM_FACT]: {
|
|
49019
49069
|
type: "string",
|
|
49020
49070
|
description: "The specific fact or piece of information to remember. Should be a clear, self-contained statement."
|
|
49071
|
+
},
|
|
49072
|
+
[MEMORY_PARAM_SCOPE]: {
|
|
49073
|
+
type: "string",
|
|
49074
|
+
enum: ["global", "project"],
|
|
49075
|
+
description: "Where to save the memory. 'global' (default) saves to a file loaded in every workspace. 'project' saves to a project-specific file private to the user, not committed to the repo."
|
|
49021
49076
|
}
|
|
49022
49077
|
},
|
|
49023
49078
|
required: [MEMORY_PARAM_FACT],
|
|
@@ -49571,13 +49626,18 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
49571
49626
|
},
|
|
49572
49627
|
save_memory: {
|
|
49573
49628
|
name: MEMORY_TOOL_NAME,
|
|
49574
|
-
description: `Persists
|
|
49629
|
+
description: `Persists preferences or facts across ALL future sessions. Supports two scopes: 'global' (default) for cross-project preferences loaded in every workspace, and 'project' for facts specific to the current workspace that are private to the user (not committed to the repo). Use 'project' scope for things like local dev setup notes, project-specific workflows, or personal reminders about this codebase. CRITICAL: Do not use for session-specific context or temporary data.`,
|
|
49575
49630
|
parametersJsonSchema: {
|
|
49576
49631
|
type: "object",
|
|
49577
49632
|
properties: {
|
|
49578
49633
|
[MEMORY_PARAM_FACT]: {
|
|
49579
49634
|
type: "string",
|
|
49580
|
-
description: "A concise
|
|
49635
|
+
description: "A concise fact or preference to remember. Should be a clear, self-contained statement."
|
|
49636
|
+
},
|
|
49637
|
+
[MEMORY_PARAM_SCOPE]: {
|
|
49638
|
+
type: "string",
|
|
49639
|
+
enum: ["global", "project"],
|
|
49640
|
+
description: "Where to save the memory. 'global' (default) saves to a file loaded in every workspace. 'project' saves to a project-specific file private to the user, not committed to the repo."
|
|
49581
49641
|
}
|
|
49582
49642
|
},
|
|
49583
49643
|
required: [MEMORY_PARAM_FACT],
|
|
@@ -49780,7 +49840,8 @@ The agent did not use the todo list because this task could be completed by a ti
|
|
|
49780
49840
|
}
|
|
49781
49841
|
},
|
|
49782
49842
|
exit_plan_mode: () => getExitPlanModeDeclaration(),
|
|
49783
|
-
activate_skill: (skillNames) => getActivateSkillDeclaration(skillNames)
|
|
49843
|
+
activate_skill: (skillNames) => getActivateSkillDeclaration(skillNames),
|
|
49844
|
+
update_topic: getUpdateTopicDeclaration()
|
|
49784
49845
|
};
|
|
49785
49846
|
|
|
49786
49847
|
// packages/core/dist/src/tools/definitions/coreTools.js
|
|
@@ -50359,7 +50420,8 @@ var ALL_BUILTIN_TOOL_NAMES = [
|
|
|
50359
50420
|
TRACKER_VISUALIZE_TOOL_NAME,
|
|
50360
50421
|
GET_INTERNAL_DOCS_TOOL_NAME,
|
|
50361
50422
|
ENTER_PLAN_MODE_TOOL_NAME,
|
|
50362
|
-
EXIT_PLAN_MODE_TOOL_NAME
|
|
50423
|
+
EXIT_PLAN_MODE_TOOL_NAME,
|
|
50424
|
+
UPDATE_TOPIC_TOOL_NAME
|
|
50363
50425
|
];
|
|
50364
50426
|
var PLAN_MODE_TOOLS = [
|
|
50365
50427
|
GLOB_TOOL_NAME,
|
|
@@ -50370,6 +50432,7 @@ var PLAN_MODE_TOOLS = [
|
|
|
50370
50432
|
ASK_USER_TOOL_NAME,
|
|
50371
50433
|
ACTIVATE_SKILL_TOOL_NAME,
|
|
50372
50434
|
GET_INTERNAL_DOCS_TOOL_NAME,
|
|
50435
|
+
UPDATE_TOPIC_TOOL_NAME,
|
|
50373
50436
|
"codebase_investigator",
|
|
50374
50437
|
"cli_help"
|
|
50375
50438
|
];
|
|
@@ -50455,6 +50518,9 @@ function getAllGeminiMdFilenames() {
|
|
|
50455
50518
|
function getGlobalMemoryFilePath() {
|
|
50456
50519
|
return path7.join(Storage.getGlobalGeminiDir(), getCurrentGeminiMdFilename());
|
|
50457
50520
|
}
|
|
50521
|
+
function getProjectMemoryFilePath(storage) {
|
|
50522
|
+
return path7.join(storage.getProjectMemoryDir(), getCurrentGeminiMdFilename());
|
|
50523
|
+
}
|
|
50458
50524
|
function ensureNewlineSeparation(currentContent) {
|
|
50459
50525
|
if (currentContent.length === 0)
|
|
50460
50526
|
return "";
|
|
@@ -50464,9 +50530,9 @@ function ensureNewlineSeparation(currentContent) {
|
|
|
50464
50530
|
return "\n";
|
|
50465
50531
|
return "\n\n";
|
|
50466
50532
|
}
|
|
50467
|
-
async function readMemoryFileContent() {
|
|
50533
|
+
async function readMemoryFileContent(filePath) {
|
|
50468
50534
|
try {
|
|
50469
|
-
return await fs8.readFile(
|
|
50535
|
+
return await fs8.readFile(filePath, "utf-8");
|
|
50470
50536
|
} catch (err) {
|
|
50471
50537
|
const error = err;
|
|
50472
50538
|
if (!(error instanceof Error) || error.code !== "ENOENT")
|
|
@@ -50503,20 +50569,28 @@ ${afterSectionMarker}`.trimEnd() + "\n";
|
|
|
50503
50569
|
var MemoryToolInvocation = class _MemoryToolInvocation extends BaseToolInvocation {
|
|
50504
50570
|
static allowlist = /* @__PURE__ */ new Set();
|
|
50505
50571
|
proposedNewContent;
|
|
50506
|
-
|
|
50572
|
+
storage;
|
|
50573
|
+
constructor(params, messageBus, toolName, displayName, storage) {
|
|
50507
50574
|
super(params, messageBus, toolName, displayName);
|
|
50575
|
+
this.storage = storage;
|
|
50576
|
+
}
|
|
50577
|
+
getMemoryFilePath() {
|
|
50578
|
+
if (this.params.scope === "project" && this.storage) {
|
|
50579
|
+
return getProjectMemoryFilePath(this.storage);
|
|
50580
|
+
}
|
|
50581
|
+
return getGlobalMemoryFilePath();
|
|
50508
50582
|
}
|
|
50509
50583
|
getDescription() {
|
|
50510
|
-
const memoryFilePath =
|
|
50584
|
+
const memoryFilePath = this.getMemoryFilePath();
|
|
50511
50585
|
return `in ${tildeifyPath(memoryFilePath)}`;
|
|
50512
50586
|
}
|
|
50513
50587
|
async getConfirmationDetails(_abortSignal) {
|
|
50514
|
-
const memoryFilePath =
|
|
50588
|
+
const memoryFilePath = this.getMemoryFilePath();
|
|
50515
50589
|
const allowlistKey = memoryFilePath;
|
|
50516
50590
|
if (_MemoryToolInvocation.allowlist.has(allowlistKey)) {
|
|
50517
50591
|
return false;
|
|
50518
50592
|
}
|
|
50519
|
-
const currentContent = await readMemoryFileContent();
|
|
50593
|
+
const currentContent = await readMemoryFileContent(memoryFilePath);
|
|
50520
50594
|
const { fact, modified_by_user, modified_content } = this.params;
|
|
50521
50595
|
const contentForDiff = modified_by_user && modified_content !== void 0 ? modified_content : computeNewContent(currentContent, fact);
|
|
50522
50596
|
this.proposedNewContent = contentForDiff;
|
|
@@ -50540,6 +50614,7 @@ var MemoryToolInvocation = class _MemoryToolInvocation extends BaseToolInvocatio
|
|
|
50540
50614
|
}
|
|
50541
50615
|
async execute(_signal) {
|
|
50542
50616
|
const { fact, modified_by_user, modified_content } = this.params;
|
|
50617
|
+
const memoryFilePath = this.getMemoryFilePath();
|
|
50543
50618
|
try {
|
|
50544
50619
|
let contentToWrite;
|
|
50545
50620
|
let successMessage;
|
|
@@ -50549,16 +50624,16 @@ var MemoryToolInvocation = class _MemoryToolInvocation extends BaseToolInvocatio
|
|
|
50549
50624
|
successMessage = `Okay, I've updated the memory file with your modifications.`;
|
|
50550
50625
|
} else {
|
|
50551
50626
|
if (this.proposedNewContent === void 0) {
|
|
50552
|
-
const currentContent = await readMemoryFileContent();
|
|
50627
|
+
const currentContent = await readMemoryFileContent(memoryFilePath);
|
|
50553
50628
|
this.proposedNewContent = computeNewContent(currentContent, fact);
|
|
50554
50629
|
}
|
|
50555
50630
|
contentToWrite = this.proposedNewContent;
|
|
50556
50631
|
successMessage = `Okay, I've remembered that: "${sanitizedFact}"`;
|
|
50557
50632
|
}
|
|
50558
|
-
await fs8.mkdir(path7.dirname(
|
|
50633
|
+
await fs8.mkdir(path7.dirname(memoryFilePath), {
|
|
50559
50634
|
recursive: true
|
|
50560
50635
|
});
|
|
50561
|
-
await fs8.writeFile(
|
|
50636
|
+
await fs8.writeFile(memoryFilePath, contentToWrite, "utf-8");
|
|
50562
50637
|
return {
|
|
50563
50638
|
llmContent: JSON.stringify({
|
|
50564
50639
|
success: true,
|
|
@@ -50584,27 +50659,39 @@ var MemoryToolInvocation = class _MemoryToolInvocation extends BaseToolInvocatio
|
|
|
50584
50659
|
};
|
|
50585
50660
|
var MemoryTool = class _MemoryTool extends BaseDeclarativeTool {
|
|
50586
50661
|
static Name = MEMORY_TOOL_NAME;
|
|
50587
|
-
|
|
50662
|
+
storage;
|
|
50663
|
+
constructor(messageBus, storage) {
|
|
50588
50664
|
super(_MemoryTool.Name, "SaveMemory", MEMORY_DEFINITION.base.description, Kind.Think, MEMORY_DEFINITION.base.parametersJsonSchema, messageBus, true, false);
|
|
50665
|
+
this.storage = storage;
|
|
50666
|
+
}
|
|
50667
|
+
resolveMemoryFilePath(params) {
|
|
50668
|
+
if (params.scope === "project" && this.storage) {
|
|
50669
|
+
return getProjectMemoryFilePath(this.storage);
|
|
50670
|
+
}
|
|
50671
|
+
return getGlobalMemoryFilePath();
|
|
50589
50672
|
}
|
|
50590
50673
|
validateToolParamValues(params) {
|
|
50591
50674
|
if (params.fact.trim() === "") {
|
|
50592
50675
|
return 'Parameter "fact" must be a non-empty string.';
|
|
50593
50676
|
}
|
|
50677
|
+
if (params.scope === "project" && !this.storage) {
|
|
50678
|
+
return "Project-level memory is not available: storage is not initialized.";
|
|
50679
|
+
}
|
|
50594
50680
|
return null;
|
|
50595
50681
|
}
|
|
50596
50682
|
createInvocation(params, messageBus, toolName, displayName) {
|
|
50597
|
-
return new MemoryToolInvocation(params, messageBus, toolName ?? this.name, displayName ?? this.displayName);
|
|
50683
|
+
return new MemoryToolInvocation(params, messageBus, toolName ?? this.name, displayName ?? this.displayName, this.storage);
|
|
50598
50684
|
}
|
|
50599
50685
|
getSchema(modelId) {
|
|
50600
50686
|
return resolveToolDeclaration(MEMORY_DEFINITION, modelId);
|
|
50601
50687
|
}
|
|
50602
50688
|
getModifyContext(_abortSignal) {
|
|
50603
50689
|
return {
|
|
50604
|
-
getFilePath: (
|
|
50605
|
-
getCurrentContent: async (
|
|
50690
|
+
getFilePath: (params) => this.resolveMemoryFilePath(params),
|
|
50691
|
+
getCurrentContent: async (params) => readMemoryFileContent(this.resolveMemoryFilePath(params)),
|
|
50606
50692
|
getProposedContent: async (params) => {
|
|
50607
|
-
const
|
|
50693
|
+
const filePath = this.resolveMemoryFilePath(params);
|
|
50694
|
+
const currentContent = await readMemoryFileContent(filePath);
|
|
50608
50695
|
const { fact, modified_by_user, modified_content } = params;
|
|
50609
50696
|
return modified_by_user && modified_content !== void 0 ? modified_content : computeNewContent(currentContent, fact);
|
|
50610
50697
|
},
|
|
@@ -50628,14 +50715,22 @@ var logger2 = {
|
|
|
50628
50715
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50629
50716
|
error: (...args) => debugLogger.error("[ERROR] [ImportProcessor]", ...args)
|
|
50630
50717
|
};
|
|
50631
|
-
async function findProjectRoot(startDir) {
|
|
50718
|
+
async function findProjectRoot(startDir, boundaryMarkers = [".git"]) {
|
|
50719
|
+
if (boundaryMarkers.length === 0) {
|
|
50720
|
+
return path8.resolve(startDir);
|
|
50721
|
+
}
|
|
50632
50722
|
let currentDir = path8.resolve(startDir);
|
|
50633
50723
|
while (true) {
|
|
50634
|
-
const
|
|
50635
|
-
|
|
50636
|
-
|
|
50637
|
-
|
|
50638
|
-
|
|
50724
|
+
for (const marker of boundaryMarkers) {
|
|
50725
|
+
if (path8.isAbsolute(marker) || marker.includes("..")) {
|
|
50726
|
+
continue;
|
|
50727
|
+
}
|
|
50728
|
+
const markerPath = path8.join(currentDir, marker);
|
|
50729
|
+
try {
|
|
50730
|
+
await fs9.access(markerPath);
|
|
50731
|
+
return currentDir;
|
|
50732
|
+
} catch {
|
|
50733
|
+
}
|
|
50639
50734
|
}
|
|
50640
50735
|
const parentDir = path8.dirname(currentDir);
|
|
50641
50736
|
if (parentDir === currentDir) {
|
|
@@ -50697,9 +50792,9 @@ async function processImports(content, basePath, debugMode = false, importState
|
|
|
50697
50792
|
processedFiles: /* @__PURE__ */ new Set(),
|
|
50698
50793
|
maxDepth: 5,
|
|
50699
50794
|
currentDepth: 0
|
|
50700
|
-
}, projectRoot, importFormat = "tree") {
|
|
50795
|
+
}, projectRoot, importFormat = "tree", boundaryMarkers = [".git"]) {
|
|
50701
50796
|
if (!projectRoot) {
|
|
50702
|
-
projectRoot = await findProjectRoot(basePath);
|
|
50797
|
+
projectRoot = await findProjectRoot(basePath, boundaryMarkers);
|
|
50703
50798
|
}
|
|
50704
50799
|
if (importState.currentDepth >= importState.maxDepth) {
|
|
50705
50800
|
if (debugMode) {
|
|
@@ -50786,7 +50881,7 @@ ${f.content.trim()}
|
|
|
50786
50881
|
currentFile: fullPath
|
|
50787
50882
|
};
|
|
50788
50883
|
newImportState.processedFiles.add(fullPath);
|
|
50789
|
-
const imported = await processImports(fileContent, path8.dirname(fullPath), debugMode, newImportState, projectRoot, importFormat);
|
|
50884
|
+
const imported = await processImports(fileContent, path8.dirname(fullPath), debugMode, newImportState, projectRoot, importFormat, boundaryMarkers);
|
|
50790
50885
|
result += `<!-- Imported from: ${importPath} -->
|
|
50791
50886
|
${imported.content}
|
|
50792
50887
|
<!-- End of import from: ${importPath} -->`;
|
|
@@ -51189,48 +51284,57 @@ function getErrorMessage(error) {
|
|
|
51189
51284
|
function getErrorType(error) {
|
|
51190
51285
|
if (!(error instanceof Error))
|
|
51191
51286
|
return "unknown";
|
|
51192
|
-
|
|
51287
|
+
const name = error.name && error.name !== "Error" ? error.name : error.constructor?.name ?? "Error";
|
|
51288
|
+
return name.replace(/^_+/, "");
|
|
51193
51289
|
}
|
|
51194
51290
|
var FatalError = class extends Error {
|
|
51195
51291
|
exitCode;
|
|
51196
51292
|
constructor(message, exitCode) {
|
|
51197
51293
|
super(message);
|
|
51198
51294
|
this.exitCode = exitCode;
|
|
51295
|
+
this.name = "FatalError";
|
|
51199
51296
|
}
|
|
51200
51297
|
};
|
|
51201
51298
|
var FatalAuthenticationError = class extends FatalError {
|
|
51202
51299
|
constructor(message) {
|
|
51203
51300
|
super(message, 41);
|
|
51301
|
+
this.name = "FatalAuthenticationError";
|
|
51204
51302
|
}
|
|
51205
51303
|
};
|
|
51206
51304
|
var FatalInputError = class extends FatalError {
|
|
51207
51305
|
constructor(message) {
|
|
51208
51306
|
super(message, 42);
|
|
51307
|
+
this.name = "FatalInputError";
|
|
51209
51308
|
}
|
|
51210
51309
|
};
|
|
51211
51310
|
var FatalSandboxError = class extends FatalError {
|
|
51212
51311
|
constructor(message) {
|
|
51213
51312
|
super(message, 44);
|
|
51313
|
+
this.name = "FatalSandboxError";
|
|
51214
51314
|
}
|
|
51215
51315
|
};
|
|
51216
51316
|
var FatalConfigError = class extends FatalError {
|
|
51217
51317
|
constructor(message) {
|
|
51218
51318
|
super(message, 52);
|
|
51319
|
+
this.name = "FatalConfigError";
|
|
51219
51320
|
}
|
|
51220
51321
|
};
|
|
51221
51322
|
var FatalTurnLimitedError = class extends FatalError {
|
|
51222
51323
|
constructor(message) {
|
|
51223
51324
|
super(message, 53);
|
|
51325
|
+
this.name = "FatalTurnLimitedError";
|
|
51224
51326
|
}
|
|
51225
51327
|
};
|
|
51226
51328
|
var FatalToolExecutionError = class extends FatalError {
|
|
51227
51329
|
constructor(message) {
|
|
51228
51330
|
super(message, 54);
|
|
51331
|
+
this.name = "FatalToolExecutionError";
|
|
51229
51332
|
}
|
|
51230
51333
|
};
|
|
51231
51334
|
var FatalCancellationError = class extends FatalError {
|
|
51232
51335
|
constructor(message) {
|
|
51233
51336
|
super(message, 130);
|
|
51337
|
+
this.name = "FatalCancellationError";
|
|
51234
51338
|
}
|
|
51235
51339
|
};
|
|
51236
51340
|
var CanceledError = class extends Error {
|
|
@@ -51240,6 +51344,10 @@ var CanceledError = class extends Error {
|
|
|
51240
51344
|
}
|
|
51241
51345
|
};
|
|
51242
51346
|
var ForbiddenError = class extends Error {
|
|
51347
|
+
constructor(message) {
|
|
51348
|
+
super(message);
|
|
51349
|
+
this.name = "ForbiddenError";
|
|
51350
|
+
}
|
|
51243
51351
|
};
|
|
51244
51352
|
var AccountSuspendedError = class extends ForbiddenError {
|
|
51245
51353
|
appealUrl;
|
|
@@ -51252,8 +51360,16 @@ var AccountSuspendedError = class extends ForbiddenError {
|
|
|
51252
51360
|
}
|
|
51253
51361
|
};
|
|
51254
51362
|
var UnauthorizedError = class extends Error {
|
|
51363
|
+
constructor(message) {
|
|
51364
|
+
super(message);
|
|
51365
|
+
this.name = "UnauthorizedError";
|
|
51366
|
+
}
|
|
51255
51367
|
};
|
|
51256
51368
|
var BadRequestError = class extends Error {
|
|
51369
|
+
constructor(message) {
|
|
51370
|
+
super(message);
|
|
51371
|
+
this.name = "BadRequestError";
|
|
51372
|
+
}
|
|
51257
51373
|
};
|
|
51258
51374
|
var ChangeAuthRequestedError = class extends Error {
|
|
51259
51375
|
constructor() {
|
|
@@ -51330,7 +51446,7 @@ function isAuthenticationError(error) {
|
|
|
51330
51446
|
return true;
|
|
51331
51447
|
}
|
|
51332
51448
|
}
|
|
51333
|
-
if (error instanceof Error && error.
|
|
51449
|
+
if (error instanceof Error && error.name === "UnauthorizedError") {
|
|
51334
51450
|
return true;
|
|
51335
51451
|
}
|
|
51336
51452
|
if (error instanceof UnauthorizedError) {
|
|
@@ -51416,23 +51532,31 @@ async function deduplicatePathsByFileIdentity(filePaths) {
|
|
|
51416
51532
|
identityMap: pathToIdentityMap
|
|
51417
51533
|
};
|
|
51418
51534
|
}
|
|
51419
|
-
async function findProjectRoot2(startDir) {
|
|
51535
|
+
async function findProjectRoot2(startDir, boundaryMarkers = [".git"]) {
|
|
51536
|
+
if (boundaryMarkers.length === 0) {
|
|
51537
|
+
return null;
|
|
51538
|
+
}
|
|
51420
51539
|
let currentDir = normalizePath(startDir);
|
|
51421
51540
|
while (true) {
|
|
51422
|
-
const
|
|
51423
|
-
|
|
51424
|
-
|
|
51425
|
-
|
|
51426
|
-
|
|
51427
|
-
|
|
51428
|
-
|
|
51429
|
-
|
|
51430
|
-
|
|
51431
|
-
|
|
51432
|
-
|
|
51433
|
-
|
|
51434
|
-
|
|
51435
|
-
|
|
51541
|
+
for (const marker of boundaryMarkers) {
|
|
51542
|
+
if (path9.isAbsolute(marker) || marker.includes("..")) {
|
|
51543
|
+
continue;
|
|
51544
|
+
}
|
|
51545
|
+
const markerPath = path9.join(currentDir, marker);
|
|
51546
|
+
try {
|
|
51547
|
+
await fs10.access(markerPath);
|
|
51548
|
+
return currentDir;
|
|
51549
|
+
} catch (error) {
|
|
51550
|
+
const isENOENT = typeof error === "object" && error !== null && "code" in error && // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
51551
|
+
error.code === "ENOENT";
|
|
51552
|
+
const isTestEnv = process.env["NODE_ENV"] === "test" || process.env["VITEST"];
|
|
51553
|
+
if (!isENOENT && !isTestEnv) {
|
|
51554
|
+
if (typeof error === "object" && error !== null && "code" in error) {
|
|
51555
|
+
const fsError = error;
|
|
51556
|
+
logger3.warn(`Error checking for ${marker} at ${markerPath}: ${fsError.message}`);
|
|
51557
|
+
} else {
|
|
51558
|
+
logger3.warn(`Non-standard error checking for ${marker} at ${markerPath}: ${String(error)}`);
|
|
51559
|
+
}
|
|
51436
51560
|
}
|
|
51437
51561
|
}
|
|
51438
51562
|
}
|
|
@@ -51443,7 +51567,7 @@ async function findProjectRoot2(startDir) {
|
|
|
51443
51567
|
currentDir = parentDir;
|
|
51444
51568
|
}
|
|
51445
51569
|
}
|
|
51446
|
-
async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, fileService, folderTrust, fileFilteringOptions, maxDirs) {
|
|
51570
|
+
async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, fileService, folderTrust, fileFilteringOptions, maxDirs, boundaryMarkers = [".git"]) {
|
|
51447
51571
|
const dirs = /* @__PURE__ */ new Set([
|
|
51448
51572
|
...includeDirectoriesToReadGemini,
|
|
51449
51573
|
currentWorkingDirectory
|
|
@@ -51454,7 +51578,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDire
|
|
|
51454
51578
|
const projectPaths = /* @__PURE__ */ new Set();
|
|
51455
51579
|
for (let i = 0; i < dirsArray.length; i += CONCURRENT_LIMIT) {
|
|
51456
51580
|
const batch = dirsArray.slice(i, i + CONCURRENT_LIMIT);
|
|
51457
|
-
const batchPromises = batch.map((dir) => getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, fileService, folderTrust, fileFilteringOptions, maxDirs));
|
|
51581
|
+
const batchPromises = batch.map((dir) => getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, fileService, folderTrust, fileFilteringOptions, maxDirs, boundaryMarkers));
|
|
51458
51582
|
const batchResults = await Promise.allSettled(batchPromises);
|
|
51459
51583
|
for (const result of batchResults) {
|
|
51460
51584
|
if (result.status === "fulfilled") {
|
|
@@ -51472,7 +51596,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDire
|
|
|
51472
51596
|
project: Array.from(projectPaths)
|
|
51473
51597
|
};
|
|
51474
51598
|
}
|
|
51475
|
-
async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, fileService, folderTrust, fileFilteringOptions, maxDirs) {
|
|
51599
|
+
async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, fileService, folderTrust, fileFilteringOptions, maxDirs, boundaryMarkers = [".git"]) {
|
|
51476
51600
|
const globalPaths = /* @__PURE__ */ new Set();
|
|
51477
51601
|
const projectPaths = /* @__PURE__ */ new Set();
|
|
51478
51602
|
const geminiMdFilenames = getAllGeminiMdFilenames();
|
|
@@ -51489,7 +51613,7 @@ async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, fileSer
|
|
|
51489
51613
|
if (dir && folderTrust) {
|
|
51490
51614
|
const resolvedCwd = normalizePath(dir);
|
|
51491
51615
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Searching for", geminiMdFilename, "starting from CWD:", resolvedCwd);
|
|
51492
|
-
const projectRoot = await findProjectRoot2(resolvedCwd);
|
|
51616
|
+
const projectRoot = await findProjectRoot2(resolvedCwd, boundaryMarkers);
|
|
51493
51617
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Determined project root:", projectRoot ?? "None");
|
|
51494
51618
|
const upwardPaths = [];
|
|
51495
51619
|
let currentDir = resolvedCwd;
|
|
@@ -51533,7 +51657,7 @@ async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, fileSer
|
|
|
51533
51657
|
project: Array.from(projectPaths)
|
|
51534
51658
|
};
|
|
51535
51659
|
}
|
|
51536
|
-
async function readGeminiMdFiles(filePaths, importFormat = "tree") {
|
|
51660
|
+
async function readGeminiMdFiles(filePaths, importFormat = "tree", boundaryMarkers = [".git"]) {
|
|
51537
51661
|
const CONCURRENT_LIMIT = 20;
|
|
51538
51662
|
const results = [];
|
|
51539
51663
|
for (let i = 0; i < filePaths.length; i += CONCURRENT_LIMIT) {
|
|
@@ -51541,7 +51665,7 @@ async function readGeminiMdFiles(filePaths, importFormat = "tree") {
|
|
|
51541
51665
|
const batchPromises = batch.map(async (filePath) => {
|
|
51542
51666
|
try {
|
|
51543
51667
|
const content = await fs10.readFile(filePath, "utf-8");
|
|
51544
|
-
const processedResult = await processImports(content, path9.dirname(filePath), false, void 0, void 0, importFormat);
|
|
51668
|
+
const processedResult = await processImports(content, path9.dirname(filePath), false, void 0, void 0, importFormat, boundaryMarkers);
|
|
51545
51669
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Successfully read and processed imports:", filePath, `(Length: ${processedResult.content.length})`);
|
|
51546
51670
|
return { filePath, content: processedResult.content };
|
|
51547
51671
|
} catch (error) {
|
|
@@ -51593,15 +51717,29 @@ async function getGlobalMemoryPaths() {
|
|
|
51593
51717
|
});
|
|
51594
51718
|
return (await Promise.all(accessChecks)).filter((p) => p !== null);
|
|
51595
51719
|
}
|
|
51720
|
+
async function getUserProjectMemoryPaths(projectMemoryDir) {
|
|
51721
|
+
const geminiMdFilenames = getAllGeminiMdFilenames();
|
|
51722
|
+
const accessChecks = geminiMdFilenames.map(async (filename) => {
|
|
51723
|
+
const memoryPath = normalizePath(path9.join(projectMemoryDir, filename));
|
|
51724
|
+
try {
|
|
51725
|
+
await fs10.access(memoryPath, fsSync2.constants.R_OK);
|
|
51726
|
+
debugLogger.debug("[DEBUG] [MemoryDiscovery] Found user project memory file:", memoryPath);
|
|
51727
|
+
return memoryPath;
|
|
51728
|
+
} catch {
|
|
51729
|
+
return null;
|
|
51730
|
+
}
|
|
51731
|
+
});
|
|
51732
|
+
return (await Promise.all(accessChecks)).filter((p) => p !== null);
|
|
51733
|
+
}
|
|
51596
51734
|
function getExtensionMemoryPaths(extensionLoader) {
|
|
51597
51735
|
const extensionPaths = extensionLoader.getExtensions().filter((ext) => ext.isActive).flatMap((ext) => ext.contextFiles).map((p) => normalizePath(p));
|
|
51598
51736
|
return Array.from(new Set(extensionPaths)).sort();
|
|
51599
51737
|
}
|
|
51600
|
-
async function getEnvironmentMemoryPaths(trustedRoots) {
|
|
51738
|
+
async function getEnvironmentMemoryPaths(trustedRoots, boundaryMarkers = [".git"]) {
|
|
51601
51739
|
const allPaths = /* @__PURE__ */ new Set();
|
|
51602
51740
|
const traversalPromises = trustedRoots.map(async (root) => {
|
|
51603
51741
|
const resolvedRoot = normalizePath(root);
|
|
51604
|
-
const gitRoot = await findProjectRoot2(resolvedRoot);
|
|
51742
|
+
const gitRoot = await findProjectRoot2(resolvedRoot, boundaryMarkers);
|
|
51605
51743
|
const ceiling = gitRoot ? normalizePath(gitRoot) : resolvedRoot;
|
|
51606
51744
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Loading environment memory for trusted root:", resolvedRoot, "(Stopping at", gitRoot ? `git root: ${ceiling})` : `trusted root: ${ceiling} \u2014 no git root found)`);
|
|
51607
51745
|
return findUpwardGeminiFiles(resolvedRoot, ceiling);
|
|
@@ -51615,7 +51753,8 @@ function categorizeAndConcatenate(paths, contentsMap) {
|
|
|
51615
51753
|
return {
|
|
51616
51754
|
global: getConcatenated(paths.global),
|
|
51617
51755
|
extension: getConcatenated(paths.extension),
|
|
51618
|
-
project: getConcatenated(paths.project)
|
|
51756
|
+
project: getConcatenated(paths.project),
|
|
51757
|
+
userProjectMemory: getConcatenated(paths.userProjectMemory ?? [])
|
|
51619
51758
|
};
|
|
51620
51759
|
}
|
|
51621
51760
|
async function findUpwardGeminiFiles(startDir, stopDir) {
|
|
@@ -51648,7 +51787,7 @@ async function findUpwardGeminiFiles(startDir, stopDir) {
|
|
|
51648
51787
|
}
|
|
51649
51788
|
return upwardPaths;
|
|
51650
51789
|
}
|
|
51651
|
-
async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDirectoriesToReadGemini, fileService, extensionLoader, folderTrust, importFormat = "tree", fileFilteringOptions, maxDirs = 200) {
|
|
51790
|
+
async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDirectoriesToReadGemini, fileService, extensionLoader, folderTrust, importFormat = "tree", fileFilteringOptions, maxDirs = 200, boundaryMarkers = [".git"]) {
|
|
51652
51791
|
const realCwd = normalizePath(await fs10.realpath(path9.resolve(currentWorkingDirectory)));
|
|
51653
51792
|
const realHome = normalizePath(await fs10.realpath(path9.resolve(homedir())));
|
|
51654
51793
|
const isHomeDirectory = realCwd === realHome;
|
|
@@ -51656,7 +51795,7 @@ async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDire
|
|
|
51656
51795
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD:", currentWorkingDirectory, `(importFormat: ${importFormat})`);
|
|
51657
51796
|
const userHomePath = homedir();
|
|
51658
51797
|
const [discoveryResult, extensionPaths] = await Promise.all([
|
|
51659
|
-
getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, fileService, folderTrust, fileFilteringOptions || DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, maxDirs),
|
|
51798
|
+
getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, fileService, folderTrust, fileFilteringOptions || DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, maxDirs, boundaryMarkers),
|
|
51660
51799
|
Promise.resolve(getExtensionMemoryPaths(extensionLoader))
|
|
51661
51800
|
]);
|
|
51662
51801
|
const allFilePathsStringDeduped = Array.from(/* @__PURE__ */ new Set([
|
|
@@ -51681,7 +51820,7 @@ async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDire
|
|
|
51681
51820
|
filePaths: []
|
|
51682
51821
|
};
|
|
51683
51822
|
}
|
|
51684
|
-
const allContents = await readGeminiMdFiles(allFilePaths, importFormat);
|
|
51823
|
+
const allContents = await readGeminiMdFiles(allFilePaths, importFormat, boundaryMarkers);
|
|
51685
51824
|
const contentsMap = new Map(allContents.map((c) => [c.filePath, c]));
|
|
51686
51825
|
const hierarchicalMemory = categorizeAndConcatenate({
|
|
51687
51826
|
global: discoveryResult.global,
|
|
@@ -51695,7 +51834,7 @@ async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDire
|
|
|
51695
51834
|
};
|
|
51696
51835
|
}
|
|
51697
51836
|
async function refreshServerHierarchicalMemory(config) {
|
|
51698
|
-
const result = await loadServerHierarchicalMemory(config.getWorkingDir(), config.shouldLoadMemoryFromIncludeDirectories() ? config.getWorkspaceContext().getDirectories() : [], config.getFileService(), config.getExtensionLoader(), config.isTrustedFolder(), config.getImportFormat(), config.getFileFilteringOptions(), config.getDiscoveryMaxDirs());
|
|
51837
|
+
const result = await loadServerHierarchicalMemory(config.getWorkingDir(), config.shouldLoadMemoryFromIncludeDirectories() ? config.getWorkspaceContext().getDirectories() : [], config.getFileService(), config.getExtensionLoader(), config.isTrustedFolder(), config.getImportFormat(), config.getFileFilteringOptions(), config.getDiscoveryMaxDirs(), config.getMemoryBoundaryMarkers());
|
|
51699
51838
|
const mcpInstructions = config.getMcpClientManager()?.getMcpInstructions() || "";
|
|
51700
51839
|
const finalMemory = {
|
|
51701
51840
|
...result.memoryContent,
|
|
@@ -51707,7 +51846,7 @@ async function refreshServerHierarchicalMemory(config) {
|
|
|
51707
51846
|
coreEvents.emit(CoreEvent.MemoryChanged, { fileCount: result.fileCount });
|
|
51708
51847
|
return result;
|
|
51709
51848
|
}
|
|
51710
|
-
async function loadJitSubdirectoryMemory(targetPath, trustedRoots, alreadyLoadedPaths, alreadyLoadedIdentities) {
|
|
51849
|
+
async function loadJitSubdirectoryMemory(targetPath, trustedRoots, alreadyLoadedPaths, alreadyLoadedIdentities, boundaryMarkers = [".git"]) {
|
|
51711
51850
|
const resolvedTarget = normalizePath(targetPath);
|
|
51712
51851
|
let bestRoot = null;
|
|
51713
51852
|
for (const root of trustedRoots) {
|
|
@@ -51723,7 +51862,7 @@ async function loadJitSubdirectoryMemory(targetPath, trustedRoots, alreadyLoaded
|
|
|
51723
51862
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] JIT memory skipped:", resolvedTarget, "is not in any trusted root.");
|
|
51724
51863
|
return { files: [], fileIdentities: [] };
|
|
51725
51864
|
}
|
|
51726
|
-
const gitRoot = await findProjectRoot2(bestRoot);
|
|
51865
|
+
const gitRoot = await findProjectRoot2(bestRoot, boundaryMarkers);
|
|
51727
51866
|
const resolvedCeiling = gitRoot ? normalizePath(gitRoot) : bestRoot;
|
|
51728
51867
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Loading JIT memory for", resolvedTarget, `(Trusted root: ${bestRoot}, Ceiling: ${resolvedCeiling}${gitRoot ? " [git root]" : " [trusted root, no git]"})`);
|
|
51729
51868
|
let startDir = resolvedTarget;
|
|
@@ -51774,7 +51913,7 @@ async function loadJitSubdirectoryMemory(targetPath, trustedRoots, alreadyLoaded
|
|
|
51774
51913
|
return { files: [], fileIdentities: [] };
|
|
51775
51914
|
}
|
|
51776
51915
|
debugLogger.debug("[DEBUG] [MemoryDiscovery] Found new JIT memory files:", JSON.stringify(newPaths));
|
|
51777
|
-
const contents = await readGeminiMdFiles(newPaths, "tree");
|
|
51916
|
+
const contents = await readGeminiMdFiles(newPaths, "tree", boundaryMarkers);
|
|
51778
51917
|
return {
|
|
51779
51918
|
files: contents.filter((item) => item.content !== null).map((item) => ({
|
|
51780
51919
|
path: item.filePath,
|
|
@@ -51832,6 +51971,7 @@ export {
|
|
|
51832
51971
|
hasSummary,
|
|
51833
51972
|
isGrepResult,
|
|
51834
51973
|
isListResult,
|
|
51974
|
+
isReadManyFilesResult,
|
|
51835
51975
|
isFileDiff,
|
|
51836
51976
|
ToolConfirmationOutcome,
|
|
51837
51977
|
Kind,
|
|
@@ -51958,7 +52098,13 @@ export {
|
|
|
51958
52098
|
ENTER_PLAN_MODE_TOOL_NAME,
|
|
51959
52099
|
PLAN_MODE_PARAM_REASON,
|
|
51960
52100
|
PARAM_ADDITIONAL_PERMISSIONS,
|
|
52101
|
+
UPDATE_TOPIC_TOOL_NAME,
|
|
52102
|
+
UPDATE_TOPIC_DISPLAY_NAME,
|
|
52103
|
+
TOPIC_PARAM_TITLE,
|
|
52104
|
+
TOPIC_PARAM_SUMMARY,
|
|
52105
|
+
TOPIC_PARAM_STRATEGIC_INTENT,
|
|
51961
52106
|
zodToJsonSchema,
|
|
52107
|
+
getUpdateTopicDeclaration,
|
|
51962
52108
|
REFERENCE_CONTENT_START,
|
|
51963
52109
|
REFERENCE_CONTENT_END,
|
|
51964
52110
|
DEFAULT_MAX_LINES_TEXT_FILE,
|
|
@@ -52023,6 +52169,7 @@ export {
|
|
|
52023
52169
|
getCurrentGeminiMdFilename,
|
|
52024
52170
|
getAllGeminiMdFilenames,
|
|
52025
52171
|
getGlobalMemoryFilePath,
|
|
52172
|
+
getProjectMemoryFilePath,
|
|
52026
52173
|
MemoryTool,
|
|
52027
52174
|
parseGoogleApiError,
|
|
52028
52175
|
isNodeError,
|
|
@@ -52061,6 +52208,7 @@ export {
|
|
|
52061
52208
|
readGeminiMdFiles,
|
|
52062
52209
|
concatenateInstructions,
|
|
52063
52210
|
getGlobalMemoryPaths,
|
|
52211
|
+
getUserProjectMemoryPaths,
|
|
52064
52212
|
getExtensionMemoryPaths,
|
|
52065
52213
|
getEnvironmentMemoryPaths,
|
|
52066
52214
|
categorizeAndConcatenate,
|