@@ -17,23 +17,42 @@ const nextHandler = async (call: ToolCall): Promise<ToolResult> => ({
1717
1818describe ( "isProtectedEvidenceLocation" , ( ) => {
1919 test ( "matches evidence-archive and tool-output/archive-* forms" , ( ) => {
20- expect ( isProtectedEvidenceLocation ( "evidence-archive/index.jsonl" ) ) . toBe ( true ) ;
21- expect ( isProtectedEvidenceLocation ( "/tmp/context/evidence-archive" ) ) . toBe ( true ) ;
22- expect ( isProtectedEvidenceLocation ( "C:\\tmp\\evidence-archive\\index.jsonl" ) ) . toBe ( true ) ;
23- expect ( isProtectedEvidenceLocation ( "tool-output/archive-sess-occ-1" ) ) . toBe ( true ) ;
24- expect ( isProtectedEvidenceLocation ( "tool-output:///archive-sess-occ-1" ) ) . toBe ( true ) ;
25- expect ( isProtectedEvidenceLocation ( "src/session/compaction-archive.ts" ) ) . toBe ( false ) ;
26- expect ( isProtectedEvidenceLocation ( "tool-output:///other-spill" ) ) . toBe ( false ) ;
20+ expect ( isProtectedEvidenceLocation ( "evidence-archive/index.jsonl" ) ) . toBe (
21+ true ,
22+ ) ;
23+ expect ( isProtectedEvidenceLocation ( "/tmp/context/evidence-archive" ) ) . toBe (
24+ true ,
25+ ) ;
26+ expect (
27+ isProtectedEvidenceLocation ( "C:\\tmp\\evidence-archive\\index.jsonl" ) ,
28+ ) . toBe ( true ) ;
29+ expect ( isProtectedEvidenceLocation ( "tool-output/archive-sess-occ-1" ) ) . toBe (
30+ true ,
31+ ) ;
32+ expect (
33+ isProtectedEvidenceLocation ( "tool-output:///archive-sess-occ-1" ) ,
34+ ) . toBe ( true ) ;
35+ expect (
36+ isProtectedEvidenceLocation ( "src/session/compaction-archive.ts" ) ,
37+ ) . toBe ( false ) ;
38+ expect ( isProtectedEvidenceLocation ( "tool-output:///other-spill" ) ) . toBe (
39+ false ,
40+ ) ;
2741 } ) ;
2842} ) ;
2943
3044describe ( "evidenceArchivePathGuardPlugin" , ( ) => {
3145 test ( "denies path tools targeting evidence-archive or tool-output/archive-*" , async ( ) => {
3246 const plugin = evidenceArchivePathGuardPlugin ( ) ;
33- const handler = plugin . middleware ? plugin . middleware ( nextHandler ) : nextHandler ;
47+ const handler = plugin . middleware
48+ ? plugin . middleware ( nextHandler )
49+ : nextHandler ;
3450 const denied = [
3551 makeCall ( "read_file" , { path : "evidence-archive/index.jsonl" } ) ,
36- makeCall ( "grep" , { path : "/tmp/context/evidence-archive" , pattern : "foo" } ) ,
52+ makeCall ( "grep" , {
53+ path : "/tmp/context/evidence-archive" ,
54+ pattern : "foo" ,
55+ } ) ,
3756 makeCall ( "search_files" , { path : "evidence-archive" } ) ,
3857 makeCall ( "list_dir" , { path : "evidence-archive" } ) ,
3958 makeCall ( "write_file" , { path : "evidence-archive/x" , content : "nope" } ) ,
@@ -50,7 +69,9 @@ describe("evidenceArchivePathGuardPlugin", () => {
5069
5170 test ( "does not deny a grep pattern that mentions evidence-archive" , async ( ) => {
5271 const plugin = evidenceArchivePathGuardPlugin ( ) ;
53- const handler = plugin . middleware ? plugin . middleware ( nextHandler ) : nextHandler ;
72+ const handler = plugin . middleware
73+ ? plugin . middleware ( nextHandler )
74+ : nextHandler ;
5475 const result = await handler (
5576 makeCall ( "grep" , { path : "src" , pattern : "evidence-archive" } ) ,
5677 new AbortController ( ) . signal ,
@@ -61,7 +82,9 @@ describe("evidenceArchivePathGuardPlugin", () => {
6182
6283 test ( "passes ordinary workspace paths" , async ( ) => {
6384 const plugin = evidenceArchivePathGuardPlugin ( ) ;
64- const handler = plugin . middleware ? plugin . middleware ( nextHandler ) : nextHandler ;
85+ const handler = plugin . middleware
86+ ? plugin . middleware ( nextHandler )
87+ : nextHandler ;
6588 const result = await handler (
6689 makeCall ( "read_file" , { path : "src/session/compaction-archive.ts" } ) ,
6790 new AbortController ( ) . signal ,
0 commit comments