@@ -14,8 +14,6 @@ import {
1414 abortSession ,
1515 sendPrompt ,
1616 replyPermission ,
17- setAutoApprove ,
18- isAutoApprove ,
1917} from "./opencode.js" ;
2018import { registerSession , unregisterSession } from "./events.js" ;
2119import { saveExchange } from "./memory.js" ;
@@ -106,14 +104,7 @@ export function createBot(token: string, allowedUsers: number[]): Bot {
106104 }
107105 } ) ;
108106
109- bot . command ( "start" , async ( ctx ) => {
110- const sessionId = getSessionId ( ctx . chat . id ) ;
111- const autoApproveStatus = sessionId && isAutoApprove ( sessionId ) ? "on" : "off" ;
112- await ctx . reply (
113- `Welcome to ClawCode\\! Send me a message and I'll forward it to OpenCode\\.\n\nAuto\\-approve: *${ autoApproveStatus } *` ,
114- { parse_mode : "MarkdownV2" } ,
115- ) ;
116- } ) ;
107+
117108
118109 bot . command ( "new" , async ( ctx ) => {
119110 const chatId = ctx . chat . id ;
@@ -181,29 +172,6 @@ export function createBot(token: string, allowedUsers: number[]): Bot {
181172 }
182173 } ) ;
183174
184- bot . command ( "autoapprove" , async ( ctx ) => {
185- log . info ( `[cmd] /autoapprove chat=${ ctx . chat . id } ` ) ;
186- const arg = ctx . match ?. trim ( ) . toLowerCase ( ) ;
187- if ( arg !== "on" && arg !== "off" ) {
188- await ctx . reply ( "Usage: /autoapprove on \\| off" , { parse_mode : "MarkdownV2" } ) ;
189- return ;
190- }
191- const sessionId = getSessionId ( ctx . chat . id ) ;
192- if ( ! sessionId ) {
193- await ctx . reply ( "No active session\\. Use /new to create one\\." , {
194- parse_mode : "MarkdownV2" ,
195- } ) ;
196- return ;
197- }
198- const enabled = arg === "on" ;
199- setAutoApprove ( sessionId , enabled ) ;
200- log . info ( `[session] autoapprove=${ enabled } session=${ sessionId } ` ) ;
201- await ctx . reply (
202- escapeMarkdownV2 ( `Auto-approve ${ enabled ? "enabled" : "disabled" } for current session.` ) ,
203- { parse_mode : "MarkdownV2" } ,
204- ) ;
205- } ) ;
206-
207175 bot . command ( "history" , async ( ctx ) => {
208176 log . info ( `[cmd] /history chat=${ ctx . chat . id } ` ) ;
209177 const sessionId = getSessionId ( ctx . chat . id ) ;
@@ -380,15 +348,6 @@ export function createBot(token: string, allowedUsers: number[]): Bot {
380348 // onPermission
381349 async ( perm : PermissionEvent ) => {
382350 log . info ( `[permission] request permission=${ perm . permission } session=${ perm . sessionID } perm=${ perm . id } ` ) ;
383- if ( isAutoApprove ( perm . sessionID ) ) {
384- log . info ( `[permission] auto-approving perm=${ perm . id } ` ) ;
385- await replyPermission ( perm . sessionID , perm . id , "once" ) ;
386- await ctx . api . sendMessage ( chatId ,
387- escapeMarkdownV2 ( `Auto-approved: ${ perm . permission } ${ perm . patterns . join ( ", " ) } ` ) ,
388- { parse_mode : "MarkdownV2" } ,
389- ) ;
390- return ;
391- }
392351 const key = String ( ++ permCounter ) ;
393352 pendingPerms . set ( key , { sessionId : perm . sessionID , permissionId : perm . id } ) ;
394353 const keyboard = new InlineKeyboard ( )
0 commit comments