@@ -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
@@ -1590,6 +1590,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
15901590 t ( "common:confirmation.just_this_message" ) ,
15911591 t ( "common:confirmation.this_and_subsequent" ) ,
15921592 )
1593+
15931594 if (
15941595 ( answer === t ( "common:confirmation.just_this_message" ) ||
15951596 answer === t ( "common:confirmation.this_and_subsequent" ) ) &&
@@ -1598,9 +1599,11 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
15981599 message . value
15991600 ) {
16001601 const timeCutoff = message . value - 1000 // 1 second buffer before the message to delete
1602+
16011603 const messageIndex = this . getCurrentCline ( ) ! . clineMessages . findIndex (
16021604 ( msg ) => msg . ts && msg . ts >= timeCutoff ,
16031605 )
1606+
16041607 const apiConversationHistoryIndex =
16051608 this . getCurrentCline ( ) ?. apiConversationHistory . findIndex (
16061609 ( msg ) => msg . ts && msg . ts >= timeCutoff ,
@@ -1621,6 +1624,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
16211624 const nextUserMessageIndex = this . getCurrentCline ( ) ! . clineMessages . findIndex (
16221625 ( msg ) => msg === nextUserMessage ,
16231626 )
1627+
16241628 // Keep messages before current message and after next user message
16251629 await this . getCurrentCline ( ) ! . overwriteClineMessages ( [
16261630 ...this . getCurrentCline ( ) ! . clineMessages . slice ( 0 , messageIndex ) ,
@@ -2032,12 +2036,11 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
20322036
20332037 await this . updateGlobalState ( "experiments" , updatedExperiments )
20342038
2035- // Update diffStrategy in current Cline instance if it exists
2036- if ( message . values [ EXPERIMENT_IDS . DIFF_STRATEGY ] !== undefined && this . getCurrentCline ( ) ) {
2037- await this . getCurrentCline ( ) ! . updateDiffStrategy (
2038- Experiments . isEnabled ( updatedExperiments , EXPERIMENT_IDS . DIFF_STRATEGY ) ,
2039- Experiments . isEnabled ( updatedExperiments , EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ) ,
2040- )
2039+ const currentCline = this . getCurrentCline ( )
2040+
2041+ // Update diffStrategy in current Cline instance if it exists.
2042+ if ( message . values [ EXPERIMENT_IDS . DIFF_STRATEGY_UNIFIED ] !== undefined && currentCline ) {
2043+ await currentCline . updateDiffStrategy ( updatedExperiments )
20412044 }
20422045
20432046 await this . postStateToWebview ( )
@@ -2135,13 +2138,13 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
21352138 language,
21362139 } = await this . getState ( )
21372140
2138- // Create diffStrategy based on current model and settings
2139- const diffStrategy = getDiffStrategy (
2140- apiConfiguration . apiModelId || apiConfiguration . openRouterModelId || "" ,
2141+ // Create diffStrategy based on current model and settings.
2142+ const diffStrategy = getDiffStrategy ( {
2143+ model : apiConfiguration . apiModelId || apiConfiguration . openRouterModelId || "" ,
2144+ experiments,
21412145 fuzzyMatchThreshold,
2142- Experiments . isEnabled ( experiments , EXPERIMENT_IDS . DIFF_STRATEGY ) ,
2143- Experiments . isEnabled ( experiments , EXPERIMENT_IDS . MULTI_SEARCH_AND_REPLACE ) ,
2144- )
2146+ } )
2147+
21452148 const cwd = this . cwd
21462149
21472150 const mode = message . mode ?? defaultModeSlug
@@ -2197,6 +2200,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
21972200 public async handleModeSwitch ( newMode : Mode ) {
21982201 // Capture mode switch telemetry event
21992202 const currentTaskId = this . getCurrentCline ( ) ?. taskId
2203+
22002204 if ( currentTaskId ) {
22012205 telemetryService . captureModeSwitch ( currentTaskId , newMode )
22022206 }
@@ -2213,8 +2217,10 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
22132217 // If this mode has a saved config, use it
22142218 if ( savedConfigId ) {
22152219 const config = listApiConfig ?. find ( ( c ) => c . id === savedConfigId )
2220+
22162221 if ( config ?. name ) {
22172222 const apiConfig = await this . providerSettingsManager . loadConfig ( config . name )
2223+
22182224 await Promise . all ( [
22192225 this . updateGlobalState ( "currentApiConfigName" , config . name ) ,
22202226 this . updateApiConfiguration ( apiConfig ) ,
@@ -2226,6 +2232,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
22262232
22272233 if ( currentApiConfigName ) {
22282234 const config = listApiConfig ?. find ( ( c ) => c . name === currentApiConfigName )
2235+
22292236 if ( config ?. id ) {
22302237 await this . providerSettingsManager . setModeConfig ( newMode , config . id )
22312238 }
0 commit comments