You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: Add file context tracking system
This commit adds a comprehensive file context tracking system that monitors file operations (reads, edits) by both Roo and users. The system helps prevent stale context issues and improves checkpoint management.
Key features:
- Track files accessed via tools, mentions, or edits
- Monitor file changes outside of Roo using file watchers
- Store file operation metadata with timestamps
- Trigger checkpoints automatically when files are modified
- Prevent false positives by distinguishing between Roo and user edits
The implementation includes:
- New FileContextTracker class to manage file operations
- Type definitions for file metadata tracking
- Integration with all file-related tools
- File mention tracking in the mentions system
- Improved checkpoint triggering based on file modifications
* Update src/core/context-tracking/FileContextTracker.ts
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
* Update src/core/context-tracking/FileContextTracker.ts
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
* test: Add mocks for getFileContextTracker in Cline tests
---------
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>
@@ -929,6 +932,7 @@ export class Cline extends EventEmitter<ClineEvents> {
929
932
this.urlContentFetcher.closeBrowser()
930
933
this.browserSession.closeBrowser()
931
934
this.rooIgnoreController?.dispose()
935
+
this.fileContextTracker.dispose()
932
936
933
937
// If we're not streaming then `abortStream` (which reverts the diff
934
938
// view changes) won't be called, so we need to revert the changes here.
@@ -1322,8 +1326,6 @@ export class Cline extends EventEmitter<ClineEvents> {
1322
1326
1323
1327
constblock=cloneDeep(this.assistantMessageContent[this.currentStreamingContentIndex])// need to create copy bc while stream is updating the array, it could be updating the reference block properties too
1324
1328
1325
-
letisCheckpointPossible=false
1326
-
1327
1329
switch(block.type){
1328
1330
case"text": {
1329
1331
if(this.didRejectTool||this.didAlreadyUseTool){
@@ -1460,7 +1462,6 @@ export class Cline extends EventEmitter<ClineEvents> {
1460
1462
1461
1463
// Flag a checkpoint as possible since we've used a tool
1462
1464
// which may have changed the file system.
1463
-
isCheckpointPossible=true
1464
1465
}
1465
1466
1466
1467
constaskApproval=async(
@@ -1583,6 +1584,7 @@ export class Cline extends EventEmitter<ClineEvents> {
// since we sent off a placeholder api_req_started message to update the webview while waiting to actually start the API request (to load potential details for example), we need to update the text of that message
// Process userContent array, which contains various block types:
2050
-
// TextBlockParam, ImageBlockParam, ToolUseBlockParam, and ToolResultBlockParam.
2051
-
// We need to apply parseMentions() to:
2052
-
// 1. All TextBlockParam's text (first user message with task)
2053
-
// 2. ToolResultBlockParam's content/context text arrays if it contains "<feedback>" (see formatToolDeniedFeedback, attemptCompletion, executeCommand, and consecutiveMistakeCount >= 3) or "<answer>" (see askFollowupQuestion), we place all user generated content in these tags so they can effectively be used as markers for when we should parse mentions)
// Process userContent array, which contains various block types:
2052
+
// TextBlockParam, ImageBlockParam, ToolUseBlockParam, and ToolResultBlockParam.
2053
+
// We need to apply parseMentions() to:
2054
+
// 1. All TextBlockParam's text (first user message with task)
2055
+
// 2. ToolResultBlockParam's content/context text arrays if it contains "<feedback>" (see formatToolDeniedFeedback, attemptCompletion, executeCommand, and consecutiveMistakeCount >= 3) or "<answer>" (see askFollowupQuestion), we place all user generated content in these tags so they can effectively be used as markers for when we should parse mentions)
"\n\n# Recently Modified Files\nThese files have been modified since you last accessed them (file was just edited so you may need to re-read it before editing):"
2273
+
for(constfilePathofrecentlyModifiedFiles){
2274
+
details+=`\n${filePath}`
2275
+
}
2276
+
}
2277
+
2254
2278
if(terminalDetails){
2255
2279
details+=terminalDetails
2256
2280
}
@@ -2619,4 +2643,9 @@ export class Cline extends EventEmitter<ClineEvents> {
0 commit comments