11mod agent;
22mod apply_patch;
33mod bash;
4+ #[ cfg( feature = "code-search" ) ]
45mod code_search;
56mod exec_command;
67mod file_write;
@@ -23,6 +24,7 @@ mod websearch;
2324pub use agent:: register_agent_tools;
2425pub use apply_patch:: ApplyPatchHandler ;
2526pub use bash:: BashHandler ;
27+ #[ cfg( feature = "code-search" ) ]
2628pub use code_search:: CodeSearchHandler ;
2729pub use exec_command:: { ExecCommandHandler , WriteStdinHandler } ;
2830pub use file_write:: WriteHandler ;
@@ -130,7 +132,14 @@ fn build_registry_from_builder(
130132 for ( kind, name) in handlers {
131133 let handler: Arc < dyn ToolHandler > = match kind {
132134 ToolHandlerKind :: Bash => Arc :: new ( BashHandler :: new ( ) ) ,
135+ #[ cfg( feature = "code-search" ) ]
133136 ToolHandlerKind :: CodeSearch => Arc :: new ( CodeSearchHandler :: new ( ) ) ,
137+ // When the `code-search` feature is disabled the planner never emits
138+ // this handler kind (see registry_plan), so the arm is unreachable.
139+ #[ cfg( not( feature = "code-search" ) ) ]
140+ ToolHandlerKind :: CodeSearch => {
141+ unreachable ! ( "code_search handler requested but `code-search` feature is disabled" )
142+ }
134143 ToolHandlerKind :: ShellCommand => Arc :: new ( ShellCommandHandler :: new ( ) ) ,
135144 ToolHandlerKind :: Read => Arc :: new ( ReadHandler :: new ( ) ) ,
136145 ToolHandlerKind :: Write => Arc :: new ( WriteHandler :: new ( ) ) ,
0 commit comments