feat(IterativeContextBuilder): Add iterative AI-driven context builder and integrate into task factory; add tests and iterative configuration
This commit is contained in:
@@ -9,7 +9,8 @@ import type {
|
||||
ICacheConfig,
|
||||
IAnalyzerConfig,
|
||||
IPrioritizationWeights,
|
||||
ITierConfig
|
||||
ITierConfig,
|
||||
IIterativeConfig
|
||||
} from './types.js';
|
||||
|
||||
/**
|
||||
@@ -98,6 +99,13 @@ export class ConfigManager {
|
||||
essential: { minScore: 0.8, trimLevel: 'none' },
|
||||
important: { minScore: 0.5, trimLevel: 'light' },
|
||||
optional: { minScore: 0.2, trimLevel: 'aggressive' }
|
||||
},
|
||||
iterative: {
|
||||
maxIterations: 5,
|
||||
firstPassFileLimit: 10,
|
||||
subsequentPassFileLimit: 5,
|
||||
temperature: 0.3,
|
||||
model: 'gpt-4-turbo-preview'
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -156,15 +164,15 @@ export class ConfigManager {
|
||||
*/
|
||||
private mergeConfigs(defaultConfig: IContextConfig, userConfig: Partial<IContextConfig>): IContextConfig {
|
||||
const result: IContextConfig = { ...defaultConfig };
|
||||
|
||||
|
||||
// Merge top-level properties
|
||||
if (userConfig.maxTokens !== undefined) result.maxTokens = userConfig.maxTokens;
|
||||
if (userConfig.defaultMode !== undefined) result.defaultMode = userConfig.defaultMode;
|
||||
|
||||
|
||||
// Merge task-specific settings
|
||||
if (userConfig.taskSpecificSettings) {
|
||||
result.taskSpecificSettings = result.taskSpecificSettings || {};
|
||||
|
||||
|
||||
// For each task type, merge settings
|
||||
(['readme', 'commit', 'description'] as TaskType[]).forEach(taskType => {
|
||||
if (userConfig.taskSpecificSettings?.[taskType]) {
|
||||
@@ -175,7 +183,7 @@ export class ConfigManager {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Merge trimming configuration
|
||||
if (userConfig.trimming) {
|
||||
result.trimming = {
|
||||
@@ -216,6 +224,14 @@ export class ConfigManager {
|
||||
};
|
||||
}
|
||||
|
||||
// Merge iterative configuration
|
||||
if (userConfig.iterative) {
|
||||
result.iterative = {
|
||||
...result.iterative,
|
||||
...userConfig.iterative
|
||||
};
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -331,6 +347,19 @@ export class ConfigManager {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get iterative configuration
|
||||
*/
|
||||
public getIterativeConfig(): IIterativeConfig {
|
||||
return this.config.iterative || {
|
||||
maxIterations: 5,
|
||||
firstPassFileLimit: 10,
|
||||
subsequentPassFileLimit: 5,
|
||||
temperature: 0.3,
|
||||
model: 'gpt-4-turbo-preview'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the config cache (force reload on next access)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user