@@ -43,6 +43,11 @@ export interface Commands {
4343 protectedTools : string [ ]
4444}
4545
46+ export interface ManualModeConfig {
47+ enabled : boolean
48+ automaticStrategies : boolean
49+ }
50+
4651export interface SupersedeWrites {
4752 enabled : boolean
4853}
@@ -64,6 +69,7 @@ export interface PluginConfig {
6469 pruneNotification : "off" | "minimal" | "detailed"
6570 pruneNotificationType : "chat" | "toast"
6671 commands : Commands
72+ manualMode : ManualModeConfig
6773 turnProtection : TurnProtection
6874 protectedFilePatterns : string [ ]
6975 tools : Tools
@@ -102,6 +108,9 @@ export const VALID_CONFIG_KEYS = new Set([
102108 "commands" ,
103109 "commands.enabled" ,
104110 "commands.protectedTools" ,
111+ "manualMode" ,
112+ "manualMode.enabled" ,
113+ "manualMode.automaticStrategies" ,
105114 "tools" ,
106115 "tools.settings" ,
107116 "tools.settings.nudgeEnabled" ,
@@ -263,6 +272,36 @@ export function validateConfigTypes(config: Record<string, any>): ValidationErro
263272 }
264273 }
265274
275+ // Manual mode validator
276+ const manualMode = config . manualMode
277+ if ( manualMode !== undefined ) {
278+ if ( typeof manualMode === "object" ) {
279+ if ( manualMode . enabled !== undefined && typeof manualMode . enabled !== "boolean" ) {
280+ errors . push ( {
281+ key : "manualMode.enabled" ,
282+ expected : "boolean" ,
283+ actual : typeof manualMode . enabled ,
284+ } )
285+ }
286+ if (
287+ manualMode . automaticStrategies !== undefined &&
288+ typeof manualMode . automaticStrategies !== "boolean"
289+ ) {
290+ errors . push ( {
291+ key : "manualMode.automaticStrategies" ,
292+ expected : "boolean" ,
293+ actual : typeof manualMode . automaticStrategies ,
294+ } )
295+ }
296+ } else {
297+ errors . push ( {
298+ key : "manualMode" ,
299+ expected : "{ enabled: boolean, automaticStrategies: boolean }" ,
300+ actual : typeof manualMode ,
301+ } )
302+ }
303+ }
304+
266305 // Tools validators
267306 const tools = config . tools
268307 if ( tools ) {
@@ -529,6 +568,10 @@ const defaultConfig: PluginConfig = {
529568 enabled : true ,
530569 protectedTools : [ ...DEFAULT_PROTECTED_TOOLS ] ,
531570 } ,
571+ manualMode : {
572+ enabled : false ,
573+ automaticStrategies : true ,
574+ } ,
532575 turnProtection : {
533576 enabled : false ,
534577 turns : 4 ,
@@ -747,13 +790,29 @@ function mergeCommands(
747790 }
748791}
749792
793+ function mergeManualMode (
794+ base : PluginConfig [ "manualMode" ] ,
795+ override ?: Partial < PluginConfig [ "manualMode" ] > ,
796+ ) : PluginConfig [ "manualMode" ] {
797+ if ( override === undefined ) return base
798+
799+ return {
800+ enabled : override . enabled ?? base . enabled ,
801+ automaticStrategies : override . automaticStrategies ?? base . automaticStrategies ,
802+ }
803+ }
804+
750805function deepCloneConfig ( config : PluginConfig ) : PluginConfig {
751806 return {
752807 ...config ,
753808 commands : {
754809 enabled : config . commands . enabled ,
755810 protectedTools : [ ...config . commands . protectedTools ] ,
756811 } ,
812+ manualMode : {
813+ enabled : config . manualMode . enabled ,
814+ automaticStrategies : config . manualMode . automaticStrategies ,
815+ } ,
757816 turnProtection : { ...config . turnProtection } ,
758817 protectedFilePatterns : [ ...config . protectedFilePatterns ] ,
759818 tools : {
@@ -812,6 +871,7 @@ export function getConfig(ctx: PluginInput): PluginConfig {
812871 pruneNotificationType :
813872 result . data . pruneNotificationType ?? config . pruneNotificationType ,
814873 commands : mergeCommands ( config . commands , result . data . commands as any ) ,
874+ manualMode : mergeManualMode ( config . manualMode , result . data . manualMode as any ) ,
815875 turnProtection : {
816876 enabled : result . data . turnProtection ?. enabled ?? config . turnProtection . enabled ,
817877 turns : result . data . turnProtection ?. turns ?? config . turnProtection . turns ,
@@ -857,6 +917,7 @@ export function getConfig(ctx: PluginInput): PluginConfig {
857917 pruneNotificationType :
858918 result . data . pruneNotificationType ?? config . pruneNotificationType ,
859919 commands : mergeCommands ( config . commands , result . data . commands as any ) ,
920+ manualMode : mergeManualMode ( config . manualMode , result . data . manualMode as any ) ,
860921 turnProtection : {
861922 enabled : result . data . turnProtection ?. enabled ?? config . turnProtection . enabled ,
862923 turns : result . data . turnProtection ?. turns ?? config . turnProtection . turns ,
@@ -899,6 +960,7 @@ export function getConfig(ctx: PluginInput): PluginConfig {
899960 pruneNotificationType :
900961 result . data . pruneNotificationType ?? config . pruneNotificationType ,
901962 commands : mergeCommands ( config . commands , result . data . commands as any ) ,
963+ manualMode : mergeManualMode ( config . manualMode , result . data . manualMode as any ) ,
902964 turnProtection : {
903965 enabled : result . data . turnProtection ?. enabled ?? config . turnProtection . enabled ,
904966 turns : result . data . turnProtection ?. turns ?? config . turnProtection . turns ,
0 commit comments