@@ -136,6 +136,7 @@ export function Prompt(props: PromptProps) {
136136 const dimensions = useTerminalDimensions ( )
137137 const { theme, syntax } = useTheme ( )
138138 const kv = useKV ( )
139+ const [ autoaccept , setAutoaccept ] = kv . signal < "none" | "edit" > ( "permission_auto_accept" , "edit" )
139140 const animationsEnabled = createMemo ( ( ) => kv . get ( "animations_enabled" , true ) )
140141 const list = createMemo ( ( ) => props . placeholders ?. normal ?? [ ] )
141142 const shell = createMemo ( ( ) => props . placeholders ?. shell ?? [ ] )
@@ -174,7 +175,7 @@ export function Prompt(props: PromptProps) {
174175 let lastSubmittedEditorSelectionKey : string | undefined
175176 const [ auto , setAuto ] = createSignal < AutocompleteRef > ( )
176177 const currentProviderLabel = createMemo ( ( ) => local . model . parsed ( ) . provider )
177- const hasRightContent = createMemo ( ( ) => Boolean ( props . right ) )
178+ const hasRightContent = createMemo ( ( ) => Boolean ( props . right ) || autoaccept ( ) === "edit" )
178179
179180 function promptModelWarning ( ) {
180181 toast . show ( {
@@ -296,6 +297,17 @@ export function Prompt(props: PromptProps) {
296297
297298 command . register ( ( ) => {
298299 return [
300+ {
301+ title : autoaccept ( ) === "none" ? "Enable autoedit" : "Disable autoedit" ,
302+ value : "permission.auto_accept.toggle" ,
303+ search : "toggle permissions" ,
304+ keybind : "permission_auto_accept_toggle" ,
305+ category : "Agent" ,
306+ onSelect : ( dialog ) => {
307+ setAutoaccept ( ( ) => ( autoaccept ( ) === "none" ? "edit" : "none" ) )
308+ dialog . clear ( )
309+ } ,
310+ } ,
299311 {
300312 title : "Clear prompt" ,
301313 value : "prompt.clear" ,
@@ -1324,6 +1336,11 @@ export function Prompt(props: PromptProps) {
13241336 </ box >
13251337 < Show when = { hasRightContent ( ) } >
13261338 < box flexDirection = "row" gap = { 1 } alignItems = "center" >
1339+ < Show when = { autoaccept ( ) === "edit" } >
1340+ < text >
1341+ < span style = { { fg : theme . warning } } > autoedit</ span >
1342+ </ text >
1343+ </ Show >
13271344 { props . right }
13281345 </ box >
13291346 </ Show >
0 commit comments