@@ -2628,56 +2628,60 @@ test("activateSession temporarily asks before allowed writes in Plan Mode", asyn
26282628 assert . deepEqual ( assistant ?. meta ?. permissions , [ { toolCallId : "call-write" , permission : "ask" } ] ) ;
26292629} ) ;
26302630
2631- test ( "activateSession does not force allowed temporary writes to ask in Plan Mode" , async ( ) => {
2632- const workspace = createTempDir ( "deepcode-plan-tmp-permission-workspace-" ) ;
2633- const home = createTempDir ( "deepcode-plan-tmp-permission-home-" ) ;
2634- const targetPath = path . join ( "/tmp" , `deepcode-plan-${ crypto . randomUUID ( ) } .txt` ) ;
2635- tempDirs . push ( targetPath ) ;
2636- setHomeDir ( home ) ;
2631+ test (
2632+ "activateSession does not force allowed temporary writes to ask in Plan Mode" ,
2633+ { skip : process . platform === "win32" } ,
2634+ async ( ) => {
2635+ const workspace = createTempDir ( "deepcode-plan-tmp-permission-workspace-" ) ;
2636+ const home = createTempDir ( "deepcode-plan-tmp-permission-home-" ) ;
2637+ const targetPath = path . join ( "/tmp" , `deepcode-plan-${ crypto . randomUUID ( ) } .txt` ) ;
2638+ tempDirs . push ( targetPath ) ;
2639+ setHomeDir ( home ) ;
26372640
2638- const manager = createPermissionSessionManager (
2639- workspace ,
2640- [
2641- {
2642- choices : [
2643- {
2644- message : {
2645- content : "" ,
2646- tool_calls : [
2647- {
2648- id : "call-write-tmp" ,
2649- type : "function" ,
2650- function : {
2651- name : "write" ,
2652- arguments : JSON . stringify ( { file_path : targetPath , content : "planned" } ) ,
2641+ const manager = createPermissionSessionManager (
2642+ workspace ,
2643+ [
2644+ {
2645+ choices : [
2646+ {
2647+ message : {
2648+ content : "" ,
2649+ tool_calls : [
2650+ {
2651+ id : "call-write-tmp" ,
2652+ type : "function" ,
2653+ function : {
2654+ name : "write" ,
2655+ arguments : JSON . stringify ( { file_path : targetPath , content : "planned" } ) ,
2656+ } ,
26532657 } ,
2654- } ,
2655- ] ,
2658+ ] ,
2659+ } ,
26562660 } ,
2657- } ,
2658- ] ,
2659- usage : { prompt_tokens : 1 , completion_tokens : 1 , total_tokens : 2 } ,
2660- } ,
2661- createChatResponse ( "done" , { prompt_tokens : 1 , completion_tokens : 1 , total_tokens : 2 } ) ,
2662- ] ,
2663- {
2664- allow : [ "write-in-tmp" ] ,
2665- deny : [ ] ,
2666- ask : [ ] ,
2667- defaultMode : "allowAll" ,
2668- }
2669- ) ;
2661+ ] ,
2662+ usage : { prompt_tokens : 1 , completion_tokens : 1 , total_tokens : 2 } ,
2663+ } ,
2664+ createChatResponse ( "done" , { prompt_tokens : 1 , completion_tokens : 1 , total_tokens : 2 } ) ,
2665+ ] ,
2666+ {
2667+ allow : [ "write-in-tmp" ] ,
2668+ deny : [ ] ,
2669+ ask : [ ] ,
2670+ defaultMode : "allowAll" ,
2671+ }
2672+ ) ;
26702673
2671- const sessionId = await manager . createSession ( { text : "Plan this change" , planMode : true } ) ;
2672- const session = manager . getSession ( sessionId ) ;
2673- const assistant = manager
2674- . listSessionMessages ( sessionId )
2675- . find ( ( message ) => message . role === "assistant" && ( message . messageParams as any ) ?. tool_calls ) ;
2674+ const sessionId = await manager . createSession ( { text : "Plan this change" , planMode : true } ) ;
2675+ const session = manager . getSession ( sessionId ) ;
2676+ const assistant = manager
2677+ . listSessionMessages ( sessionId )
2678+ . find ( ( message ) => message . role === "assistant" && ( message . messageParams as any ) ?. tool_calls ) ;
26762679
2677- assert . equal ( session ?. status , "completed" ) ;
2678- assert . deepEqual ( assistant ?. meta ?. permissions , [ { toolCallId : "call-write-tmp" , permission : "allow" } ] ) ;
2679- assert . equal ( fs . readFileSync ( targetPath , "utf8" ) , "planned" ) ;
2680- } ) ;
2680+ assert . equal ( session ?. status , "completed" ) ;
2681+ assert . deepEqual ( assistant ?. meta ?. permissions , [ { toolCallId : "call-write-tmp" , permission : "allow" } ] ) ;
2682+ assert . equal ( fs . readFileSync ( targetPath , "utf8" ) , "planned" ) ;
2683+ }
2684+ ) ;
26812685
26822686test ( "SessionManager preserves permission_denied status when sessions are reloaded" , async ( ) => {
26832687 const workspace = createTempDir ( "deepcode-permission-denied-workspace-" ) ;
0 commit comments