@@ -102,7 +102,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
102102 protected mcpHub ?: McpHub // Change from private to protected
103103 private latestAnnouncementId = "mar-20-2025-3-10" // update to some unique identifier when we add a new announcement
104104 private settingsImportedAt ?: number
105- private contextProxy : ContextProxy
105+ public readonly contextProxy : ContextProxy
106106 public readonly providerSettingsManager : ProviderSettingsManager
107107 public readonly customModesManager : CustomModesManager
108108
@@ -1539,6 +1539,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
15391539 t ( "common:confirmation.just_this_message" ) ,
15401540 t ( "common:confirmation.this_and_subsequent" ) ,
15411541 )
1542+
15421543 if (
15431544 ( answer === t ( "common:confirmation.just_this_message" ) ||
15441545 answer === t ( "common:confirmation.this_and_subsequent" ) ) &&
@@ -1547,9 +1548,11 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
15471548 message . value
15481549 ) {
15491550 const timeCutoff = message . value - 1000 // 1 second buffer before the message to delete
1551+
15501552 const messageIndex = this . getCurrentCline ( ) ! . clineMessages . findIndex (
15511553 ( msg ) => msg . ts && msg . ts >= timeCutoff ,
15521554 )
1555+
15531556 const apiConversationHistoryIndex =
15541557 this . getCurrentCline ( ) ?. apiConversationHistory . findIndex (
15551558 ( msg ) => msg . ts && msg . ts >= timeCutoff ,
@@ -1570,6 +1573,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
15701573 const nextUserMessageIndex = this . getCurrentCline ( ) ! . clineMessages . findIndex (
15711574 ( msg ) => msg === nextUserMessage ,
15721575 )
1576+
15731577 // Keep messages before current message and after next user message
15741578 await this . getCurrentCline ( ) ! . overwriteClineMessages ( [
15751579 ...this . getCurrentCline ( ) ! . clineMessages . slice ( 0 , messageIndex ) ,
@@ -1981,12 +1985,11 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
19811985
19821986 await this . updateGlobalState ( "experiments" , updatedExperiments )
19831987
1984- // Update diffStrategy in current Cline instance if it exists
1985- if ( message . values [ EXPERIMENT_IDS . DIFF_STRATEGY ] !== undefined && this . getCurrentCline ( ) ) {
1986- await this . getCurrentCline ( ) ! . updateDiffStrategy (
1987- Experiments . isEnabled ( updatedExperiments , EXPERIMENT_IDS . DIFF_STRATEGY ) ,
1988- Experiments . isEnabled ( updatedExperiments , EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ) ,
1989- )
1988+ const currentCline = this . getCurrentCline ( )
1989+
1990+ // Update diffStrategy in current Cline instance if it exists.
1991+ if ( message . values [ EXPERIMENT_IDS . DIFF_STRATEGY_UNIFIED ] !== undefined && currentCline ) {
1992+ await currentCline . updateDiffStrategy ( updatedExperiments )
19901993 }
19911994
19921995 await this . postStateToWebview ( )
@@ -2084,13 +2087,13 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
20842087 language,
20852088 } = await this . getState ( )
20862089
2087- // Create diffStrategy based on current model and settings
2088- const diffStrategy = getDiffStrategy (
2089- apiConfiguration . apiModelId || apiConfiguration . openRouterModelId || "" ,
2090+ // Create diffStrategy based on current model and settings.
2091+ const diffStrategy = getDiffStrategy ( {
2092+ model : apiConfiguration . apiModelId || apiConfiguration . openRouterModelId || "" ,
2093+ experiments,
20902094 fuzzyMatchThreshold,
2091- Experiments . isEnabled ( experiments , EXPERIMENT_IDS . DIFF_STRATEGY ) ,
2092- Experiments . isEnabled ( experiments , EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ) ,
2093- )
2095+ } )
2096+
20942097 const cwd = this . cwd
20952098
20962099 const mode = message . mode ?? defaultModeSlug
@@ -2146,6 +2149,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
21462149 public async handleModeSwitch ( newMode : Mode ) {
21472150 // Capture mode switch telemetry event
21482151 const currentTaskId = this . getCurrentCline ( ) ?. taskId
2152+
21492153 if ( currentTaskId ) {
21502154 telemetryService . captureModeSwitch ( currentTaskId , newMode )
21512155 }
@@ -2162,8 +2166,10 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
21622166 // If this mode has a saved config, use it
21632167 if ( savedConfigId ) {
21642168 const config = listApiConfig ?. find ( ( c ) => c . id === savedConfigId )
2169+
21652170 if ( config ?. name ) {
21662171 const apiConfig = await this . providerSettingsManager . loadConfig ( config . name )
2172+
21672173 await Promise . all ( [
21682174 this . updateGlobalState ( "currentApiConfigName" , config . name ) ,
21692175 this . updateApiConfiguration ( apiConfig ) ,
@@ -2175,6 +2181,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
21752181
21762182 if ( currentApiConfigName ) {
21772183 const config = listApiConfig ?. find ( ( c ) => c . name === currentApiConfigName )
2184+
21782185 if ( config ?. id ) {
21792186 await this . providerSettingsManager . setModeConfig ( newMode , config . id )
21802187 }
0 commit comments