@@ -126,7 +126,7 @@ export type ClineOptions = {
126126 parentTask ?: Cline
127127 taskNumber ?: number
128128 onCreated ?: ( cline : Cline ) => void
129- // Context Summarization Settings
129+ // Context Synthesization Settings
130130 enableContextSummarization ?: boolean // Already added
131131 contextSummarizationTriggerThreshold ?: number // Already added
132132 contextSummarizationInitialStaticTurns ?: number // Already added
@@ -160,7 +160,7 @@ export class Cline extends EventEmitter<ClineEvents> {
160160 diffEnabled : boolean = false
161161 fuzzyMatchThreshold : number
162162
163- // Context Summarization Settings (Added)
163+ // Context Synthesization Settings (Added)
164164 readonly enableContextSummarization : boolean
165165 readonly contextSummarizationTriggerThreshold : number
166166 readonly contextSummarizationInitialStaticTurns : number
@@ -229,7 +229,7 @@ export class Cline extends EventEmitter<ClineEvents> {
229229 parentTask,
230230 taskNumber = - 1 ,
231231 onCreated,
232- // Context Summarization Settings (Added)
232+ // Context Synthesization Settings (Added)
233233 enableContextSummarization = false ,
234234 contextSummarizationTriggerThreshold = 80 ,
235235 contextSummarizationInitialStaticTurns = 5 ,
@@ -1062,7 +1062,7 @@ export class Cline extends EventEmitter<ClineEvents> {
10621062 : modelInfo . maxTokens
10631063
10641064 const contextWindow = modelInfo . contextWindow
1065- let historyModifiedBySummarization = false // Flag to track if summarization updated history
1065+ let historyModifiedBySynthesization = false // Flag to track if synthesization updated history
10661066
10671067 if ( this . enableContextSummarization ) {
10681068 // --- Synthesizing Logic ---
@@ -1090,20 +1090,20 @@ export class Cline extends EventEmitter<ClineEvents> {
10901090 if ( initialSliceEnd < recentSliceStart ) {
10911091 const initialMessages = this . apiConversationHistory . slice ( 0 , initialSliceEnd )
10921092 const recentMessages = this . apiConversationHistory . slice ( recentSliceStart )
1093- const messagesToSummarize = this . apiConversationHistory . slice (
1093+ const messagesToSynthesize = this . apiConversationHistory . slice (
10941094 initialSliceEnd ,
10951095 recentSliceStart ,
10961096 )
10971097
10981098 this . providerRef
10991099 . deref ( )
11001100 ?. log (
1101- `[Synthesizing] Slicing: Keep Initial ${ initialMessages . length } , Synthesize ${ messagesToSummarize . length } , Keep Recent ${ recentMessages . length } ` ,
1101+ `[Synthesizing] Slicing: Keep Initial ${ initialMessages . length } , Synthesize ${ messagesToSynthesize . length } , Keep Recent ${ recentMessages . length } ` ,
11021102 )
11031103
11041104 // Instantiate the synthesizer (consider using a dedicated API handler/model later)
11051105 const synthesizer = new ContextSynthesizer ( this . api )
1106- const summaryMessage = await synthesizer . synthesize ( messagesToSummarize )
1106+ const summaryMessage = await synthesizer . synthesize ( messagesToSynthesize )
11071107
11081108 if ( summaryMessage ) {
11091109 const newHistory = [ ...initialMessages , summaryMessage , ...recentMessages ]
@@ -1115,12 +1115,12 @@ export class Cline extends EventEmitter<ClineEvents> {
11151115 // Add a system message to notify the user in the UI
11161116 await this . say ( "text" , "[Older conversation turns synthesized to preserve context]" )
11171117 await this . overwriteApiConversationHistory ( newHistory )
1118- historyModifiedBySummarization = true // Mark history as modified
1118+ historyModifiedBySynthesization = true // Mark history as modified
11191119 } else {
11201120 this . providerRef
11211121 . deref ( )
11221122 ?. log ( `[Synthesizing] Synthesizing failed. Falling back to truncation.` )
1123- // Fall through to truncation if summarization fails
1123+ // Fall through to truncation if synthesization fails
11241124 }
11251125 } else {
11261126 this . providerRef
@@ -1139,15 +1139,15 @@ export class Cline extends EventEmitter<ClineEvents> {
11391139 // Fall through to truncation if history is too short
11401140 }
11411141 }
1142- // If summarization is enabled but threshold not met, do nothing and proceed.
1142+ // If synthesization is enabled but threshold not met, do nothing and proceed.
11431143 }
11441144
1145- // --- Truncation Logic (Only run if summarization didn't modify history) ---
1146- if ( ! historyModifiedBySummarization ) {
1145+ // --- Truncation Logic (Only run if synthesization didn't modify history) ---
1146+ if ( ! historyModifiedBySynthesization ) {
11471147 // Note: totalTokens here refers to the previous response size, used by truncateConversationIfNeeded
11481148 // to estimate if the *next* request might overflow.
11491149 const trimmedMessages = await truncateConversationIfNeeded ( {
1150- messages : this . apiConversationHistory , // Use potentially already summarized history if summarization failed above
1150+ messages : this . apiConversationHistory , // Use potentially already summarized history if synthesization failed above
11511151 totalTokens, // From previous response metrics
11521152 maxTokens,
11531153 contextWindow,
@@ -2695,9 +2695,9 @@ export class Cline extends EventEmitter<ClineEvents> {
26952695 }
26962696
26972697 /**
2698- * Manually triggers summarization of the conversation context.
2699- * @param isManualTrigger Whether this summarization was manually triggered by the user.
2700- * @returns A promise that resolves when summarization is complete.
2698+ * Manually triggers synthesization of the conversation context.
2699+ * @param isManualTrigger Whether this synthesization was manually triggered by the user.
2700+ * @returns A promise that resolves when synthesization is complete.
27012701 */
27022702 public async synthesizeConversationContext ( _isManualTrigger : boolean = false ) : Promise < void > {
27032703 // Skip if synthesizing is disabled
@@ -2736,17 +2736,17 @@ export class Cline extends EventEmitter<ClineEvents> {
27362736 // Slice the conversation history
27372737 const initialMessages = this . apiConversationHistory . slice ( 0 , initialSliceEnd )
27382738 const recentMessages = this . apiConversationHistory . slice ( recentSliceStart )
2739- const messagesToSummarize = this . apiConversationHistory . slice ( initialSliceEnd , recentSliceStart )
2739+ const messagesToSynthesize = this . apiConversationHistory . slice ( initialSliceEnd , recentSliceStart )
27402740
27412741 this . providerRef
27422742 . deref ( )
27432743 ?. log (
2744- `[Synthesizing] Slicing: Keep Initial ${ initialMessages . length } , Synthesize ${ messagesToSummarize . length } , Keep Recent ${ recentMessages . length } ` ,
2744+ `[Synthesizing] Slicing: Keep Initial ${ initialMessages . length } , Synthesize ${ messagesToSynthesize . length } , Keep Recent ${ recentMessages . length } ` ,
27452745 )
27462746
27472747 // Create synthesizer and generate synthesis
27482748 const synthesizer = new ContextSynthesizer ( this . api )
2749- const summaryMessage = await synthesizer . synthesize ( messagesToSummarize )
2749+ const summaryMessage = await synthesizer . synthesize ( messagesToSynthesize )
27502750
27512751 if ( ! summaryMessage ) {
27522752 this . providerRef . deref ( ) ?. log ( `[Synthesizing] Failed to generate synthesis.` )
@@ -2762,7 +2762,7 @@ export class Cline extends EventEmitter<ClineEvents> {
27622762 this . providerRef
27632763 . deref ( )
27642764 ?. log (
2765- `[Synthesizing] Successfully synthesized ${ messagesToSummarize . length } messages. New history length: ${ newHistory . length } ` ,
2765+ `[Synthesizing] Successfully synthesized ${ messagesToSynthesize . length } messages. New history length: ${ newHistory . length } ` ,
27662766 )
27672767 }
27682768}
0 commit comments